You are here

protected function CacheTagTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/CacheTagTest.php \Drupal\Tests\views\Functional\Plugin\CacheTagTest::setUp()

Overrides ViewTestBase::setUp

File

core/modules/views/tests/src/Functional/Plugin/CacheTagTest.php, line 79

Class

CacheTagTest
Tests tag cache plugin.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

protected function setUp($import_test_views = TRUE) {
  parent::setUp($import_test_views);
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);
  $this
    ->drupalCreateContentType([
    'type' => 'article',
    'name' => 'Article',
  ]);
  $this->nodeStorage = $this->container
    ->get('entity_type.manager')
    ->getStorage('node');
  $this->nodeViewBuilder = $this->container
    ->get('entity_type.manager')
    ->getViewBuilder('node');
  $this->userViewBuilder = $this->container
    ->get('entity_type.manager')
    ->getViewBuilder('user');
  for ($i = 1; $i <= 5; $i++) {
    $this->pages[] = $this
      ->drupalCreateNode([
      'title' => "Test {$i}",
      'type' => 'page',
    ]);
  }
  $this->article = $this
    ->drupalCreateNode([
    'title' => "Test article",
    'type' => 'article',
  ]);
  $this->user = $this
    ->drupalCreateUser();

  // Mark the current request safe, in order to make render cache working, see
  // \Drupal\Core\Render\RenderCache::get.
  \Drupal::request()
    ->setMethod('GET');
}