function PluginDependencyTraitTest::testGetPluginDependencies
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php \Drupal\Tests\Core\Plugin\PluginDependencyTraitTest::testGetPluginDependencies()
- 8.9.x core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php \Drupal\Tests\Core\Plugin\PluginDependencyTraitTest::testGetPluginDependencies()
- 11.x core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php \Drupal\Tests\Core\Plugin\PluginDependencyTraitTest::testGetPluginDependencies()
@covers ::getPluginDependencies
@dataProvider providerTestPluginDependencies
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ PluginDependencyTraitTest.php, line 29
Class
- PluginDependencyTraitTest
- @coversDefaultClass \Drupal\Core\Plugin\PluginDependencyTrait @group Plugin
Namespace
Drupal\Tests\Core\PluginCode
public function testGetPluginDependencies(ProphecyInterface $plugin, $definition, array $expected) : void {
$test_class = new TestPluginDependency();
$module_handler = $this->prophesize(ModuleHandlerInterface::class);
$module_handler->moduleExists('test_module1')
->willReturn(TRUE);
$module_handler->moduleExists('test_theme1')
->willReturn(FALSE);
$test_class->setModuleHandler($module_handler->reveal());
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
$theme_handler->themeExists('test_module1')
->willReturn(FALSE);
$theme_handler->themeExists('test_theme1')
->willReturn(TRUE);
$test_class->setThemeHandler($theme_handler->reveal());
$plugin->getPluginDefinition()
->willReturn($definition);
$actual = $test_class->getPluginDependencies($plugin->reveal());
$this->assertEquals($expected, $actual);
$this->assertEmpty($test_class->getDependencies());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.