From b5a97524991b6c77ef2923285250eb822eca25db Mon Sep 17 00:00:00 2001
From: webchick <webchick@24967.no-reply.drupal.org>
Date: Tue, 8 Oct 2013 21:38:25 -0700
Subject: [PATCH] Issue #2076551 by pfrenssen, pwolanin: Fixed
 SystemController::compactPage uses an invalid route name for the front page.

---
 .../lib/Drupal/system/Controller/SystemController.php     | 2 +-
 .../system/lib/Drupal/system/Tests/System/AdminTest.php   | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/core/modules/system/lib/Drupal/system/Controller/SystemController.php b/core/modules/system/lib/Drupal/system/Controller/SystemController.php
index eaaa8a0acee8..597471ef77bb 100644
--- a/core/modules/system/lib/Drupal/system/Controller/SystemController.php
+++ b/core/modules/system/lib/Drupal/system/Controller/SystemController.php
@@ -135,7 +135,7 @@ public function overview() {
    */
   public function compactPage($mode) {
     user_cookie_save(array('admin_compact_mode' => ($mode == 'on')));
-    return $this->redirect('front');
+    return $this->redirect('<front>');
   }
 
   /**
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 1c4293696342..2ecd63216e21 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 '<front>', 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.');
-- 
GitLab