summaryrefslogtreecommitdiff
path: root/modules/user/user.test
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-12-10 15:39:43 +0000
committerDries Buytaert <dries@buytaert.net>2009-12-10 15:39:43 +0000
commitc2f26d3368d38ce4d73aa0089d09d2d78ccf9285 (patch)
tree3db0c442068bd5bfb2a91e26675dfe9019cc8fab /modules/user/user.test
parent3016bcbd235b75e60a44566368c2d3702a625174 (diff)
downloadbrdo-c2f26d3368d38ce4d73aa0089d09d2d78ccf9285.tar.gz
brdo-c2f26d3368d38ce4d73aa0089d09d2d78ccf9285.tar.bz2
- Patch #653940 by sun: tests weren't reporting all errors.
Diffstat (limited to 'modules/user/user.test')
-rw-r--r--modules/user/user.test21
1 files changed, 14 insertions, 7 deletions
diff --git a/modules/user/user.test b/modules/user/user.test
index 3ee3f15f6..1365f2f6e 100644
--- a/modules/user/user.test
+++ b/modules/user/user.test
@@ -26,7 +26,8 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
$edit['mail'] = $mail = $edit['name'] . '@example.com';
$this->drupalPost('user/register', $edit, t('Create new account'));
$this->assertText(t('Your password and further instructions have been sent to your e-mail address.'), t('User registered successfully.'));
- $new_user = reset(user_load_multiple(array(), array('name' => $name, 'mail' => $mail)));
+ $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
+ $new_user = reset($accounts);
$this->assertTrue($new_user->status, t('New account is active after registration.'));
// Allow registration by site visitors, but require administrator approval.
@@ -35,7 +36,8 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
$edit['name'] = $name = $this->randomName();
$edit['mail'] = $mail = $edit['name'] . '@example.com';
$this->drupalPost('user/register', $edit, t('Create new account'));
- $new_user = reset(user_load_multiple(array(), array('name' => $name, 'mail' => $mail)));
+ $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
+ $new_user = reset($accounts);
$this->assertFalse($new_user->status, t('New account is blocked until approved by an administrator.'));
}
@@ -59,7 +61,8 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
$edit['pass[pass1]'] = $new_pass = $this->randomName();
$edit['pass[pass2]'] = $new_pass;
$this->drupalPost('user/register', $edit, t('Create new account'));
- $new_user = reset(user_load_multiple(array(), array('name' => $name, 'mail' => $mail)));
+ $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
+ $new_user = reset($accounts);
$this->assertText(t('Registration successful. You are now logged in.'), t('Users are logged in after registering.'));
$this->drupalLogout();
@@ -82,7 +85,8 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
$this->assertText(t('The username @name has not been activated or is blocked.', array('@name' => $name)), t('User cannot login yet.'));
// Activate the new account.
- $new_user = reset(user_load_multiple(array(), array('name' => $name, 'mail' => $mail)));
+ $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
+ $new_user = reset($accounts);
$admin_user = $this->drupalCreateUser(array('administer users'));
$this->drupalLogin($admin_user);
$edit = array(
@@ -115,7 +119,8 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
$this->drupalPost('user/register', $edit, t('Create new account'));
// Check user fields.
- $new_user = reset(user_load_multiple(array(), array('name' => $name, 'mail' => $mail)));
+ $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
+ $new_user = reset($accounts);
$this->assertEqual($new_user->name, $name, t('Username matches.'));
$this->assertEqual($new_user->mail, $mail, t('E-mail address matches.'));
$this->assertEqual($new_user->theme, '', t('Correct theme field.'));
@@ -371,7 +376,8 @@ class UserCancelTestCase extends DrupalWebTestCase {
$bogus_timestamp = $timestamp - 86400 - 60;
$this->drupalGet("user/$account->uid/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
$this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), t('Expired cancel account request rejected.'));
- $this->assertTrue(reset(user_load_multiple(array($account->uid), array('status' => 1))), t('User account was not canceled.'));
+ $accounts = user_load_multiple(array($account->uid), array('status' => 1));
+ $this->assertTrue(reset($accounts), t('User account was not canceled.'));
// Confirm user's content has not been altered.
$test_node = node_load($node->nid, NULL, TRUE);
@@ -725,7 +731,8 @@ class UserPictureTestCase extends DrupalWebTestCase {
// Images are sorted first by size then by name. We need an image
// bigger than 1 KB so we'll grab the last one.
- $image = end($this->drupalGetTestFiles('image'));
+ $files = $this->drupalGetTestFiles('image');
+ $image = end($files);
$info = image_get_info($image->uri);
// Set new variables: valid dimensions, invalid filesize.