public function EntityDisplayRepositoryTest::testViewDisplay in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityDisplayRepositoryTest::testViewDisplay()
- 10 core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityDisplayRepositoryTest::testViewDisplay()
@covers ::getViewDisplay
File
- core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityDisplayRepositoryTest.php, line 60
Class
- EntityDisplayRepositoryTest
- @coversDefaultClass \Drupal\Core\Entity\EntityDisplayRepository
Namespace
Drupal\KernelTests\Core\EntityCode
public function testViewDisplay() {
$display = $this->displayRepository
->getViewDisplay('user', 'user');
$this
->assertInstanceOf(EntityViewDisplayInterface::class, $display);
$this
->assertTrue($display
->isNew(), 'Default view display was created on demand.');
$this
->assertSame(EntityDisplayRepositoryInterface::DEFAULT_DISPLAY_MODE, $display
->getMode());
$display
->createCopy('pastafazoul')
->save();
$display = $this->displayRepository
->getViewDisplay('user', 'user', 'pastafazoul');
$this
->assertInstanceOf(EntityViewDisplayInterface::class, $display);
$this
->assertFalse($display
->isNew(), 'An existing view display was loaded.');
$this
->assertSame('pastafazoul', $display
->getMode());
$display = $this->displayRepository
->getViewDisplay('user', 'user', 'magic');
$this
->assertInstanceOf(EntityViewDisplayInterface::class, $display);
$this
->assertTrue($display
->isNew(), 'A new non-default view display was created on demand.');
$this
->assertSame('magic', $display
->getMode());
}