You are here

public function StatisticsLoggingTest::testLoggingPage in Drupal 8

Same name and namespace in other branches
  1. 9 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 59

Class

StatisticsLoggingTest
Tests that statistics works.

Namespace

Drupal\Tests\statistics\FunctionalJavascript

Code

public function testLoggingPage() {

  // 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'));
}