public function DefaultPluginManagerTest::testDefaultPluginManagerWithFilledCache in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testDefaultPluginManagerWithFilledCache()
Tests the plugin manager with caching and altering.
File
- core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultPluginManagerTest.php, line 168 - Contains \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest.
Class
- DefaultPluginManagerTest
- Tests the DefaultPluginManager.
Namespace
Drupal\Tests\Core\PluginCode
public function testDefaultPluginManagerWithFilledCache() {
$cid = $this
->randomMachineName();
$cache_backend = $this
->getMockBuilder('Drupal\\Core\\Cache\\MemoryBackend')
->disableOriginalConstructor()
->getMock();
$cache_backend
->expects($this
->once())
->method('get')
->with($cid)
->will($this
->returnValue((object) array(
'data' => $this->expectedDefinitions,
)));
$cache_backend
->expects($this
->never())
->method('set');
$plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, NULL, NULL, '\\Drupal\\plugin_test\\Plugin\\plugin_test\\fruit\\FruitInterface');
$plugin_manager
->setCacheBackend($cache_backend, $cid);
$this
->assertEquals($this->expectedDefinitions, $plugin_manager
->getDefinitions());
}