public function EntityTest::testCalculateDependenciesWithEntityId in Drupal 9
Same name and namespace in other branches
- 8 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 312
Class
- EntityTest
- @coversDefaultClass \Drupal\views\Plugin\views\area\Entity @group Entity
Namespace
Drupal\Tests\views\Unit\Plugin\areaCode
public function testCalculateDependenciesWithEntityId() {
$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());
}