You are here

function StatsproTestCase::testInitialState in Statistics Pro 6.2

Same name and namespace in other branches
  1. 6 tests/statspro.test \StatsproTestCase::testInitialState()

File

tests/statspro.test, line 1101
Functionality tests for Statistics Pro.

Class

StatsproTestCase
Class resposible for testing the statspro class.

Code

function testInitialState() {
  $this
    ->createInitialData();
  $this
    ->callCron();
  $group = t('General statspro class tests');

  /**
   * Absolute amounts: pi, upi, error, uerror, warning and uwarning.
   */
  $this
    ->completeTestAggregatedData('pi', 0, $group);
  $this
    ->completeTestAggregatedData('upi', 0, $group);
  $this
    ->completeTestAggregatedData('error', 0, $group);
  $this
    ->completeTestAggregatedData('uerror', 0, $group);
  $this
    ->completeTestAggregatedData('warning', 0, $group);
  $this
    ->completeTestAggregatedData('uwarning', 0, $group);
  $this
    ->completeTestAggregatedData('emergency', 0, $group);
  $this
    ->completeTestAggregatedData('uemergency', 0, $group);
  $this
    ->completeTestAggregatedData('alert', 0, $group);
  $this
    ->completeTestAggregatedData('ualert', 0, $group);
  $this
    ->completeTestAggregatedData('critical', 0, $group);
  $this
    ->completeTestAggregatedData('ucritical', 0, $group);

  /**
   * Non-absolute amounts: users, terms, nodes, node_types, comments,
   * aliases, sessions and modules.
   */

  /**
   * Drupal already creates the "zero" user which is tne non-authenticated
   * user and saves the slot for the admin user so we have to add 2 to the
   * number of users we created up until now in the test.
   */
  $correct = 2 + count($this->users);
  $this
    ->completeTestAggregatedData('users', $correct, $group);
  $this
    ->completeTestAggregatedData('terms', 0, $group);
  $correct = count($this->node_titles);
  $this
    ->completeTestAggregatedData('nodes', $correct, $group);

  // Drupal already has 2 node types defined: page and story.
  $correct = 2;
  $this
    ->completeTestAggregatedData('node_types', $correct, $group);
  $this
    ->completeTestAggregatedData('comments', 0, $group);
  $this
    ->completeTestAggregatedData('aliases', 0, $group);
  $this
    ->completeTestAggregatedData('sessions', 1, $group);

  // The basic Drupal installation already has 11 modules enabled.
  $correct = 11 + count($this->modules);
  $this
    ->completeTestAggregatedData('modules', $correct, $group);
}