You are here

function StatisticsProBaseTestCase::completeTestStatsHasTexts in Statistics Pro 6

Same name and namespace in other branches
  1. 6.2 tests/statspro.test \StatisticsProBaseTestCase::completeTestStatsHasTexts()
1 call to StatisticsProBaseTestCase::completeTestStatsHasTexts()
StatisticsProTestCase::testMainTests in tests/statspro.test

File

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

Class

StatisticsProBaseTestCase
Base class for Statistics Pro tests.

Code

function completeTestStatsHasTexts($texts, $raws, $period = FALSE, $group = '', $url = FALSE, $use_post = TRUE) {
  if (!$url) {
    $url = 'admin/reports/statspro';
  }
  if ($use_post) {
    if ($period) {
      $edits = array(
        'statspro_period' => $period,
      );
    }
    else {
      $edits = array();
    }
    $submit = t('Save configuration');
    $page = $this
      ->drupalPost($url, $edits, $submit);
  }
  else {
    $page = $this
      ->drupalGet($url);
  }
  $this
    ->verbose(var_export($page, TRUE));
  foreach ($texts as $text) {
    $this
      ->assertText($text, t("Text '@text' found for period '@period'.", array(
      '@text' => $text,
      '@period' => $period ? $period : t('Period not changed'),
    )), $group);
  }
  foreach ($raws as $raw) {
    $this
      ->assertRaw($raw, t("Raw text '@text' found in HTML for period '@period'.", array(
      '@text' => $raw,
      '@period' => $period ? $period : t('Period not changed'),
    )), $group);
  }
}