You are here

private function PatternsUserTestCase::testUserCreate in Patterns 7

Same name and namespace in other branches
  1. 7.2 tests/user/user.test \PatternsUserTestCase::testUserCreate()

File

tests/user/user.test, line 155
SimpleTests for the User component of Patterns. TODO: permissions.

Class

PatternsUserTestCase
@file SimpleTests for the User component of Patterns. TODO: permissions.

Code

private function testUserCreate() {

  // The user should not exist at this point.
  $user_count = db_select('users', 'u')
    ->fields('u', array(
    'uid',
  ))
    ->condition('name', 'test_uid')
    ->countQuery()
    ->execute()
    ->fetchField();
  $this
    ->assertIdentical($user_count, '0', t('The user should not exist at this point.'));

  // Run the pattern.
  parent::runFile('user_create.yaml', 'Users (create)', $this->user_tests_dir);

  // Expected messages.
  $this
    ->assertUniqueText(t('Created a new user account for test_uid.'));

  // The user should exist with the right values.
  $user = db_select('users', 'u')
    ->fields('u', array(
    'uid',
  ))
    ->condition('name', 'test_uid')
    ->countQuery()
    ->execute()
    ->fetchField();
  $this
    ->verbose('usercount: ' . $user);
  $this
    ->assertIdentical($user, 1, t('The test user should exist at this point.'));

  // TODO: Check fields.
}