function ImageCacheUrlTests::setUp in ImageCache 6.2
Same name and namespace in other branches
- 5.2 tests/imagecache_create_url.test \ImageCacheUrlTests::setUp()
SimpleTest core method: code run before each and every test method.
Overrides DrupalWebTestCase::setUp
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() {
// Make sure that the ImageCache and PHP Filter modules are enabled.
// Always call the setUp() function from the parent class.
parent::setUp('imagecache', 'php');
// Create admin user
$permissions = array(
'administer filters',
);
$this->admin_user = $this
->drupalCreateUser($permissions);
// Log in with admin user.
$this
->drupalLogin($this->admin_user);
// Add an input format with PHP evaluator.
$edit = array(
'name' => $this
->randomName(10, 'inputformat_'),
'filters[filter/0]' => FALSE,
'filters[filter/1]' => FALSE,
'filters[filter/2]' => FALSE,
'filters[filter/3]' => FALSE,
'filters[php/0]' => TRUE,
'roles[2]' => TRUE,
);
$this
->drupalPost('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)'));
}