function StatisticsLoggingTest::setUp
Overrides BrowserTestBase::setUp
File
- 
              core/
modules/ statistics/ tests/ src/ FunctionalJavascript/ StatisticsLoggingTest.php, line 40  
Class
- StatisticsLoggingTest
 - Tests that statistics works.
 
Namespace
Drupal\Tests\statistics\FunctionalJavascriptCode
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.