You are here

public function FilterExampleTestCase::setUp in Examples for Developers 7

Enable modules and create user with specific permissions.

Overrides DrupalWebTestCase::setUp

File

filter_example/filter_example.test, line 36
Test case for Testing the filter example module.

Class

FilterExampleTestCase
Functional tests for the Filter Example module.

Code

public function setUp() {
  parent::setUp('filter_example');

  // Load the used input formats.
  $this->filteredHtml = db_query_range('SELECT * FROM {filter_format} WHERE name = :name', 0, 1, array(
    ':name' => 'Filtered HTML',
  ))
    ->fetchObject();
  $this->fullHtml = db_query_range('SELECT * FROM {filter_format} WHERE name = :name', 0, 1, array(
    ':name' => 'Full HTML',
  ))
    ->fetchObject();

  // Create user.
  $this->webUser = $this
    ->drupalCreateUser(array(
    'administer filters',
    filter_permission_name($this->filteredHtml),
    filter_permission_name($this->fullHtml),
    'bypass node access',
  ));
}