| 7 statistics.test | StatisticsAdminTestCase::testStatisticsSettings() |
| 8 statistics.test | StatisticsAdminTestCase::testStatisticsSettings() |
Verifies that the statistics settings page works.
File
- modules/
statistics/ statistics.test, line 309 - Tests for statistics.module.
Code
function testStatisticsSettings() {
$this->assertFalse(variable_get('statistics_enable_access_log', 0), t('Access log is disabled by default.'));
$this->assertFalse(variable_get('statistics_count_content_views', 0), t('Count content view log is disabled by default.'));
$this->drupalGet('admin/reports/pages');
$this->assertRaw(t('No statistics available.'), t('Verifying text shown when no statistics is available.'));
// Enable access log and counter on content view.
$edit['statistics_enable_access_log'] = 1;
$edit['statistics_count_content_views'] = 1;
$this->drupalPost('admin/config/system/statistics', $edit, t('Save configuration'));
$this->assertTrue(variable_get('statistics_enable_access_log'), t('Access log is enabled.'));
$this->assertTrue(variable_get('statistics_count_content_views'), t('Count content view log is enabled.'));
// Hit the node.
$this->drupalGet('node/' . $this->test_node->nid);
$this->drupalGet('admin/reports/pages');
$this->assertText('node/1', t('Test node found.'));
// Hit the node again (the counter is incremented after the hit, so
// "1 read" will actually be shown when the node is hit the second time).
$this->drupalGet('node/' . $this->test_node->nid);
$this->assertText('1 read', t('Node is read once.'));
$this->drupalGet('node/' . $this->test_node->nid);
$this->assertText('2 reads', t('Node is read 2 times.'));
}
Login or register to post comments