function StatisticsAdminTestCase::testDeleteNode
Tests that when a node is deleted, the node counter is deleted too.
File
-
modules/
statistics/ statistics.test, line 379
Class
- StatisticsAdminTestCase
- Tests the statistics administration screen.
Code
function testDeleteNode() {
variable_set('statistics_count_content_views', 1);
$this->drupalGet('node/' . $this->test_node->nid);
$result = db_select('node_counter', 'n')->fields('n', array(
'nid',
))
->condition('n.nid', $this->test_node->nid)
->execute()
->fetchAssoc();
$this->assertEqual($result['nid'], $this->test_node->nid, 'Verifying that the node counter is incremented.');
node_delete($this->test_node->nid);
$result = db_select('node_counter', 'n')->fields('n', array(
'nid',
))
->condition('n.nid', $this->test_node->nid)
->execute()
->fetchAssoc();
$this->assertFalse($result, 'Verifying that the node counter is deleted.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.