diff --git a/tests/TestCase/Http/SessionTest.php b/tests/TestCase/Http/SessionTest.php index 25a3adbd43f..67b129bc4c3 100644 --- a/tests/TestCase/Http/SessionTest.php +++ b/tests/TestCase/Http/SessionTest.php @@ -14,6 +14,7 @@ */ namespace Cake\Test\TestCase\Network; +use Cake\Core\Plugin; use Cake\Http\Session; use Cake\Http\Session\CacheSession; use Cake\Http\Session\DatabaseSession; diff --git a/tests/TestCase/Mailer/EmailTest.php b/tests/TestCase/Mailer/EmailTest.php index f16db7817e8..d00797d9366 100644 --- a/tests/TestCase/Mailer/EmailTest.php +++ b/tests/TestCase/Mailer/EmailTest.php @@ -1763,6 +1763,7 @@ public function testSendRenderThemed() $this->assertContains('Message-ID: ', $result['headers']); $this->assertContains('To: ', $result['headers']); $this->assertContains('/test_theme/img/test.jpg', $result['message']); + Plugin::unload(); } /** diff --git a/tests/TestCase/ORM/AssociationTest.php b/tests/TestCase/ORM/AssociationTest.php index 1e3c9621aed..f3316cb2c8c 100644 --- a/tests/TestCase/ORM/AssociationTest.php +++ b/tests/TestCase/ORM/AssociationTest.php @@ -470,6 +470,7 @@ public function testTargetPlugin() $this->assertSame('TestPlugin.ThisAssociationName', $table->getRegistryAlias()); $this->assertSame('comments', $table->getTable()); $this->assertSame('ThisAssociationName', $table->getAlias()); + Plugin::unload(); } /** diff --git a/tests/TestCase/ORM/Locator/TableLocatorTest.php b/tests/TestCase/ORM/Locator/TableLocatorTest.php index ca157a36604..4822e96f182 100644 --- a/tests/TestCase/ORM/Locator/TableLocatorTest.php +++ b/tests/TestCase/ORM/Locator/TableLocatorTest.php @@ -61,6 +61,17 @@ public function setUp() $this->_locator = new TableLocator; } + /** + * tearDown + * + * @return void + */ + public function tearDown() + { + Plugin::unload(); + parent::tearDown(); + } + /** * Test config() method. * diff --git a/tests/TestCase/ORM/QueryRegressionTest.php b/tests/TestCase/ORM/QueryRegressionTest.php index f4d27b4fa3d..7b248029c61 100644 --- a/tests/TestCase/ORM/QueryRegressionTest.php +++ b/tests/TestCase/ORM/QueryRegressionTest.php @@ -545,6 +545,7 @@ public function testPluginAssociationQueryGeneration() $result->author->id, 'No SQL error and author exists.' ); + Plugin::unload(); } /** diff --git a/tests/TestCase/ORM/ResultSetTest.php b/tests/TestCase/ORM/ResultSetTest.php index fd7a7bf855f..4a27ef9eb18 100644 --- a/tests/TestCase/ORM/ResultSetTest.php +++ b/tests/TestCase/ORM/ResultSetTest.php @@ -397,6 +397,7 @@ public function testSourceOnContainAssociations() })->first(); $this->assertEquals('TestPlugin.Comments', $result->getSource()); $this->assertEquals('TestPlugin.Authors', $result->_matchingData['Authors']->getSource()); + Plugin::unload(); } /** diff --git a/tests/TestCase/ORM/TableTest.php b/tests/TestCase/ORM/TableTest.php index 39cdf9ea89b..f86cce849c7 100644 --- a/tests/TestCase/ORM/TableTest.php +++ b/tests/TestCase/ORM/TableTest.php @@ -128,6 +128,7 @@ public function tearDown() { parent::tearDown(); $this->getTableLocator()->clear(); + Plugin::unload(); } /** diff --git a/tests/TestCase/Routing/Middleware/AssetMiddlewareTest.php b/tests/TestCase/Routing/Middleware/AssetMiddlewareTest.php index eb90ce087b1..326d045c4b6 100644 --- a/tests/TestCase/Routing/Middleware/AssetMiddlewareTest.php +++ b/tests/TestCase/Routing/Middleware/AssetMiddlewareTest.php @@ -33,8 +33,18 @@ class AssetMiddlewareTest extends TestCase public function setUp() { parent::setUp(); - $this->loadPlugins('TestPlugin'); - $this->loadPlugins('Company/TestPluginThree'); + $this->loadPlugins(['TestPlugin', 'Company/TestPluginThree']); + } + + /** + * tearDown + * + * @return void + */ + public function tearDown() + { + Plugin::unload(); + parent::tearDown(); } /** diff --git a/tests/TestCase/Routing/RequestActionTraitTest.php b/tests/TestCase/Routing/RequestActionTraitTest.php index 9cb1f9ca17a..62fa57a9fd6 100644 --- a/tests/TestCase/Routing/RequestActionTraitTest.php +++ b/tests/TestCase/Routing/RequestActionTraitTest.php @@ -65,6 +65,7 @@ public function tearDown() parent::tearDown(); DispatcherFactory::clear(); Router::reload(); + Plugin::unload(); error_reporting($this->errorLevel); } diff --git a/tests/TestCase/Routing/RouteBuilderTest.php b/tests/TestCase/Routing/RouteBuilderTest.php index 238441f14ef..63c72b8279b 100644 --- a/tests/TestCase/Routing/RouteBuilderTest.php +++ b/tests/TestCase/Routing/RouteBuilderTest.php @@ -49,7 +49,7 @@ public function setUp() public function tearDown() { parent::tearDown(); - Plugin::unload('TestPlugin'); + Plugin::unload(); } /** diff --git a/tests/TestCase/Routing/RouterTest.php b/tests/TestCase/Routing/RouterTest.php index d7d761d84b4..bcc9c29e8f2 100644 --- a/tests/TestCase/Routing/RouterTest.php +++ b/tests/TestCase/Routing/RouterTest.php @@ -356,7 +356,7 @@ public function testMapResourcesWithExtension() public function testMapResourcesConnectOptions() { $this->deprecated(function () { - $this->loadPlugins('TestPlugin'); + Plugin::load('TestPlugin'); Router::mapResources('Posts', [ 'connectOptions' => [ 'routeClass' => 'TestPlugin.TestRoute', diff --git a/tests/TestCase/Shell/Task/AssetsTaskTest.php b/tests/TestCase/Shell/Task/AssetsTaskTest.php index c357906ceda..5d81f0dc320 100644 --- a/tests/TestCase/Shell/Task/AssetsTaskTest.php +++ b/tests/TestCase/Shell/Task/AssetsTaskTest.php @@ -67,8 +67,7 @@ public function tearDown() */ public function testSymlink() { - $this->loadPlugins('TestPlugin'); - $this->loadPlugins('Company/TestPluginThree'); + $this->loadPlugins(['TestPlugin', 'Company/TestPluginThree']); $this->Task->symlink(); @@ -157,8 +156,7 @@ public function testForPluginWithoutWebroot() */ public function testSymlinkingSpecifiedPlugin() { - $this->loadPlugins('TestPlugin'); - $this->loadPlugins('Company/TestPluginThree'); + $this->loadPlugins(['TestPlugin', 'Company/TestPluginThree']); $this->Task->symlink('TestPlugin'); @@ -179,8 +177,7 @@ public function testSymlinkingSpecifiedPlugin() */ public function testCopy() { - $this->loadPlugins('TestPlugin'); - $this->loadPlugins('Company/TestPluginThree'); + $this->loadPlugins(['TestPlugin', 'Company/TestPluginThree']); $this->Task->copy(); @@ -245,8 +242,7 @@ public function testRemoveSymlink() ); } - $this->loadPlugins('TestPlugin'); - $this->loadPlugins('Company/TestPluginThree'); + $this->loadPlugins(['TestPlugin', 'Company/TestPluginThree']); mkdir(WWW_ROOT . 'company'); @@ -273,8 +269,7 @@ public function testRemoveSymlink() */ public function testRemoveFolder() { - $this->loadPlugins('TestPlugin'); - $this->loadPlugins('Company/TestPluginThree'); + $this->loadPlugins(['TestPlugin', 'Company/TestPluginThree']); $this->Task->copy(); @@ -298,8 +293,7 @@ public function testRemoveFolder() */ public function testOverwrite() { - $this->loadPlugins('TestPlugin'); - $this->loadPlugins('Company/TestPluginThree'); + $this->loadPlugins(['TestPlugin', 'Company/TestPluginThree']); $path = WWW_ROOT . 'test_plugin'; diff --git a/tests/TestCase/TestSuite/FixtureManagerTest.php b/tests/TestCase/TestSuite/FixtureManagerTest.php index 2e3d37e22ff..769f2e74a68 100644 --- a/tests/TestCase/TestSuite/FixtureManagerTest.php +++ b/tests/TestCase/TestSuite/FixtureManagerTest.php @@ -45,6 +45,7 @@ public function tearDown() { parent::tearDown(); Log::reset(); + Plugin::unload(); } /** diff --git a/tests/TestCase/TestSuite/TestCaseTest.php b/tests/TestCase/TestSuite/TestCaseTest.php index f101af35fa1..06bdffbb15d 100644 --- a/tests/TestCase/TestSuite/TestCaseTest.php +++ b/tests/TestCase/TestSuite/TestCaseTest.php @@ -465,6 +465,7 @@ public function testGetMockForModelWithPlugin() $TestPluginAuthors = $this->getMockForModel('TestPlugin.Authors', ['doSomething']); $this->assertInstanceOf('TestPlugin\Model\Table\AuthorsTable', $TestPluginAuthors); $this->assertEquals('TestPlugin\Model\Entity\Author', $TestPluginAuthors->getEntityClass()); + Plugin::unload(); } /** diff --git a/tests/TestCase/View/CellTest.php b/tests/TestCase/View/CellTest.php index e8c2a8f3d1b..13b3ba4b218 100644 --- a/tests/TestCase/View/CellTest.php +++ b/tests/TestCase/View/CellTest.php @@ -59,8 +59,7 @@ public function setUp() public function tearDown() { parent::tearDown(); - Plugin::unload('TestPlugin'); - Plugin::unload('TestTheme'); + Plugin::unload(); unset($this->View); } diff --git a/tests/TestCase/View/Helper/FlashHelperTest.php b/tests/TestCase/View/Helper/FlashHelperTest.php index a484474b79a..b34654f5ac2 100644 --- a/tests/TestCase/View/Helper/FlashHelperTest.php +++ b/tests/TestCase/View/Helper/FlashHelperTest.php @@ -14,6 +14,7 @@ */ namespace Cake\Test\TestCase\View\Helper; +use Cake\Core\Plugin; use Cake\Http\ServerRequest; use Cake\Http\Session; use Cake\TestSuite\TestCase; @@ -105,6 +106,7 @@ public function tearDown() { parent::tearDown(); unset($this->View, $this->Flash); + Plugin::unload(); } /** diff --git a/tests/TestCase/View/Helper/NumberHelperTest.php b/tests/TestCase/View/Helper/NumberHelperTest.php index 4c7ccb0ead7..d01404ca09f 100644 --- a/tests/TestCase/View/Helper/NumberHelperTest.php +++ b/tests/TestCase/View/Helper/NumberHelperTest.php @@ -74,6 +74,7 @@ public function setUp() public function tearDown() { parent::tearDown(); + Plugin::unload(); static::setAppNamespace($this->_appNamespace); unset($this->View); } diff --git a/tests/TestCase/View/Helper/TextHelperTest.php b/tests/TestCase/View/Helper/TextHelperTest.php index b65c4bed1cf..55d4ff79d10 100644 --- a/tests/TestCase/View/Helper/TextHelperTest.php +++ b/tests/TestCase/View/Helper/TextHelperTest.php @@ -142,7 +142,7 @@ public function testEngineOverride() $this->loadPlugins('TestPlugin'); $Text = new TextHelperTestObject($this->View, ['engine' => 'TestPlugin.TestPluginEngine']); $this->assertInstanceOf('TestPlugin\Utility\TestPluginEngine', $Text->engine()); - Plugin::unload('TestPlugin'); + Plugin::unload(); } /** diff --git a/tests/TestCase/View/StringTemplateTest.php b/tests/TestCase/View/StringTemplateTest.php index d9f415ab3c2..5e1788f4158 100644 --- a/tests/TestCase/View/StringTemplateTest.php +++ b/tests/TestCase/View/StringTemplateTest.php @@ -16,6 +16,7 @@ use Cake\TestSuite\TestCase; use Cake\View\StringTemplate; +use Cake\Core\Plugin; class StringTemplateTest extends TestCase { @@ -194,6 +195,7 @@ public function testLoadPlugin() $this->loadPlugins('TestPlugin'); $this->assertNull($this->template->load('TestPlugin.test_templates')); $this->assertEquals('{{text}}', $this->template->get('italic')); + Plugin::unload(); } /** diff --git a/tests/TestCase/View/Widget/WidgetLocatorTest.php b/tests/TestCase/View/Widget/WidgetLocatorTest.php index 9f55bb0e14c..4d7ac31c030 100644 --- a/tests/TestCase/View/Widget/WidgetLocatorTest.php +++ b/tests/TestCase/View/Widget/WidgetLocatorTest.php @@ -14,6 +14,7 @@ */ namespace Cake\Test\TestCase\View\Widget; +use Cake\Core\Plugin; use Cake\TestSuite\TestCase; use Cake\View\StringTemplate; use Cake\View\View; @@ -98,6 +99,7 @@ public function testAddPluginWidgetsFromConfigInConstructor() ]; $inputs = new WidgetLocator($this->templates, $this->view, $widgets); $this->assertInstanceOf('Cake\View\Widget\LabelWidget', $inputs->get('text')); + Plugin::unload(); } /**