public function EntityDisplayModeBaseUnitTest::testCalculateDependencies in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\EntityDisplayModeBaseUnitTest::testCalculateDependencies()
- 9 core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\EntityDisplayModeBaseUnitTest::testCalculateDependencies()
@covers ::calculateDependencies
File
- core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ EntityDisplayModeBaseUnitTest.php, line 75
Class
- EntityDisplayModeBaseUnitTest
- @coversDefaultClass \Drupal\Core\Entity\EntityDisplayModeBase @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testCalculateDependencies() {
$target_entity_type_id = $this
->randomMachineName(16);
$target_entity_type = $this
->createMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
$target_entity_type
->expects($this
->any())
->method('getProvider')
->will($this
->returnValue('test_module'));
$values = [
'targetEntityType' => $target_entity_type_id,
];
$this->entityTypeManager
->expects($this
->exactly(2))
->method('getDefinition')
->willReturnMap([
[
$target_entity_type_id,
TRUE,
$target_entity_type,
],
[
$this->entityType,
TRUE,
$this->entityInfo,
],
]);
$this->entity = $this
->getMockBuilder('\\Drupal\\Core\\Entity\\EntityDisplayModeBase')
->setConstructorArgs([
$values,
$this->entityType,
])
->addMethods([
'getFilterFormat',
])
->getMock();
$dependencies = $this->entity
->calculateDependencies()
->getDependencies();
$this
->assertContains('test_module', $dependencies['module']);
}