function RowPluginTest::setUp

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

Overrides ViewsKernelTestBase::setUp

File

core/modules/node/tests/src/Kernel/Views/RowPluginTest.php, line 54

Class

RowPluginTest
Tests the node row plugin.

Namespace

Drupal\Tests\node\Kernel\Views

Code

protected function setUp($import_test_views = TRUE) : void {
    parent::setUp($import_test_views);
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    $this->installSchema('node', [
        'node_access',
    ]);
    $this->installConfig([
        'field',
        'filter',
        'node',
    ]);
    ViewTestData::createTestViews(static::class, [
        'node_test_views',
    ]);
    \Drupal::currentUser()->setAccount($this->createUser([
        'access content',
    ]));
    $node_type = NodeType::create([
        'type' => 'article',
        'name' => 'Article',
    ]);
    $node_type->save();
    node_add_body_field($node_type);
    // Create two nodes.
    for ($i = 0; $i < 2; $i++) {
        $this->nodes[] = $this->createNode([
            'type' => 'article',
            'body' => [
                [
                    'value' => $this->randomMachineName(42),
                    'format' => filter_default_format(),
                    'summary' => $this->randomMachineName(),
                ],
            ],
        ]);
    }
}

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