You are here

public function EntityViewBuilderTest::testExternalEntity in Drupal 10

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php \Drupal\KernelTests\Core\Entity\EntityViewBuilderTest::testExternalEntity()

Tests an entity type with an external canonical rel.

File

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

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);
}