function ImageTestCase::setUp in Image 6
Same name and namespace in other branches
- 7 tests/image.test \ImageTestCase::setUp()
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix. A temporary files directory is created with the same name as the database prefix.
Parameters
...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.
Overrides DrupalWebTestCase::setUp
File
- tests/
image.test, line 19
Class
- ImageTestCase
- Test image functionality.
Code
function setUp() {
parent::setUp('image');
// User to create images.
$this->web_user = $this
->drupalCreateUser(array(
'create images',
'view original images',
'edit own images',
'edit any images',
'delete own images',
'delete any images',
'administer site configuration',
));
$this
->drupalLogin($this->web_user);
// Uploadable image.
$this->image = 'misc/druplicon.png';
$this->another_image = 'misc/throbber.gif';
// Set small dimensions for testing scale so $this->image is small enough.
$image_sizes = image_get_sizes();
$image_sizes['_original']['operation'] = 'scale';
$image_sizes['thumbnail']['operation'] = 'scale';
$image_sizes['thumbnail']['width'] = 5;
$image_sizes['thumbnail']['height'] = 5;
$image_sizes['preview']['operation'] = 'scale';
$image_sizes['preview']['width'] = 10;
$image_sizes['preview']['height'] = 10;
variable_set('image_sizes', $image_sizes);
}