function BrowserTestBaseTest::testDrupalSettings
Same name in other branches
- 11.x core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testDrupalSettings()
Tests that JavaScript Drupal settings can be read.
File
-
core/
tests/ Drupal/ FunctionalTests/ BrowserTestBaseTest.php, line 49
Class
- BrowserTestBaseTest
- Tests BrowserTestBase functionality.
Namespace
Drupal\FunctionalTestsCode
public function testDrupalSettings() : void {
// Trigger a 403 because those pages have very little else going on.
$this->drupalGet('admin');
$this->assertSame([], $this->getDrupalSettings());
// Now try the same 403 as an authenticated user and verify that Drupal
// settings do show up.
$account = $this->drupalCreateUser();
$this->drupalLogin($account);
$this->drupalGet('admin');
$this->assertNotSame([], $this->getDrupalSettings());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.