function PathPluginTest::setUp

Same name and namespace 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()

Parameters

bool $import_test_views: Should the views specified on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.

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.