You are here

protected function reportQuail_api::get_test_results in Quail API 8

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

Processes the results of a given test.

Parameters

$quail_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 $quail_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 61
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($quail_test_name, $test) {
  $severity = $this->guideline
    ->getSeverity($quail_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][$quail_test_name])) {
    $this->quail_api_report['report'][$severity][$quail_test_name] = array(
      'total' => 0,
    );
    $this->quail_api_report['report'][$severity][$quail_test_name]['title'] = $this->translation[$quail_test_name];
    $this->quail_api_report['report'][$severity][$quail_test_name]['body'] = $this->guideline
      ->getTranslation($quail_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][$quail_test_name]['total']++;
        $this
          ->get_test_results_array($severity, $quail_test_name, $problem_id, $problem);
        $this->quail_api_total_problems++;
      }
    }
    if ($this->quail_api_report['report'][$severity][$quail_test_name]['total'] == 0) {
      unset($this->quail_api_report['report'][$severity][$quail_test_name]);
    }
  }
}