You are here

public function StatisticsAttachedTest::testAttached in Drupal 8

Same name and namespace in other branches
  1. 9 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
    ->assertRaw('core/modules/statistics/statistics.js', 'Statistics library is available');
}