diff --git a/core/modules/system/lib/Drupal/system/Controller/SystemController.php b/core/modules/system/lib/Drupal/system/Controller/SystemController.php index f736353..d574d22 100644 --- a/core/modules/system/lib/Drupal/system/Controller/SystemController.php +++ b/core/modules/system/lib/Drupal/system/Controller/SystemController.php @@ -137,7 +137,7 @@ public function overview() { */ public function compactPage($mode) { user_cookie_save(array('admin_compact_mode' => ($mode == 'on'))); - return $this->redirect('front'); + return $this->redirect(''); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/System/AdminTest.php b/core/modules/system/lib/Drupal/system/Tests/System/AdminTest.php index 1c42936..2ecd632 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/AdminTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/AdminTest.php @@ -114,7 +114,13 @@ function testAdminPages() { * Test compact mode. */ function testCompactMode() { + // The front page defaults to 'user', which redirects to 'user/{user}'. We + // cannot use '', since this does not match the redirected url. + $frontpage_url = 'user/' . $this->admin_user->id(); + $this->drupalGet('admin/compact/on'); + $this->assertResponse(200, 'A valid page is returned after turning on compact mode.'); + $this->assertUrl($frontpage_url, array(), 'The user is redirected to the front page after turning on compact mode.'); $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode turns on.'); $this->drupalGet('admin/compact/on'); $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode remains on after a repeat call.'); @@ -122,6 +128,8 @@ function testCompactMode() { $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.'); $this->drupalGet('admin/compact/off'); + $this->assertResponse(200, 'A valid page is returned after turning off compact mode.'); + $this->assertUrl($frontpage_url, array(), 'The user is redirected to the front page after turning off compact mode.'); $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode turns off.'); $this->drupalGet('admin/compact/off'); $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode remains off after a repeat call.');