function RowRenderCacheTest::setUpFixtures

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php \Drupal\Tests\views\Kernel\Plugin\RowRenderCacheTest::setUpFixtures()
  2. 8.9.x core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php \Drupal\Tests\views\Kernel\Plugin\RowRenderCacheTest::setUpFixtures()
  3. 11.x core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php \Drupal\Tests\views\Kernel\Plugin\RowRenderCacheTest::setUpFixtures()

Overrides ViewsKernelTestBase::setUpFixtures

File

core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php, line 62

Class

RowRenderCacheTest
Tests row render caching.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

protected function setUpFixtures() {
    parent::setUpFixtures();
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    $this->installSchema('node', 'node_access');
    NodeType::create([
        'type' => 'test',
        'name' => 'Test',
    ])->save();
    $this->editorUser = $this->createUser([
        'bypass node access',
    ]);
    $this->powerUser = $this->createUser([
        'access content',
        'create test content',
        'edit own test content',
        'delete own test content',
    ]);
    $this->regularUser = $this->createUser([
        'access content',
    ]);
    // Create some test entities.
    for ($i = 0; $i < 5; $i++) {
        Node::create([
            'title' => 'b' . $i . $this->randomMachineName(),
            'type' => 'test',
        ])
            ->save();
    }
    // Create a power user node.
    Node::create([
        'title' => 'z' . $this->randomMachineName(),
        'uid' => $this->powerUser
            ->id(),
        'type' => 'test',
    ])
        ->save();
}

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