function PathPluginTest::setUp

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

Overrides ViewsKernelTestBase::setUp

File

core/modules/node/tests/src/Kernel/Views/PathPluginTest.php, line 50

Class

PathPluginTest
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',
    ]);
    ViewTestData::createTestViews(static::class, [
        'node_test_views',
    ]);
    \Drupal::currentUser()->setAccount($this->createUser([
        'access content',
    ]));
    NodeType::create([
        'type' => 'article',
        'name' => 'Article',
    ])->save();
    // Create two nodes.
    for ($i = 0; $i < 2; $i++) {
        $this->nodes[] = $this->createNode([
            'type' => 'article',
        ]);
    }
}

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