You are here

function StatisticsAdvancedTestCase::testInvalidNodeCounter in Statistics Advanced 6

Test that an invalid nodes will not cause a record to be added to the node_counter table.

File

./statistics_advanced.test, line 77
Unit tests for the statistics_advanced module.

Class

StatisticsAdvancedTestCase
Test basic statistics advanced functionality.

Code

function testInvalidNodeCounter() {

  // Remove 'access content' for anonymous users.
  db_query("DELETE FROM {permission} WHERE rid = %d", DRUPAL_ANONYMOUS_RID);

  // Create a node.
  $valid_node = $this
    ->drupalCreateNode();

  // Attempt to access an invalid node. Should get a 404 response.
  $this
    ->assertNodeCount(666, 0);
  $this
    ->assertResponse(404);

  // Attempt to access a node without access. Should get a 403 response.
  $this
    ->assertNodeCount($valid_node->nid, 0);
  $this
    ->assertResponse(403);
}