public function EntityTest::testRenderWithUuid in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::testRenderWithUuid()
@covers ::render @covers ::defineOptions @covers ::init
File
- core/
modules/ views/ tests/ src/ Unit/ Plugin/ area/ EntityTest.php, line 220 - Contains \Drupal\Tests\views\Unit\Plugin\area\EntityTest.
Class
- EntityTest
- @coversDefaultClass \Drupal\views\Plugin\views\area\Entity @group Entity
Namespace
Drupal\Tests\views\Unit\Plugin\areaCode
public function testRenderWithUuid() {
$this
->setupEntityManager();
$uuid = '1d52762e-b9d8-4177-908f-572d1a5845a4';
$options = [
'target' => $uuid,
'tokenize' => FALSE,
];
$entity = $this
->getMock('Drupal\\Core\\Entity\\EntityInterface');
$entity
->expects($this
->once())
->method('access')
->willReturn(TRUE);
$this->entityStorage
->expects($this
->never())
->method('load');
$this->entityManager
->expects($this
->once())
->method('loadEntityByConfigTarget')
->willReturn($entity);
$this->entityViewBuilder
->expects($this
->once())
->method('view')
->with($entity, 'default')
->willReturn([
'#markup' => 'hallo',
]);
$this->entityHandler
->init($this->executable, $this->display, $options);
$result = $this->entityHandler
->render();
$this
->assertEquals([
'#markup' => 'hallo',
], $result);
}