diff --git a/core/modules/system/src/Tests/Menu/MenuRouterTest.php b/core/modules/system/src/Tests/Menu/MenuRouterTest.php index 202c662..4383658 100644 --- a/core/modules/system/src/Tests/Menu/MenuRouterTest.php +++ b/core/modules/system/src/Tests/Menu/MenuRouterTest.php @@ -342,6 +342,8 @@ public function testMaintenanceModeLoginPaths() { $offline_message = t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => \Drupal::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); } diff --git a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml index 724e58f..6c3c106 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml +++ b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml @@ -14,6 +14,13 @@ menu_test.menu_callback_title: requirements: _access: 'TRUE' +menu_test.login_callback: + path: '/menu_login_callback' + defaults: + _content: '\Drupal\menu_test\TestControllers::testLogin' + requirements: + _access: 'TRUE' + menu_test.callback_description: path: '/menu_callback_description' defaults: diff --git a/core/modules/system/tests/modules/menu_test/menu_test.services.yml b/core/modules/system/tests/modules/menu_test/menu_test.services.yml index 8841320..951274f 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.services.yml +++ b/core/modules/system/tests/modules/menu_test/menu_test.services.yml @@ -1,4 +1,9 @@ services: + menu_test_maintenance_mode_exemption: + class: Drupal\menu_test\Site\MaintenanceExemption + tags: + - { name: maintenance_mode_exemption } + theme.negotiator.test_theme: class: Drupal\menu_test\Theme\TestThemeNegotiator tags: diff --git a/core/modules/system/tests/modules/menu_test/src/Site/MaintenanceExemption.php b/core/modules/system/tests/modules/menu_test/src/Site/MaintenanceExemption.php new file mode 100644 index 0000000..750a83a --- /dev/null +++ b/core/modules/system/tests/modules/menu_test/src/Site/MaintenanceExemption.php @@ -0,0 +1,29 @@ +getRouteName() == 'menu_test.login_callback') { + return TRUE; + } + } + +} diff --git a/core/modules/system/tests/modules/menu_test/src/TestControllers.php b/core/modules/system/tests/modules/menu_test/src/TestControllers.php index df3f090..608e0c7 100644 --- a/core/modules/system/tests/modules/menu_test/src/TestControllers.php +++ b/core/modules/system/tests/modules/menu_test/src/TestControllers.php @@ -16,6 +16,13 @@ class TestControllers { /** + * Returns page to be used as a login path. + */ + public function testLogin() { + return 'This is TestControllers::testLogin.'; + } + + /** * Prints out test data. */ public function test1() {