You are here

public function MenuRouterTest::testMaintenanceModeLoginPaths in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php \Drupal\Tests\system\Functional\Menu\MenuRouterTest::testMaintenanceModeLoginPaths()

Make sure the maintenance mode can be bypassed using an EventSubscriber.

See also

\Drupal\menu_test\EventSubscriber\MaintenanceModeSubscriber::onKernelRequestMaintenance()

File

core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php, line 212

Class

MenuRouterTest
Tests menu router and default menu link functionality.

Namespace

Drupal\Tests\system\Functional\Menu

Code

public function testMaintenanceModeLoginPaths() {
  $this->container
    ->get('state')
    ->set('system.maintenance_mode', TRUE);
  $offline_message = t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', [
    '@site' => $this
      ->config('system.site')
      ->get('name'),
  ]);
  $this
    ->drupalGet('test-page');
  $this
    ->assertText($offline_message);
  $this
    ->drupalGet('menu_login_callback');
  $this
    ->assertText('This is TestControllers::testLogin.', 'Maintenance mode can be bypassed using an event subscriber.');
  $this->container
    ->get('state')
    ->set('system.maintenance_mode', FALSE);
}