1 simpletest.test SimpleTestFunctionalTest::getTestResults()

Get the results from a test and store them in the class array $results.

File

core/modules/simpletest/tests/simpletest.test, line 247
Tests for simpletest.module.

Class

SimpleTestFunctionalTest

Code

function getTestResults() {
  $results = array();
  if ($this->parse()) {
    if ($fieldset = $this->getResultFieldSet()) {
      // Code assumes this is the only test in group.
      $results['summary'] = $this->asText($fieldset->div->div[1]);
      $results['name'] = $this->asText($fieldset->legend);

      $results['assertions'] = array();
      $tbody = $fieldset->div->table->tbody;
      foreach ($tbody->tr as $row) {
        $assertion = array();
        $assertion['message'] = $this->asText($row->td[0]);
        $assertion['type'] = $this->asText($row->td[1]);
        $assertion['file'] = $this->asText($row->td[2]);
        $assertion['line'] = $this->asText($row->td[3]);
        $assertion['function'] = $this->asText($row->td[4]);
        $ok_url = file_create_url('core/misc/watchdog-ok.png');
        $assertion['status'] = ($row->td[5]->img['src'] == $ok_url) ? 'Pass' : 'Fail';
        $results['assertions'][] = $assertion;
      }
    }
  }
  $this->childTestResults = $results;
}