function StatisticsProBaseTestCase::completeTestStatsHasTexts in Statistics Pro 6.2
Same name and namespace in other branches
- 6 tests/statspro.test \StatisticsProBaseTestCase::completeTestStatsHasTexts()
1 call to StatisticsProBaseTestCase::completeTestStatsHasTexts()
File
- tests/
statspro.test, line 209 - 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 ($period === FALSE) {
$edits = array();
$period_name = 'Period not changed';
}
elseif (is_numeric($period)) {
$edits = array(
'statspro_period' => 'custom_days',
'statspro_custom_number_days' => (int) $period,
);
$period_name = 'custom_days ' . (int) $period;
}
else {
$edits = array(
'statspro_period' => $period,
);
$period_name = (int) $period;
}
if ($use_post) {
$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_name,
)), $group);
}
foreach ($raws as $raw) {
$this
->assertRaw($raw, t("Raw text '@text' found in HTML for period '@period'.", array(
'@text' => $raw,
'@period' => $period_name,
)), $group);
}
}