You are here

function ContentAccessTestCase::setUp in Content Access 5

Same name and namespace in other branches
  1. 6 tests/content_access_test_help.php \ContentAccessTestCase::setUp()
  2. 7 tests/content_access_test_help.php \ContentAccessTestCase::setUp()

Preparation work that is done before each test. Test users, content types, nodes etc. are created.

2 calls to ContentAccessTestCase::setUp()
ContentAccessACLTestCase::setUp in tests/content_access_acl.test
Setup configuration before each test
ContentAccessModuleTestCase::setUp in tests/content_access.test
Preparation work that is done before each test. Test users, content types, nodes etc. are created.
2 methods override ContentAccessTestCase::setUp()
ContentAccessACLTestCase::setUp in tests/content_access_acl.test
Setup configuration before each test
ContentAccessModuleTestCase::setUp in tests/content_access.test
Preparation work that is done before each test. Test users, content types, nodes etc. are created.

File

tests/content_access_test_help.php, line 21
Helper class with auxiliary functions for content access module tests

Class

ContentAccessTestCase
@file Helper class with auxiliary functions for content access module tests

Code

function setUp() {
  parent::setUp();

  // Create test user with seperate role
  $this->test_user = $this
    ->drupalCreateUserRolePerm();

  // Create admin user
  $this->admin_user = $this
    ->drupalCreateUserRolePerm(array(
    'administer content types',
    'grant content access',
    'grant own content access',
    'administer nodes',
  ));
  $this
    ->drupalLoginUser($this->admin_user);

  // Create test content type
  $this->content_type_name = strtolower($this
    ->randomName(5));
  $edit = array(
    'name' => $this->content_type_name,
    'type' => $this->content_type_name,
  );
  $this
    ->drupalPostRequest('admin/content/types/add', $edit, 'op');
  $this
    ->assertWantedRaw(t('The content type %type has been added.', array(
    '%type' => $this->content_type_name,
  )), 'Test content type was added successfully');
  $this->url_content_type_name = str_replace('_', '-', $this->content_type_name);
}