You are here

public function StatisticsAttachedTest::testAttached in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php \Drupal\Tests\statistics\Functional\StatisticsAttachedTest::testAttached()
  2. 10 core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php \Drupal\Tests\statistics\Functional\StatisticsAttachedTest::testAttached()

Tests if statistics.js is loaded when content is not printed.

File

core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php, line 49

Class

StatisticsAttachedTest
Tests if statistics.js is loaded when content is not printed.

Namespace

Drupal\Tests\statistics\Functional

Code

public function testAttached() {
  $node = Node::create([
    'type' => 'page',
    'title' => 'Page node',
    'body' => 'body text',
  ]);
  $node
    ->save();
  $this
    ->drupalGet('node/' . $node
    ->id());
  $this
    ->assertSession()
    ->responseContains('core/modules/statistics/statistics.js');
}