You are here

public function SecureSiteNameConflictFunctionalTest::testSecureSiteNameConflictUserCreate in Secure Site 7.2

Same name and namespace in other branches
  1. 6.2 securesite.test \SecureSiteNameConflictFunctionalTest::testSecureSiteNameConflictUserCreate()

Create user with guest name.

File

./securesite.test, line 876
Tests for Secure Site module.

Class

SecureSiteNameConflictFunctionalTest
Functional tests for conflicts between guest name and user names.

Code

public function testSecureSiteNameConflictUserCreate() {
  $this
    ->drupalLogin($this->user);
  $this
    ->drupalPost('admin/user/user/create', array(
    'name' => $this->guest,
    'mail' => $this->guest . '@example.com',
    'pass[pass1]' => $this->user->pass_raw,
    'pass[pass2]' => $this->user->pass_raw,
  ), 'Create new account');
  $this
    ->assertText("The name {$this->guest} is being used as the " . variable_get('site_name', 'Drupal') . " guest name.", t('Creating user with guest name.'));
  $this
    ->assertTrue(db_query_range("SELECT uid FROM {users} WHERE name = :name", array(
    ':name' => $this->guest,
  ))
    ->fetchField() === FALSE, t('Checking for user with guest name.'));
}