mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Added PluginManager::unregisterAll() (#3156)
This commit is contained in:
parent
dcfe59b807
commit
a2a91a38e6
@ -162,6 +162,16 @@ class PluginManager
|
||||
$this->registered = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters all plugins: the negative of registerAll().
|
||||
* @return void
|
||||
*/
|
||||
public function unregisterAll()
|
||||
{
|
||||
$this->registered = false;
|
||||
$this->plugins = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a single plugin object.
|
||||
* @param PluginBase $plugin
|
||||
|
@ -122,7 +122,7 @@ class PluginManagerTest extends TestCase
|
||||
$this->assertArrayHasKey('\database\tester', $result);
|
||||
$this->assertArrayHasKey('\testvendor\test', $result);
|
||||
}
|
||||
|
||||
|
||||
public function testGetVendorAndPluginNames()
|
||||
{
|
||||
$manager = PluginManager::instance();
|
||||
@ -149,4 +149,14 @@ class PluginManagerTest extends TestCase
|
||||
$this->assertEquals('Alexey Bobkov, Samuel Georges', $pluginDetails['author']);
|
||||
}
|
||||
|
||||
public function testUnregisterall()
|
||||
{
|
||||
$manager = PluginManager::instance();
|
||||
$result = $manager->getPlugins();
|
||||
$this->assertCount(5, $result);
|
||||
|
||||
$manager->unregisterAll();
|
||||
$this->assertEmpty($manager->getPlugins());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user