| 7 statistics.test | StatisticsLoggingTestCase::setUp() |
| 8 statistics.test | StatisticsLoggingTestCase::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
- modules/
statistics/ statistics.test, line 63 - Tests for statistics.module.
Code
function setUp() {
parent::setUp('statistics');
$this->auth_user = $this->drupalCreateUser(array('access content', 'create page content', 'edit own page content'));
// Ensure we have a node page to access.
$this->node = $this->drupalCreateNode(array('title' => $this->randomName(255), 'uid' => $this->auth_user->uid));
// Enable page caching.
variable_set('cache', TRUE);
// Enable access logging.
variable_set('statistics_enable_access_log', 1);
variable_set('statistics_count_content_views', 1);
// Clear the logs.
db_truncate('accesslog');
db_truncate('node_counter');
}
Login or register to post comments