You are here

protected function IntegrationTest::setUp in Drupal 9

Same name in this branch
  1. 9 core/modules/aggregator/tests/src/Kernel/Views/IntegrationTest.php \Drupal\Tests\aggregator\Kernel\Views\IntegrationTest::setUp()
  2. 9 core/modules/statistics/tests/src/Functional/Views/IntegrationTest.php \Drupal\Tests\statistics\Functional\Views\IntegrationTest::setUp()
Same name and namespace in other branches
  1. 8 core/modules/statistics/tests/src/Functional/Views/IntegrationTest.php \Drupal\Tests\statistics\Functional\Views\IntegrationTest::setUp()

Overrides ViewTestBase::setUp

File

core/modules/statistics/tests/src/Functional/Views/IntegrationTest.php, line 50

Class

IntegrationTest
Tests basic integration of views data from the statistics module.

Namespace

Drupal\Tests\statistics\Functional\Views

Code

protected function setUp($import_test_views = TRUE) : void {
  parent::setUp($import_test_views);
  ViewTestData::createTestViews(static::class, [
    'statistics_test_views',
  ]);

  // Create a new user for viewing nodes and statistics.
  $this->webUser = $this
    ->drupalCreateUser([
    'access content',
    'view post access counter',
  ]);

  // Create a new user for viewing nodes only.
  $this->deniedUser = $this
    ->drupalCreateUser([
    'access content',
  ]);
  $this
    ->drupalCreateContentType([
    'type' => 'page',
  ]);
  $this->node = $this
    ->drupalCreateNode([
    'type' => 'page',
  ]);

  // Enable counting of content views.
  $this
    ->config('statistics.settings')
    ->set('count_content_views', 1)
    ->save();
}