public function SimpleTestTest::getTestResults in SimpleTest 8.3
Get the results from a test and store them in the class array $results.
1 call to SimpleTestTest::getTestResults()
- SimpleTestTest::testWebTestRunner in src/
Tests/ SimpleTestTest.php - Ensures the tests selected through the web interface are run and displayed.
File
- src/
Tests/ SimpleTestTest.php, line 324
Class
- SimpleTestTest
- Tests SimpleTest's web interface: check that the intended tests were run and ensure that test reports display the intended results. Also test SimpleTest's internal browser and APIs implicitly.
Namespace
Drupal\simpletest\TestsCode
public function getTestResults() {
$results = [];
if ($this
->parse()) {
if ($details = $this
->getResultFieldSet()) {
// Code assumes this is the only test in group.
$results['summary'] = $this
->asText($details->div->div[1]);
$results['name'] = $this
->asText($details->summary);
$results['assertions'] = [];
$tbody = $details->div->table->tbody;
foreach ($tbody->tr as $row) {
$assertion = [];
$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_url_transform_relative(file_create_url('core/misc/icons/73b355/check.svg'));
$assertion['status'] = $row->td[5]->img['src'] == $ok_url ? 'Pass' : 'Fail';
$results['assertions'][] = $assertion;
}
}
}
$this->childTestResults = $results;
}