protected function UpdatePathTestJavaScriptTest::doSelectionTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Update/UpdatePathTestJavaScriptTest.php \Drupal\system\Tests\Update\UpdatePathTestJavaScriptTest::doSelectionTest()
Tests the selection page.
Overrides UpdatePathTestBase::doSelectionTest
File
- core/
modules/ system/ src/ Tests/ Update/ UpdatePathTestJavaScriptTest.php, line 38 - Contains \Drupal\system\Tests\Update\UpdatePathTestJavaScriptTest.php.
Class
- UpdatePathTestJavaScriptTest
- Tests the presence of JavaScript at update.php.
Namespace
Drupal\system\Tests\UpdateCode
protected function doSelectionTest() {
// Ensure that at least one JS script has drupalSettings in there.
$scripts = $this
->xpath('//script');
$found = FALSE;
foreach ($scripts as $script) {
if (!isset($script['src'])) {
continue;
}
$src = (string) $script['src'];
$file_content = file_get_contents($src);
if (strpos($file_content, 'window.drupalSettings =') !== FALSE) {
$found = TRUE;
break;
}
}
$this
->assertTrue($found, 'Ensure that the drupalSettingsLoader.js was included in the JS files');
}