function SimpleTestTest::getTestResults in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/Tests/SimpleTestTest.php \Drupal\simpletest\Tests\SimpleTestTest::getTestResults()
Get the results from a test and store them in the class array $results.
1 call to SimpleTestTest::getTestResults()
- SimpleTestTest::testWebTestRunner in core/
modules/ simpletest/ src/ Tests/ SimpleTestTest.php - Ensures the tests selected through the web interface are run and displayed.
File
- core/
modules/ simpletest/ src/ Tests/ SimpleTestTest.php, line 319 - Contains \Drupal\simpletest\Tests\SimpleTestTest.
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
function getTestResults() {
$results = array();
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'] = array();
$tbody = $details->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/icons/73b355/check.svg');
$assertion['status'] = $row->td[5]->img['src'] == $ok_url ? 'Pass' : 'Fail';
$results['assertions'][] = $assertion;
}
}
}
$this->childTestResults = $results;
}