You are here

protected function StatisticsLoggingTest::setUp in Drupal 8

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

Overrides BrowserTestBase::setUp

File

core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php, line 37

Class

StatisticsLoggingTest
Tests that statistics works.

Namespace

Drupal\Tests\statistics\FunctionalJavascript

Code

protected function setUp() {
  parent::setUp();
  $this
    ->config('statistics.settings')
    ->set('count_content_views', 1)
    ->save();
  Role::load(AccountInterface::ANONYMOUS_ROLE)
    ->grantPermission('view post access counter')
    ->save();

  // Add another language to enable multilingual path processor.
  ConfigurableLanguage::create([
    'id' => 'xx',
  ])
    ->save();
  $this
    ->config('language.negotiation')
    ->set('url.prefixes.en', 'en')
    ->save();
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);
  $this->node = $this
    ->drupalCreateNode();
}