function EntityTest::testCalculateDependenciesWithEntityId
Same name in other branches
- 9 core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::testCalculateDependenciesWithEntityId()
- 8.9.x core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::testCalculateDependenciesWithEntityId()
- 11.x core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::testCalculateDependenciesWithEntityId()
@covers ::calculateDependencies
File
-
core/
modules/ views/ tests/ src/ Unit/ Plugin/ area/ EntityTest.php, line 314
Class
- EntityTest
- @coversDefaultClass \Drupal\views\Plugin\views\area\Entity @group Entity
Namespace
Drupal\Tests\views\Unit\Plugin\areaCode
public function testCalculateDependenciesWithEntityId() : void {
$this->setupEntityTypeManager();
$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->entityRepository
->expects($this->once())
->method('loadEntityByConfigTarget')
->willReturn($entity);
$this->entityStorage
->expects($this->never())
->method('loadByProperties');
$entity_type->expects($this->once())
->method('getConfigDependencyKey')
->willReturn('content');
$this->entityTypeManager
->expects($this->once())
->method('getDefinition')
->willReturn($entity_type);
$options = [
'target' => 1,
];
$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.