protected function WebDriverTestBase::getDrupalSettings in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::getDrupalSettings()
- 9 core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::getDrupalSettings()
Gets the current Drupal javascript settings and parses into an array.
Unlike BrowserTestBase::getDrupalSettings(), this implementation reads the current values of drupalSettings, capturing all changes made via javascript after the page was loaded.
Return value
array The Drupal javascript settings array.
Overrides BrowserTestBase::getDrupalSettings
See also
\Drupal\Tests\BrowserTestBase::getDrupalSettings()
1 call to WebDriverTestBase::getDrupalSettings()
- JavascriptGetDrupalSettingsTest::testGetDrupalSettings in core/
tests/ Drupal/ FunctionalJavascriptTests/ JavascriptGetDrupalSettingsTest.php - Tests retrieval of Drupal settings.
File
- core/
tests/ Drupal/ FunctionalJavascriptTests/ WebDriverTestBase.php, line 212
Class
- WebDriverTestBase
- Runs a browser test using a driver that supports JavaScript.
Namespace
Drupal\FunctionalJavascriptTestsCode
protected function getDrupalSettings() {
$script = <<<EndOfScript
(function () {
if (typeof drupalSettings !== 'undefined') {
return drupalSettings;
}
})();
EndOfScript;
return $this
->getSession()
->evaluateScript($script) ?: [];
}