You are here

public function NoJavaScriptAnonymousTest::testNoJavaScript in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Common/NoJavaScriptAnonymousTest.php \Drupal\system\Tests\Common\NoJavaScriptAnonymousTest::testNoJavaScript()

Tests that anonymous users are not served any JavaScript.

File

core/modules/system/src/Tests/Common/NoJavaScriptAnonymousTest.php, line 32
Contains \Drupal\system\Tests\Common\NoJavaScriptAnonymousTest.

Class

NoJavaScriptAnonymousTest
Tests that anonymous users are not served any JavaScript in the Standard installation profile.

Namespace

Drupal\system\Tests\Common

Code

public function testNoJavaScript() {

  // Create a node that is listed on the frontpage.
  $this
    ->drupalCreateNode(array(
    'promote' => NODE_PROMOTED,
  ));
  $user = $this
    ->drupalCreateUser();

  // Test frontpage.
  $this
    ->drupalGet('');
  $this
    ->assertNoJavaScriptExceptHtml5Shiv();

  // Test node page.
  $this
    ->drupalGet('node/1');
  $this
    ->assertNoJavaScriptExceptHtml5Shiv();

  // Test user profile page.
  $this
    ->drupalGet('user/' . $user
    ->id());
  $this
    ->assertNoJavaScriptExceptHtml5Shiv();
}