function StatisticsAdminTest::setUp
Overrides BrowserTestBase::setUp
File
- 
              core/
modules/ statistics/ tests/ src/ Functional/ StatisticsAdminTest.php, line 59  
Class
- StatisticsAdminTest
 - Tests the statistics admin.
 
Namespace
Drupal\Tests\statistics\FunctionalCode
protected function setUp() : void {
  parent::setUp();
  // Set the max age to 0 to simplify testing.
  $this->config('statistics.settings')
    ->set('display_max_age', 0)
    ->save();
  // Create Basic page node type.
  if ($this->profile != 'standard') {
    $this->drupalCreateContentType([
      'type' => 'page',
      'name' => 'Basic page',
    ]);
  }
  $this->privilegedUser = $this->drupalCreateUser([
    'administer statistics',
    'view post access counter',
    'create page content',
  ]);
  $this->drupalLogin($this->privilegedUser);
  $this->testNode = $this->drupalCreateNode([
    'type' => 'page',
    'uid' => $this->privilegedUser
      ->id(),
  ]);
  $this->client = \Drupal::httpClient();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.