function ConfigEntityBaseUnitTest::testAddDependency
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testAddDependency()
- 8.9.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testAddDependency()
- 11.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testAddDependency()
@covers ::addDependency
File
-
core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityBaseUnitTest.php, line 224
Class
- ConfigEntityBaseUnitTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityBase @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testAddDependency() : void {
$method = new \ReflectionMethod('\\Drupal\\Core\\Config\\Entity\\ConfigEntityBase', 'addDependency');
$method->invoke($this->entity, 'module', static::PROVIDER);
$method->invoke($this->entity, 'module', 'core');
$method->invoke($this->entity, 'module', 'node');
$dependencies = $this->entity
->getDependencies();
$this->assertNotContains(static::PROVIDER, $dependencies['module']);
$this->assertNotContains('core', $dependencies['module']);
$this->assertContains('node', $dependencies['module']);
// Test sorting of dependencies.
$method->invoke($this->entity, 'module', 'action');
$dependencies = $this->entity
->getDependencies();
$this->assertEquals([
'action',
'node',
], $dependencies['module']);
// Test sorting of dependency types.
$method->invoke($this->entity, 'entity', 'system.action.id');
$dependencies = $this->entity
->getDependencies();
$this->assertEquals([
'entity',
'module',
], array_keys($dependencies));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.