function MenuRouterTest::doTestThemeCallbackMaintenanceMode
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php \Drupal\Tests\system\Functional\Menu\MenuRouterTest::doTestThemeCallbackMaintenanceMode()
- 8.9.x core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php \Drupal\Tests\system\Functional\Menu\MenuRouterTest::doTestThemeCallbackMaintenanceMode()
- 11.x core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php \Drupal\Tests\system\Functional\Menu\MenuRouterTest::doTestThemeCallbackMaintenanceMode()
Tests the theme negotiation when the site is in maintenance mode.
1 call to MenuRouterTest::doTestThemeCallbackMaintenanceMode()
- MenuRouterTest::testThemeIntegration in core/
modules/ system/ tests/ src/ Functional/ Menu/ MenuRouterTest.php - Tests theme integration.
File
-
core/
modules/ system/ tests/ src/ Functional/ Menu/ MenuRouterTest.php, line 283
Class
- MenuRouterTest
- Tests menu router and default menu link functionality.
Namespace
Drupal\Tests\system\Functional\MenuCode
protected function doTestThemeCallbackMaintenanceMode() {
$this->container
->get('state')
->set('system.maintenance_mode', TRUE);
// For a regular user, the fact that the site is in maintenance mode means
// we expect the theme callback system to be bypassed entirely.
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
// Check that the maintenance theme's CSS appears on the page.
$this->assertSession()
->responseContains('olivero/css/base/base.css');
// An administrator, however, should continue to see the requested theme.
$admin_user = $this->drupalCreateUser([
'access site in maintenance mode',
]);
$this->drupalLogin($admin_user);
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
$this->assertSession()
->pageTextContains('Active theme: claro. Actual theme: claro.');
// Check that the administrative theme's CSS appears on the page.
$this->assertSession()
->responseContains('claro/css/base/elements.css');
$this->container
->get('state')
->set('system.maintenance_mode', FALSE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.