You are here

protected function NodeViewTest::setUp in Node Option Premium 8

Same name in this branch
  1. 8 tests/src/Functional/NodeViewTest.php \Drupal\Tests\nopremium\Functional\NodeViewTest::setUp()
  2. 8 tests/src/Kernel/NodeViewTest.php \Drupal\Tests\nopremium\Kernel\NodeViewTest::setUp()

Overrides NopremiumKernelTestBase::setUp

File

tests/src/Kernel/NodeViewTest.php, line 32

Class

NodeViewTest
Tests displaying nodes.

Namespace

Drupal\Tests\nopremium\Kernel

Code

protected function setUp() {
  parent::setUp();

  // Create an administrative user.
  $content_admin_user = $this
    ->createUser([
    'uid' => 2,
  ], [
    'administer nodes',
  ]);

  // Don't show body on teaser.
  $this->container
    ->get('entity_type.manager')
    ->getStorage('entity_view_display')
    ->load('node.article.teaser')
    ->removeComponent('body')
    ->save();
  $this->viewBuilder = $this->entityTypeManager
    ->getViewBuilder('node');
  $this->renderer = $this->container
    ->get('renderer');
}