function CasUserAdminTestCase::testUserAdd in CAS 7
Same name and namespace in other branches
- 6.3 cas.test \CasUserAdminTestCase::testUserAdd()
Tests adding a user with a CAS username in the administrative interface.
File
- ./
cas.test, line 299 - Tests for cas.module.
Class
Code
function testUserAdd() {
$this
->drupalLogin($this->admin_user);
// Register a user with a CAS username.
$cas_name = $this
->randomName();
$edit = array(
'name' => $this
->randomName(),
'mail' => $this
->randomName() . '@example.com',
'cas_name' => $cas_name,
'pass[pass1]' => $pass = $this
->randomString(),
'pass[pass2]' => $pass,
'notify' => FALSE,
);
$this
->drupalPost('admin/people/create', $edit, t('Create new account'));
$this
->assertText(t('Created a new user account for @name. No e-mail has been sent.', array(
'@name' => $edit['name'],
)), 'User created');
$this
->drupalGet('admin/people');
$this
->assertText($edit['name'], 'User found in list of users');
$this
->assertText($edit['cas_name'], 'CAS username found in list of users');
// Verify that duplicate CAS usernames are not allowed.
$edit = array(
'name' => $this
->randomName(),
'mail' => $this
->randomName() . '@example.com',
'cas_name' => $cas_name,
'pass[pass1]' => $pass = $this
->randomString(),
'pass[pass2]' => $pass,
'notify' => FALSE,
);
$this
->drupalPost('admin/people/create', $edit, t('Create new account'));
$this
->assertText(t('The CAS username is already in use on this site.'), 'CAS username already in use.');
}