diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-12-11 20:35:37 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-12-11 20:35:37 +0000 |
commit | 01ed110a6bf6cd9283568e7ef8bd8f7140edd784 (patch) | |
tree | 7000a3727e5bf4416021efdbb7d01c8cd7914457 /modules | |
parent | 60524be44b6b6a7c276514643ae8430840de2ab1 (diff) | |
download | brdo-01ed110a6bf6cd9283568e7ef8bd8f7140edd784.tar.gz brdo-01ed110a6bf6cd9283568e7ef8bd8f7140edd784.tar.bz2 |
- Patch #345838 by Dave Reid: remove user creation from drupalLogin(). drupalLogin() should only do one thing, and do it well. :)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/dblog/dblog.test | 2 | ||||
-rw-r--r-- | modules/help/help.test | 2 | ||||
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 24 |
3 files changed, 9 insertions, 19 deletions
diff --git a/modules/dblog/dblog.test b/modules/dblog/dblog.test index 5e151c232..49e5138f7 100644 --- a/modules/dblog/dblog.test +++ b/modules/dblog/dblog.test @@ -37,7 +37,7 @@ class DBLogTestCase extends DrupalWebTestCase { $this->verifyReports(); // Login the regular user. - $user = $this->drupalLogin($this->any_user); + $this->drupalLogin($this->any_user); $this->verifyReports(403); } diff --git a/modules/help/help.test b/modules/help/help.test index 0a988d6c9..64e960180 100644 --- a/modules/help/help.test +++ b/modules/help/help.test @@ -38,7 +38,7 @@ class HelpTestCase extends DrupalWebTestCase { $this->verifyHelp(); // Login the regular user. - $user = $this->drupalLogin($this->any_user); + $this->drupalLogin($this->any_user); $this->verifyHelp(403); } diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index ce94a858c..fb39a0e30 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -729,25 +729,17 @@ class DrupalWebTestCase { } /** - * Logs in a user with the internal browser. If already logged in then logs the current - * user out before logging in the specified user. If no user is specified then a new - * user will be created and logged in. + * Logs in a user with the internal browser. If a user is already logged in, + * then the current user is logged out before logging in the specified user. * * @param $user * User object representing the user to login. - * @return - * User that was logged in. Useful if no user was passed in order to retrieve - * the created user. */ - protected function drupalLogin($user = NULL) { + protected function drupalLogin(stdClass $user) { if ($this->isLoggedIn) { $this->drupalLogout(); } - if (!isset($user)) { - $user = $this->_drupalCreateRole(); - } - $edit = array( 'name' => $user->name, 'pass' => $user->pass_raw @@ -759,8 +751,6 @@ class DrupalWebTestCase { $pass = $pass && $this->assertNoText(t('The name %name is a reserved username.', array('%name' => $user->name)), t('No reserved message at login page'), t('User login')); $this->isLoggedIn = $pass; - - return $user; } /* @@ -838,10 +828,10 @@ class DrupalWebTestCase { } /** - * This method is called by DrupalWebTestCase::setUp, and preloads the - * registry from the testing site to cut down on the time it takes to - * setup the a clean environment for the current test run. - */ + * This method is called by DrupalWebTestCase::setUp, and preloads the + * registry from the testing site to cut down on the time it takes to + * setup a clean environment for the current test run. + */ protected function preloadRegistry() { db_query('INSERT INTO {registry} SELECT * FROM ' . $this->originalPrefix . 'registry'); db_query('INSERT INTO {registry_file} SELECT * FROM ' . $this->originalPrefix . 'registry_file'); |