function EntityTest::testCalculateDependenciesWithUuid
Same name in other branches
- 9 core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::testCalculateDependenciesWithUuid()
- 8.9.x core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::testCalculateDependenciesWithUuid()
- 11.x core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::testCalculateDependenciesWithUuid()
@covers ::calculateDependencies
File
-
core/
modules/ views/ tests/ src/ Unit/ Plugin/ area/ EntityTest.php, line 282
Class
- EntityTest
- @coversDefaultClass \Drupal\views\Plugin\views\area\Entity @group Entity
Namespace
Drupal\Tests\views\Unit\Plugin\areaCode
public function testCalculateDependenciesWithUuid() : void {
$this->setupEntityTypeManager();
$uuid = '1d52762e-b9d8-4177-908f-572d1a5845a4';
$entity = $this->createMock('Drupal\\Core\\Entity\\EntityInterface');
$entity_type = $this->createMock('Drupal\\Core\\Entity\\EntityTypeInterface');
$entity->expects($this->once())
->method('getConfigDependencyName')
->willReturn('entity_test:test-bundle:1d52762e-b9d8-4177-908f-572d1a5845a4');
$this->entityStorage
->expects($this->never())
->method('load');
$this->entityRepository
->expects($this->once())
->method('loadEntityByConfigTarget')
->willReturn($entity);
$entity_type->expects($this->once())
->method('getConfigDependencyKey')
->willReturn('content');
$this->entityTypeManager
->expects($this->once())
->method('getDefinition')
->willReturn($entity_type);
$options = [
'target' => $uuid,
];
$this->entityHandler
->init($this->executable, $this->display, $options);
$this->assertEquals([
'content' => [
'entity_test:test-bundle:1d52762e-b9d8-4177-908f-572d1a5845a4',
],
], $this->entityHandler
->calculateDependencies());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.