You are here

private function PatternsUserTestCase::testRoleCreate in Patterns 7

Same name and namespace in other branches
  1. 7.2 tests/user/user.test \PatternsUserTestCase::testRoleCreate()
1 call to PatternsUserTestCase::testRoleCreate()
PatternsUserTestCase::testCreateModifyDelete in tests/user/user.test

File

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

Class

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

Code

private function testRoleCreate() {

  // The role should not exist at this point.
  $role_count = db_select('role', 'r')
    ->fields('r', array(
    'rid',
  ))
    ->condition('name', 'test_role')
    ->countQuery()
    ->execute()
    ->fetchField();
  $this
    ->assertIdentical($role_count, '0', t('The role should not exist at this point.'));

  // Run the pattern.
  parent::runFile('user_role_create.yaml', 'Role (create)', $this->user_tests_dir);
  $this
    ->assertUniqueText(t('The role has been added.'));
  $role_count = db_select('role', 'r')
    ->fields('r', array(
    'name',
  ))
    ->condition('name', 'test_role')
    ->countQuery()
    ->execute()
    ->fetchField();
  $this
    ->assertIdentical($role_count, '1', t('The test role should exist at this point.'));

  //$this->testPermissionCreate();
}