You are here

public function EntityViewBuilderTest::testExternalEntity in Drupal 9

Tests an entity type with an external canonical rel.

File

core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php, line 349

Class

EntityViewBuilderTest
Tests the entity view builder.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testExternalEntity() {
  $this
    ->installEntitySchema('entity_test_external');

  /** @var \Drupal\Core\Render\RendererInterface $renderer */
  $renderer = $this->container
    ->get('renderer');
  $entity_test = $this
    ->createTestEntity('entity_test_external');
  $entity_test
    ->save();
  $view = $this->container
    ->get('entity_type.manager')
    ->getViewBuilder('entity_test_external')
    ->view($entity_test);
  $renderer
    ->renderRoot($view);
  $this
    ->assertArrayNotHasKey('#contextual_links', $view);
}