You are here

protected function reportQuail_api::get_test_results in Quail API 7

Same name and namespace in other branches
  1. 8 includes/quail_api_reporters.inc \reportQuail_api::get_test_results()

Processes the results of a given test.

Parameters

$test_name: The severity of the test whose results are to be processed.

$test: An array containing the unprocessed test results associated with the given $test_name

1 call to reportQuail_api::get_test_results()
reportQuail_api::generate_report in includes/quail_api_reporters.inc
Generates a static list of possible accessibility problems detected.

File

includes/quail_api_reporters.inc, line 65
Contains quail reporter class objects for the quail api.

Class

reportQuail_api
An array reporter that generates a nested array of tests and report objects.

Code

protected function get_test_results($test_name, $test) {
  $severity = $this->guideline
    ->getSeverity($test_name);
  if (!isset($this->quail_api_report['total'])) {
    $this->quail_api_report['total'] = 0;
  }
  if (!isset($this->quail_api_report['report'][$severity])) {
    $this->quail_api_report['report'][$severity] = array(
      'total' => 0,
    );
  }
  if (!isset($this->quail_api_report['report'][$severity][$test_name])) {
    $this->quail_api_report['report'][$severity][$test_name] = array(
      'total' => 0,
    );
    $this->quail_api_report['report'][$severity][$test_name]['title'] = $this->translation[$test_name];

    // @todo: is there a cleaner & more efficient way to handle this?
    $this->quail_api_report['report'][$severity][$test_name]['body'] = $this->guideline
      ->getTranslation($test_name);
  }
  if (!property_exists($this, 'quail_api_total_problems')) {
    $this->quail_api_total_problems = 0;
  }
  if (is_array($test)) {
    foreach ($test as $problem_id => $problem) {
      if (is_object($problem)) {
        $this->quail_api_report['total']++;
        $this->quail_api_report['report'][$severity]['total']++;
        $this->quail_api_report['report'][$severity][$test_name]['total']++;
        $this
          ->get_test_results_array($severity, $test_name, $problem_id, $problem);
        $this->quail_api_total_problems++;
      }
    }
    if ($this->quail_api_report['report'][$severity][$test_name]['total'] == 0) {
      unset($this->quail_api_report['report'][$severity][$test_name]);
    }
  }
}