function ConfigEntityBaseUnitTest::testCalculateDependenciesWithThirdPartySettings
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testCalculateDependenciesWithThirdPartySettings()
- 8.9.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testCalculateDependenciesWithThirdPartySettings()
- 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testCalculateDependenciesWithThirdPartySettings()
@covers ::calculateDependencies @covers ::getDependencies @covers ::onDependencyRemoval
File
-
core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityBaseUnitTest.php, line 337
Class
- ConfigEntityBaseUnitTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityBase @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testCalculateDependenciesWithThirdPartySettings() : void {
$this->entity = $this->getMockBuilder(StubConfigEntity::class)
->setConstructorArgs([
[],
$this->entityTypeId,
])
->onlyMethods([])
->getMock();
$this->entity
->setThirdPartySetting('test_provider', 'test', 'test');
$this->entity
->setThirdPartySetting('test_provider2', 'test', 'test');
$this->entity
->setThirdPartySetting(static::PROVIDER, 'test', 'test');
$this->assertEquals([
'test_provider',
'test_provider2',
], $this->entity
->calculateDependencies()
->getDependencies()['module']);
$changed = $this->entity
->onDependencyRemoval([
'module' => [
'test_provider2',
],
]);
$this->assertTrue($changed, 'Calling onDependencyRemoval with an existing third party dependency provider returns TRUE.');
$changed = $this->entity
->onDependencyRemoval([
'module' => [
'test_provider3',
],
]);
$this->assertFalse($changed, 'Calling onDependencyRemoval with a non-existing third party dependency provider returns FALSE.');
$this->assertEquals([
'test_provider',
], $this->entity
->calculateDependencies()
->getDependencies()['module']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.