function StatisticsLoggingTest::testLoggingPage

Same name in other branches
  1. 9 core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php \Drupal\Tests\statistics\FunctionalJavascript\StatisticsLoggingTest::testLoggingPage()
  2. 8.9.x core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php \Drupal\Tests\statistics\FunctionalJavascript\StatisticsLoggingTest::testLoggingPage()
  3. 11.x core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php \Drupal\Tests\statistics\FunctionalJavascript\StatisticsLoggingTest::testLoggingPage()

Tests that statistics works with different addressing variants.

File

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

Class

StatisticsLoggingTest
Tests that statistics works.

Namespace

Drupal\Tests\statistics\FunctionalJavascript

Code

public function testLoggingPage() : void {
    // At the first request, the page does not contain statistics counter.
    $this->assertNull($this->getStatisticsCounter('node/1'));
    $this->assertSame(1, $this->getStatisticsCounter('node/1'));
    $this->assertSame(2, $this->getStatisticsCounter('en/node/1'));
    $this->assertSame(3, $this->getStatisticsCounter('en/node/1'));
    $this->assertSame(4, $this->getStatisticsCounter('index.php/node/1'));
    $this->assertSame(5, $this->getStatisticsCounter('index.php/node/1'));
    $this->assertSame(6, $this->getStatisticsCounter('index.php/en/node/1'));
    $this->assertSame(7, $this->getStatisticsCounter('index.php/en/node/1'));
}

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