diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-07-07 08:05:01 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-07-07 08:05:01 +0000 |
commit | ea4f6bcef2f1c3ba8f84115d3de3af0d8e5820d2 (patch) | |
tree | 5561cfced677d44bff71b9b2955139cec9387226 /modules/simpletest/tests/menu.test | |
parent | a8812bb727a08296a2029fcb055767bc4b783fb0 (diff) | |
download | brdo-ea4f6bcef2f1c3ba8f84115d3de3af0d8e5820d2.tar.gz brdo-ea4f6bcef2f1c3ba8f84115d3de3af0d8e5820d2.tar.bz2 |
#363580 by rfay, chx, Berdir, Rob Loach, Gábor Hojtsy, Shawn DeArmond: Fixed OpenID login fails when in maintenance mode, and 403 errors on certain user paths for logged-in users.
Diffstat (limited to 'modules/simpletest/tests/menu.test')
-rw-r--r-- | modules/simpletest/tests/menu.test | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/modules/simpletest/tests/menu.test b/modules/simpletest/tests/menu.test index 0e6da766b..fdf529733 100644 --- a/modules/simpletest/tests/menu.test +++ b/modules/simpletest/tests/menu.test @@ -91,6 +91,39 @@ class MenuRouterTestCase extends DrupalWebTestCase { } /** + * Make sure the maintenance mode can be bypassed using hook_menu_site_status_alter(). + * + * @see hook_menu_site_status_alter(). + */ + function testMaintenanceModeLoginPaths() { + variable_set('maintenance_mode', TRUE); + + $offline_message = t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal'))); + $this->drupalLogout(); + $this->drupalGet('node'); + $this->assertText($offline_message); + $this->drupalGet('menu_login_callback'); + $this->assertText('This is menu_login_callback().', t('Maintenance mode can be bypassed through hook_login_paths().')); + } + + /** + * Test that an authenticated user hitting 'user/login' gets redirected to + * 'user' and 'user/register' gets redirected to the user edit page. + */ + function testAuthUserUserLogin() { + $loggedInUser = $this->drupalCreateUser(array()); + $this->drupalLogin($loggedInUser); + + $this->DrupalGet('user/login'); + // Check that we got to 'user'. + $this->assertTrue($this->url == url('user', array('absolute' => TRUE)), t("Logged-in user redirected to q=user on accessing q=user/login")); + + // user/register should redirect to user/UID/edit. + $this->DrupalGet('user/register'); + $this->assertTrue($this->url == url('user/' . $this->loggedInUser->uid . '/edit', array('absolute' => TRUE)), t("Logged-in user redirected to q=user/UID/edit on accessing q=user/register")); + } + + /** * Test the theme callback when it is set to use an optional theme. */ function testThemeCallbackOptionalTheme() { @@ -491,4 +524,3 @@ class MenuTreeDataTestCase extends DrupalUnitTestCase { return $this->assert($link1['mlid'] == $link2['mlid'], $message ? $message : t('First link is identical to second link')); } } - |