Commit b5a97524 authored by webchick's avatar webchick

Issue #2076551 by pfrenssen, pwolanin: Fixed SystemController::compactPage...

Issue #2076551 by pfrenssen, pwolanin: Fixed SystemController::compactPage uses an invalid route name for the front page.
parent 667dc6b6
......@@ -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>');
}
/**
......
......@@ -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.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment