/**
* Tests that viewing an entity without template does not specify #theme.
*/
public function testNoTemplate() { // Ensure that an entity type without explicit view builder uses the
// default.
$entity_type_manager = \Drupal::
entityTypeManager();
$entity_type =
$entity_type_manager->
getDefinition('entity_test_base_field_display'
);
$this->
assertTrue($entity_type->
hasViewBuilderClass());
$this->
assertEquals(EntityViewBuilder::
class,
$entity_type->
getViewBuilderClass());
// Ensure that an entity without matching template does not have a #theme
// key.
$entity =
$this->
createTestEntity('entity_test'
);
$build =
$entity_type_manager->
getViewBuilder('entity_test'
)->
view($entity);
$this->
assertEquals($entity,
$build['#entity_test'
]);
$this->
assertArrayNotHasKey('#theme',
$build);
} /**
* Tests an entity type with an external canonical rel.
*/