Skip to content
Snippets Groups Projects
Commit 01ed110a authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #345838 by Dave Reid: remove user creation from drupalLogin(). ...

- Patch #345838 by Dave Reid: remove user creation from drupalLogin().  drupalLogin() should only do one thing, and do it well. :)
parent 60524be4
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -729,25 +729,17 @@ protected function checkPermissions(array $permissions, $reset = FALSE) {
}
/**
* 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 @@ protected function drupalLogin($user = NULL) {
$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 @@ protected function setUp() {
}
/**
* 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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment