You are here

function SimpleTestFunctionalTest::getTestResults in Drupal 7

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

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

File

modules/simpletest/simpletest.test, line 263
Tests for simpletest.module.

Class

SimpleTestFunctionalTest
@file Tests for simpletest.module.

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