function StatisticsLoggingTest::setUp

Same name in this branch
  1. 9 core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php \Drupal\Tests\statistics\Functional\StatisticsLoggingTest::setUp()
Same name in other branches
  1. 8.9.x core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php \Drupal\Tests\statistics\FunctionalJavascript\StatisticsLoggingTest::setUp()
  2. 8.9.x core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php \Drupal\Tests\statistics\Functional\StatisticsLoggingTest::setUp()
  3. 10 core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php \Drupal\Tests\statistics\FunctionalJavascript\StatisticsLoggingTest::setUp()
  4. 10 core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php \Drupal\Tests\statistics\Functional\StatisticsLoggingTest::setUp()
  5. 11.x core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php \Drupal\Tests\statistics\FunctionalJavascript\StatisticsLoggingTest::setUp()
  6. 11.x core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php \Drupal\Tests\statistics\Functional\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() : void {
    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',
        'label' => 'Test language',
    ])->save();
    $this->config('language.negotiation')
        ->set('url.prefixes.en', 'en')
        ->save();
    $this->drupalCreateContentType([
        'type' => 'page',
        'name' => 'Basic page',
    ]);
    $this->node = $this->drupalCreateNode();
}

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