|
|
@@ -92,9 +92,11 @@ class PluginTest extends TestCase
|
|
|
Plugin::load('TestPlugin');
|
|
|
$expected = ['TestPlugin'];
|
|
|
$this->assertEquals($expected, Plugin::loaded());
|
|
|
+ $this->assertTrue(Plugin::isLoaded('TestPlugin'));
|
|
|
|
|
|
Plugin::unload('TestPlugin');
|
|
|
$this->assertEquals([], Plugin::loaded());
|
|
|
+ $this->assertFalse(Plugin::isLoaded('TestPlugin'));
|
|
|
|
|
|
Plugin::load('TestPlugin');
|
|
|
$expected = ['TestPlugin'];
|
|
|
@@ -102,6 +104,7 @@ class PluginTest extends TestCase
|
|
|
|
|
|
Plugin::unload('TestFakePlugin');
|
|
|
$this->assertEquals($expected, Plugin::loaded());
|
|
|
+ $this->assertFalse(Plugin::isLoaded('TestFakePlugin'));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -144,6 +147,21 @@ class PluginTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Tests deprecated usage of loaded()
|
|
|
+ *
|
|
|
+ * @deprecated
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testIsLoaded()
|
|
|
+ {
|
|
|
+ $this->deprecated(function () {
|
|
|
+ Plugin::load('TestPlugin');
|
|
|
+ $this->assertTrue(Plugin::loaded('TestPlugin'));
|
|
|
+ $this->assertFalse(Plugin::loaded('Unknown'));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Tests loading a plugin and its bootstrap file
|
|
|
*
|
|
|
* @return void
|
|
|
@@ -151,11 +169,11 @@ class PluginTest extends TestCase
|
|
|
public function testLoadWithBootstrap()
|
|
|
{
|
|
|
Plugin::load('TestPlugin', ['bootstrap' => true]);
|
|
|
- $this->assertTrue(Plugin::loaded('TestPlugin'));
|
|
|
+ $this->assertTrue(Plugin::isLoaded('TestPlugin'));
|
|
|
$this->assertEquals('loaded plugin bootstrap', Configure::read('PluginTest.test_plugin.bootstrap'));
|
|
|
|
|
|
Plugin::load('Company/TestPluginThree', ['bootstrap' => true]);
|
|
|
- $this->assertTrue(Plugin::loaded('Company/TestPluginThree'));
|
|
|
+ $this->assertTrue(Plugin::isLoaded('Company/TestPluginThree'));
|
|
|
$this->assertEquals('loaded plugin three bootstrap', Configure::read('PluginTest.test_plugin_three.bootstrap'));
|
|
|
}
|
|
|
|
|
|
@@ -167,7 +185,7 @@ class PluginTest extends TestCase
|
|
|
public function testLoadWithBootstrapDisableBootstrapHook()
|
|
|
{
|
|
|
Plugin::load('TestPlugin', ['bootstrap' => true]);
|
|
|
- $this->assertTrue(Plugin::loaded('TestPlugin'));
|
|
|
+ $this->assertTrue(Plugin::isLoaded('TestPlugin'));
|
|
|
$this->assertEquals('loaded plugin bootstrap', Configure::read('PluginTest.test_plugin.bootstrap'));
|
|
|
|
|
|
$plugin = Plugin::getCollection()->get('TestPlugin');
|