public function ConfigEntityBaseUnitTest::testAddDependency in Zircon Profile 8.0
Same name and namespace in other branches
- 8 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 193 - Contains \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest.
Class
- ConfigEntityBaseUnitTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityBase @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testAddDependency() {
$method = new \ReflectionMethod('\\Drupal\\Core\\Config\\Entity\\ConfigEntityBase', 'addDependency');
$method
->setAccessible(TRUE);
$method
->invoke($this->entity, 'module', $this->provider);
$method
->invoke($this->entity, 'module', 'core');
$method
->invoke($this->entity, 'module', 'node');
$dependencies = $this->entity
->getDependencies();
$this
->assertNotContains($this->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(array(
'action',
'node',
), $dependencies['module']);
// Test sorting of dependency types.
$method
->invoke($this->entity, 'entity', 'system.action.id');
$dependencies = $this->entity
->getDependencies();
$this
->assertEquals(array(
'entity',
'module',
), array_keys($dependencies));
}