You are here

function ImageCacheUrlTests::setUp in ImageCache 5.2

Same name and namespace in other branches
  1. 6.2 tests/imagecache_create_url.test \ImageCacheUrlTests::setUp()

SimpleTest core method: code run before each and every test method.

File

tests/imagecache_create_url.test, line 33

Class

ImageCacheUrlTests
Test class for testing imagecache_create_url() in several use cases with the different combinations of clean URLs and private/public download method.

Code

function setUp() {

  // Always call the setUp() function from the parent class.
  parent::setUp();

  // Make sure that the ImageCache module is enabled.
  $this
    ->drupalModuleEnable('imagecache');

  // Create admin user
  $permissions = array(
    'administer filters',
  );
  $this->admin_user = $this
    ->drupalCreateUserRolePerm($permissions);

  // Log in with admin user.
  $this
    ->drupalLoginUser($this->admin_user);

  // Add an input format with PHP evaluator.
  $edit = array(
    'name' => $this
      ->randomName(10, 'inputformat_'),
    'filters[filter/1]' => TRUE,
    'roles[2]' => TRUE,
  );
  $this
    ->drupalPostRequest('admin/settings/filters/add', $edit, t('Save configuration'));

  // Store the format id of the created input format.
  $this->input_format_id = db_result(db_query("SELECT format FROM {filter_formats} WHERE name = '%s'", $edit['name']));
  $this
    ->assertTrue($this->input_format_id, t('Input format id (%s)'));
}