diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-09-09 11:36:02 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-09-09 11:36:02 +0000 |
commit | 933be1636ae812d4ec9272fb29172cae8120971b (patch) | |
tree | ea1392f437e0afa32b958c5d2ef041e7f6b5e85c /modules/user/user.test | |
parent | e85ba39753d79b94894d6f8207839c95337a0a0b (diff) | |
download | brdo-933be1636ae812d4ec9272fb29172cae8120971b.tar.gz brdo-933be1636ae812d4ec9272fb29172cae8120971b.tar.bz2 |
- Patch #550210 by boombatower: added test for admin/people/create.
Diffstat (limited to 'modules/user/user.test')
-rw-r--r-- | modules/user/user.test | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/modules/user/user.test b/modules/user/user.test index 7cba7c065..259f58053 100644 --- a/modules/user/user.test +++ b/modules/user/user.test @@ -1209,6 +1209,52 @@ class UserSaveTestCase extends DrupalWebTestCase { } /** + * Test the create user administration page. + */ +class UserCreateTestCase extends DrupalWebTestCase { + + public static function getInfo() { + return array( + 'name' => 'User create', + 'description' => 'Test the creat user administration page.', + 'group' => 'User', + ); + } + + /** + * Create a user through the administration interface and ensure that it + * displays in the user list. + */ + protected function testUserAdd() { + $user = $this->drupalCreateUser(array('administer users')); + $this->drupalLogin($user); + + foreach (array(FALSE, TRUE) as $notify) { + $edit = array( + 'name' => $this->randomName(), + 'mail' => $this->randomName() . '@example.com', + 'pass[pass1]' => $pass = $this->randomString(), + 'pass[pass2]' => $pass, + 'notify' => $notify, + ); + $this->drupalPost('admin/people/create', $edit, t('Create new account')); + + if ($notify) { + $this->assertText(t('Password and further instructions have been e-mailed to the new user @name.', array('@name' => $edit['name'])), 'User created'); + $this->assertEqual(count($this->drupalGetMails()), 1, 'Notification e-mail sent'); + } + else { + $this->assertText(t('Created a new user account for @name. No e-mail has been sent.', array('@name' => $edit['name'])), 'User created'); + $this->assertEqual(count($this->drupalGetMails()), 0, 'Notification e-mail not sent'); + } + + $this->drupalGet('admin/people'); + $this->assertText($edit['name'], 'User found in list of users'); + } + } +} + +/** * Test case to test user_save() behaviour. */ class UserEditTestCase extends DrupalWebTestCase { |