function StatisticsProTestCase::testMainTests in Statistics Pro 6
Same name and namespace in other branches
- 6.2 tests/statspro.test \StatisticsProTestCase::testMainTests()
File
- tests/statspro.test, line 339
- Functionality tests for Statistics Pro.
Class
- StatisticsProTestCase
- Class responsible for testing the module.
Code
function testMainTests() {
$this
->createInitialData();
$this
->drupalLogin($this->users['stats_admin']);
$edit = array(
'statistics_enable_access_log' => 1,
'statistics_flush_accesslog_timer' => 9676800,
);
$this
->drupalPost('admin/reports/settings', $edit, t('Save configuration'));
$this
->drupalLogout();
$this
->drupalGetNodeByTitle(t('Node !this/!total - now', array(
'!this' => 1,
'!total' => 1,
)));
$this
->drupalGetNodeByTitle(t('Node !this/!total - last week', array(
'!this' => 2,
'!total' => 2,
)));
$this
->drupalGetNodeByTitle(t('Node !this/!total - last year', array(
'!this' => 2,
'!total' => 3,
)));
$this
->drupalGet('node/111');
$this
->drupalGet('node/1099');
$this
->drupalLogin($this->users['regular_3']);
$this
->drupalGetNodeByTitle(t('Node !this/!total - last week', array(
'!this' => 2,
'!total' => 2,
)));
$this
->drupalGetNodeByTitle(t('Node !this/!total - last month', array(
'!this' => 1,
'!total' => 1,
)));
$this
->drupalGetNodeByTitle(t('Node !this/!total - last week', array(
'!this' => 1,
'!total' => 2,
)));
$this
->drupalGetNodeByTitle(t('Node !this/!total - now', array(
'!this' => 1,
'!total' => 1,
)));
$this
->drupalGet('node/700');
$this
->drupalGet('node/199');
$this
->drupalLogin($this->users['regular_1']);
$this
->drupalGetNodeByTitle(t('Node !this/!total - last week', array(
'!this' => 1,
'!total' => 2,
)));
$this
->drupalGetNodeByTitle(t('Node !this/!total - now', array(
'!this' => 1,
'!total' => 1,
)));
$this
->drupalGetNodeByTitle(t('Node !this/!total - last year', array(
'!this' => 1,
'!total' => 3,
)));
$this
->callCron();
$group = t('General Statistics Pro tests');
$periods = statspro_get_period_items();
$this
->drupalLogin($this->users['stats']);
$period = 'today';
$texts = array(
'User registrations8',
'User online7',
'New nodes1',
'Changed nodes0',
'Comments0',
'Page impressions21',
'Page impressions for authenticated users10',
'Errors0',
'Errors for authenticated users0',
'Warnings4',
'Warnings for authenticated users2',
);
$raws = array();
$this
->completeTestStatsHasTexts($texts, $raws, FALSE, $group, FALSE, FALSE);
$period = 'yesterday';
$texts = array(
'User registrations0',
'User online0',
'New nodes1',
'Changed nodes0',
'Comments0',
'No access and log files available for specified period.',
);
$raws = array();
$this
->completeTestStatsHasTexts($texts, $raws, $period, $group);
$texts = array(
'Overview for new created comments.',
'Date',
'Comments',
'Trend',
'Amount',
);
$result = db_query('SELECT day FROM {statspro}');
while ($row = db_fetch_array($result)) {
$texts[] = $row['day'];
}
$raws = array();
$this
->completeTestStatsHasTexts($texts, $raws, FALSE, $group, 'admin/reports/statspro/comment', FALSE);
$texts = array(
'Overview for warnings.',
'Overview for warnings, registered users only.',
'Date',
'Trend',
'Amount',
);
$result = db_query('SELECT day
FROM {statspro}
WHERE error > 0
OR uerror > 0
OR warning > 0
OR uwarning > 0');
while ($row = db_fetch_array($result)) {
$texts[] = $row['day'];
}
$raws = array();
$this
->completeTestStatsHasTexts($texts, $raws, FALSE, $group, 'admin/reports/statspro/log', FALSE);
$texts = array(
'Overview for new created nodes.',
'Overview for changed nodes.',
'Date',
'Trend',
'Amount',
'New nodes',
'Changed nodes',
);
$raws = array();
$this
->completeTestStatsHasTexts($texts, $raws, FALSE, $group, 'admin/reports/statspro/node', FALSE);
$texts = array(
'Page impressions for guests and registered users.',
'Page impressions registered users.',
'Date',
'Trend',
'Amount',
'Page impressions',
'Page impressions, users',
);
$raws = array();
$this
->completeTestStatsHasTexts($texts, $raws, FALSE, $group, 'admin/reports/statspro/pi', FALSE);
$texts = array(
'Overview for new user registrations.',
'Overview for online user activity.',
'Date',
'Trend',
'Amount',
'User registrations',
'User online',
);
$raws = array();
$this
->completeTestStatsHasTexts($texts, $raws, FALSE, $group, 'admin/reports/statspro/user', FALSE);
}