public function DefaultPluginManagerTest::testDefaultPluginManagerNoCache in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testDefaultPluginManagerNoCache()
- 10 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testDefaultPluginManagerNoCache()
Tests the plugin manager with caching disabled.
File
- core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultPluginManagerTest.php, line 227
Class
- DefaultPluginManagerTest
- Tests the DefaultPluginManager.
Namespace
Drupal\Tests\Core\PluginCode
public function testDefaultPluginManagerNoCache() {
$plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, NULL, NULL, '\\Drupal\\plugin_test\\Plugin\\plugin_test\\fruit\\FruitInterface');
$cid = $this
->randomMachineName();
$cache_backend = $this
->getMockBuilder('Drupal\\Core\\Cache\\MemoryBackend')
->disableOriginalConstructor()
->getMock();
$cache_backend
->expects($this
->never())
->method('get');
$cache_backend
->expects($this
->never())
->method('set');
$plugin_manager
->setCacheBackend($cache_backend, $cid);
$plugin_manager
->useCaches(FALSE);
$this
->assertEquals($this->expectedDefinitions, $plugin_manager
->getDefinitions());
$this
->assertEquals($this->expectedDefinitions['banana'], $plugin_manager
->getDefinition('banana'));
}