You are here

function StatisticsProBaseTestCase::createInitialData in Statistics Pro 6

Same name and namespace in other branches
  1. 6.2 tests/statspro.test \StatisticsProBaseTestCase::createInitialData()
3 calls to StatisticsProBaseTestCase::createInitialData()
StatisticsProTestCase::testMainTests in tests/statspro.test
StatsproTestCase::testInitialState in tests/statspro.test
StatsproTestCase::testPosNavegationState in tests/statspro.test

File

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

Class

StatisticsProBaseTestCase
Base class for Statistics Pro tests.

Code

function createInitialData() {
  $this->node_titles = array();
  $now = time();
  $this
    ->drupalLogin($this->users['create_1']);
  $title = t('Node !this/!total - now', array(
    '!this' => 1,
    '!total' => 1,
  ));
  $settings = array(
    'title' => $title,
  );
  $this
    ->createNode($settings);
  $title = t('Node !this/!total - yesterday', array(
    '!this' => 1,
    '!total' => 1,
  ));
  $settings['title'] = $title;
  $settings['created'] = $this
    ->getAddedDate($now, -1, 'd');
  $settings['changed'] = $settings['created'];
  $this
    ->createNode($settings);
  $title = t('Node !this/!total - last week', array(
    '!this' => 1,
    '!total' => 2,
  ));
  $settings['title'] = $title;
  $settings['created'] = $this
    ->getAddedDate($now, -1, 'w');
  $settings['changed'] = $settings['created'];
  $this
    ->createNode($settings);
  $title = t('Node !this/!total - last week', array(
    '!this' => 2,
    '!total' => 2,
  ));
  $settings['title'] = $title;
  $settings['created'] = $this
    ->getAddedDate($now, -5, 'd');
  $settings['changed'] = $settings['created'];
  $this
    ->createNode($settings);
  $title = t('Node !this/!total - last month', array(
    '!this' => 1,
    '!total' => 1,
  ));
  $settings['title'] = $title;
  $settings['created'] = $this
    ->getAddedDate($now, -15, 'd');
  $settings['changed'] = $settings['created'];
  $this
    ->createNode($settings);
  $title = t('Node !this/!total - last year', array(
    '!this' => 1,
    '!total' => 3,
  ));
  $settings['title'] = $title;
  $settings['created'] = $this
    ->getAddedDate($now, -45, 'd');
  $settings['changed'] = $settings['created'];
  $this
    ->createNode($settings);
  $title = t('Node !this/!total - last year', array(
    '!this' => 2,
    '!total' => 3,
  ));
  $settings['title'] = $title;
  $settings['created'] = $this
    ->getAddedDate($now, -315, 'd');
  $settings['changed'] = $settings['created'];
  $this
    ->createNode($settings);
  $title = t('Node !this/!total - last year', array(
    '!this' => 3,
    '!total' => 3,
  ));
  $settings['title'] = $title;
  $settings['created'] = $this
    ->getAddedDate($now, -183, 'd');
  $settings['changed'] = $settings['created'];
  $this
    ->createNode($settings);
}