You are here

public function MenuRouterTest::testMaintenanceModeLoginPaths in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Menu/MenuRouterTest.php \Drupal\system\Tests\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/src/Tests/Menu/MenuRouterTest.php, line 215
Contains \Drupal\system\Tests\Menu\MenuRouterTest.

Class

MenuRouterTest
Tests menu router and default menu link functionality.

Namespace

Drupal\system\Tests\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.', array(
    '@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);
}