You are here

function SimpleTestFunctionalTest::getTestResults in SimpleTest 7

Same name and namespace in other branches
  1. 6.2 simpletest.test \SimpleTestFunctionalTest::getTestResults()
  2. 7.2 simpletest.test \SimpleTestFunctionalTest::getTestResults()

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

1 call to SimpleTestFunctionalTest::getTestResults()
SimpleTestFunctionalTest::testWebTestRunner in ./simpletest.test
Make sure that tests selected through the web interface are run and that the results are displayed correctly.

File

./simpletest.test, line 205

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[1]);
      $results['name'] = $this
        ->asText($fieldset->legend);
      $results['assertions'] = array();
      $tbody = $fieldset->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('misc/watchdog-ok.png');
        $assertion['status'] = $row->td[5]->img['src'] == $ok_url ? 'Pass' : 'Fail';
        $results['assertions'][] = $assertion;
      }
    }
  }
  $this->childTestResults = $results;
}