function NoJavaScriptAnonymousTest::testNoJavaScript
Same name in other branches
- 8.9.x core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php \Drupal\Tests\system\Functional\Common\NoJavaScriptAnonymousTest::testNoJavaScript()
Tests that anonymous users are not served any JavaScript.
File
-
core/
modules/ system/ tests/ src/ Functional/ Common/ NoJavaScriptAnonymousTest.php, line 41
Class
- NoJavaScriptAnonymousTest
- Tests that anonymous users are not served any JavaScript.
Namespace
Drupal\Tests\system\Functional\CommonCode
public function testNoJavaScript() {
// Create a node of content type 'article' that is listed on the frontpage.
$this->drupalCreateNode([
'type' => 'article',
'promote' => NodeInterface::PROMOTED,
]);
// Test frontpage.
$this->drupalGet('');
$this->assertNoJavaScript();
// Test node page.
$this->drupalGet('node/1');
$this->assertNoJavaScript();
// Test user profile page.
$user = $this->drupalCreateUser();
$this->drupalGet('user/' . $user->id());
$this->assertNoJavaScript();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.