You are here

function CasUserAdminTestCase::testCasUserAdd in CAS 6.3

Same name and namespace in other branches
  1. 7 cas.test \CasUserAdminTestCase::testCasUserAdd()

Tests adding a CAS user in the administrative interface.

File

./cas.test, line 336
Tests for cas.module.

Class

CasUserAdminTestCase

Code

function testCasUserAdd() {
  $this
    ->drupalLogin($this->admin_user);

  // Add a CAS user.
  $edit = array(
    'cas_name' => $this
      ->randomName(),
  );
  $this
    ->drupalPost('admin/user/user/cas/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['cas_name'],
  )), 'User created');

  // Verify the user shows up in the list of all users.
  $this
    ->drupalGet('admin/user/user');
  $this
    ->assertNoUniqueText($edit['cas_name'], 'User and CAS username found in list of users');

  // Attempt to add the user again and see that it fails.
  $this
    ->drupalPost('admin/user/user/cas/create', $edit, t('Create new account'));
  $this
    ->assertText(t('The CAS username is already in use on this site.'), 'CAS username already in use.');
}