/** * Add testcases to the provided TestSuite from the XML node * * @param TestSuite $testSuite * @param \SimpleXMLElement $xml */ public function addTestCase(TestSuite $testSuite, \SimpleXMLElement $xml) { foreach ($xml->xpath('./testcase') as $element) { $testcase = new TestCase((string) $element['name'], (int) $element['assertions'], (double) $element['time'], (string) $element['class'], (string) $element['file'], (int) $element['line']); if ($element->error) { $testcase->setError(new TestError((string) $element->error[0]->attributes()->type, (string) $element->error[0])); } if ($element->failure) { $testcase->setFailure(new TestFailure((string) $element->failure[0]->attributes()->type, (string) $element->failure[0])); } $testSuite->addTestCase($testcase); } }