function EntityTypeManagerTest::testGetViewBuilder

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetViewBuilder()
  2. 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetViewBuilder()
  3. 11.x core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php \Drupal\Tests\Core\Entity\EntityTypeManagerTest::testGetViewBuilder()

Tests the getViewBuilder() method.

@covers ::getViewBuilder

File

core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php, line 201

Class

EntityTypeManagerTest
@coversDefaultClass \Drupal\Core\Entity\EntityTypeManager[[api-linebreak]] @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public function testGetViewBuilder() : void {
  $class = $this->getTestHandlerClass();
  $entity = $this->prophesize(EntityTypeInterface::class);
  $entity->getHandlerClass('view_builder')
    ->willReturn($class);
  $this->setUpEntityTypeDefinitions([
    'test_entity_type' => $entity,
  ]);
  $this->assertInstanceOf($class, $this->entityTypeManager
    ->getViewBuilder('test_entity_type'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.