public function EntityLegacyTest::testEntityView in Drupal 8
@expectedDeprecation entity_view() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager()->getViewBuilder($entity->getEntityTypeId())->view($entity, $view_mode, $langcode) instead. See https://www.drupal.org/node/3033656 @expectedDeprecation entity_view_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager()->getViewBuilder($entity->getEntityTypeId())->viewMultiple($entities, $view_mode, $langcode) instead. See https://www.drupal.org/node/3033656
File
- core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityLegacyTest.php, line 129
Class
- EntityLegacyTest
- Tests legacy entity functions.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testEntityView() {
$entity = EntityTest::create();
$this
->assertNotEmpty(entity_view($entity, 'default'));
$entities = [
EntityTest::create(),
EntityTest::create(),
];
$this
->assertCount(4, entity_view_multiple($entities, 'default'));
}