You are here

protected function RowRenderCacheTest::setUpFixtures in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Plugin/RowRenderCacheTest.php \Drupal\views\Tests\Plugin\RowRenderCacheTest::setUpFixtures()

Sets up the configuration and schema of views and views_test_data modules.

Because the schema of views_test_data.module is dependent on the test using it, it cannot be enabled normally.

Overrides ViewKernelTestBase::setUpFixtures

File

core/modules/views/src/Tests/Plugin/RowRenderCacheTest.php, line 65
Contains \Drupal\views\Tests\Plugin\RowRenderCacheTest.

Class

RowRenderCacheTest
Tests row render caching.

Namespace

Drupal\views\Tests\Plugin

Code

protected function setUpFixtures() {
  parent::setUpFixtures();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('node');
  $this
    ->installSchema('node', 'node_access');
  $type = NodeType::create([
    'type' => 'test',
  ]);
  $type
    ->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();
}