public function ClockBlockTestCase::setUp in Clock 6
Same name and namespace in other branches
- 7.2 clock.test \ClockBlockTestCase::setUp()
- 7 clock.test \ClockBlockTestCase::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
- ./
clock.test, line 19 - Tests for Clock module.
Class
- ClockBlockTestCase
- @file Tests for Clock module.
Code
public function setUp() {
parent::setUp('date_api', 'date_timezone', 'clock');
$privileged_user = $this
->drupalCreateUser(array(
'administer blocks',
'administer site configuration',
));
// Save the test user's uid to access the user edit page later.
variable_set('test_user_id', $privileged_user->uid);
$this
->drupalLogin($privileged_user);
// Date Timezone requires to set a site timezone.
$edit = array();
$edit['date_default_timezone_name'] = 'UTC';
$this
->drupalPost('admin/settings/date-time', $edit, 'Save configuration');
// Enable the clock block in the right sidebar.
$edit = array();
$edit['clock_clock[region]'] = 'right';
$this
->drupalPost('admin/build/block', $edit, 'Save blocks');
}