You are here

public function NodeLegacyTest::testNodeView in Drupal 8

@expectedDeprecation node_view() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager()->getViewBuilder('node')->view() instead. See https://www.drupal.org/node/3033656 @expectedDeprecation node_view_multiple() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager()->getViewBuilder('node')->viewMultiple() instead. See https://www.drupal.org/node/3033656

File

core/modules/node/tests/src/Kernel/NodeLegacyTest.php, line 70

Class

NodeLegacyTest
Tests legacy user functionality.

Namespace

Drupal\Tests\node\Kernel

Code

public function testNodeView() {
  $entity = Node::create([
    'type' => 'page',
  ]);
  $this
    ->assertNotEmpty(node_view($entity));
  $entities = [
    Node::create([
      'type' => 'page',
    ]),
    Node::create([
      'type' => 'page',
    ]),
  ];
  $this
    ->assertCount(4, node_view_multiple($entities));
}