function CasUserTestCase::testUserEdit in CAS 6.3
Same name and namespace in other branches
- 7 cas.test \CasUserTestCase::testUserEdit()
File
- ./
cas.test, line 398 - Tests for cas.module.
Class
- CasUserTestCase
- Test case to test user editing behavior.
Code
function testUserEdit() {
$cas_name = $this
->randomName();
$account = $this
->casCreateUser($cas_name, array(
'change own username',
));
$this
->casLogin($cas_name);
// Standard user page.
variable_set('cas_hide_email', FALSE);
variable_set('cas_hide_password', FALSE);
$this
->drupalGet("user/{$account->uid}/edit");
$this
->assertField('mail', 'E-mail field is present.');
$this
->assertField('pass[pass1]', 'Existing password field 1 is present.');
$this
->assertField('pass[pass2]', 'Existing password field 2 is present.');
$edit = array(
'mail' => $mail = $this
->randomName() . '@example.com',
);
$this
->drupalPost("user/{$account->uid}/edit", $edit, t('Save'));
$this
->assertFieldByName('mail', $mail);
// Hide the password, ensure edits can be made..
variable_set('cas_hide_password', TRUE);
$this
->drupalGet("user/{$account->uid}/edit");
$this
->assertNoField('pass[pass1]', 'Existing password field 1 is not present.');
$this
->assertNoField('pass[pass2]', 'Existing password field 2 is not present.');
$edit = array(
'mail' => $mail = $this
->randomName() . '@example.com',
);
$this
->drupalPost("user/{$account->uid}/edit", $edit, t('Save'));
$this
->assertFieldByName('mail', $mail);
// Hide the e-mail field as well, ensure that it is not visible.
variable_set('cas_hide_email', TRUE);
$this
->drupalGet("user/{$account->uid}/edit");
// @todo: Need to test that the mail is field is hidden.
// $this->assertNoField('mail', 'E-mail field is not present.');
}