function DefaultLazyPluginCollectionTest::testConfigurableInterface
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php \Drupal\Tests\Core\Plugin\DefaultLazyPluginCollectionTest::testConfigurableInterface()
- 8.9.x core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php \Drupal\Tests\Core\Plugin\DefaultLazyPluginCollectionTest::testConfigurableInterface()
- 10 core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php \Drupal\Tests\Core\Plugin\DefaultLazyPluginCollectionTest::testConfigurableInterface()
Tests that plugin methods are correctly attached to interfaces.
@covers ::getConfiguration
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php, line 282
Class
- DefaultLazyPluginCollectionTest
- @coversDefaultClass \Drupal\Core\Plugin\DefaultLazyPluginCollection @group Plugin
Namespace
Drupal\Tests\Core\PluginCode
public function testConfigurableInterface() : void {
$configurable_plugin = $this->prophesize(ConfigurableInterface::class);
$configurable_config = [
'id' => 'configurable',
'foo' => 'bar',
];
$configurable_plugin->getConfiguration()
->willReturn($configurable_config);
$nonconfigurable_plugin = $this->prophesize(PluginInspectionInterface::class);
$nonconfigurable_config = [
'id' => 'non-configurable',
'baz' => 'qux',
];
$nonconfigurable_plugin->configuration = $nonconfigurable_config;
$configurations = [
'configurable' => $configurable_config,
'non-configurable' => $nonconfigurable_config,
];
$plugin_manager = $this->prophesize(PluginManagerInterface::class);
$plugin_manager->createInstance('configurable', $configurable_config)
->willReturn($configurable_plugin->reveal());
$plugin_manager->createInstance('non-configurable', $nonconfigurable_config)
->willReturn($nonconfigurable_plugin->reveal());
$collection = new DefaultLazyPluginCollection($plugin_manager->reveal(), $configurations);
$this->assertSame($configurations, $collection->getConfiguration());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.