function NodeViewBuilderTest::setUp

Same name and namespace in other branches
  1. 8.9.x core/modules/node/tests/src/Kernel/NodeViewBuilderTest.php \Drupal\Tests\node\Kernel\NodeViewBuilderTest::setUp()
  2. 10 core/modules/node/tests/src/Kernel/NodeViewBuilderTest.php \Drupal\Tests\node\Kernel\NodeViewBuilderTest::setUp()
  3. 11.x core/modules/node/tests/src/Kernel/NodeViewBuilderTest.php \Drupal\Tests\node\Kernel\NodeViewBuilderTest::setUp()

Overrides EntityKernelTestBase::setUp

File

core/modules/node/tests/src/Kernel/NodeViewBuilderTest.php, line 48

Class

NodeViewBuilderTest
Tests the node view builder.

Namespace

Drupal\Tests\node\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->storage = $this->entityTypeManager
        ->getStorage('node');
    $this->viewBuilder = $this->entityTypeManager
        ->getViewBuilder('node');
    $this->renderer = $this->container
        ->get('renderer');
    $type = NodeType::create([
        'type' => 'article',
        'name' => 'Article',
    ]);
    $type->save();
    $this->installSchema('node', 'node_access');
    $this->installConfig([
        'system',
        'node',
    ]);
}

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