diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index 82d5faf..8cf5623 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -756,7 +756,7 @@ function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) { $records = array(); foreach ($xml->testsuite as $testsuite) { foreach ($testsuite as $suite) { - // The file element won't be on testcase objects created with + // The file element won't be on testcase objects created with // @dataProvider, so just use the one from the test suite at this level // because it should be the same. $file = (string)$suite->attributes()->file; @@ -770,10 +770,21 @@ function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) { return $records; } -function simpletest_phpunit_find_testcases($testsuite) { +/** + * Find all testcases recursively from a testsuite list. + * + * @param array $suite + * The list of testcases contained in the PHPUnit XML. + * + * @return array + * A list of all testcases. + */ +function simpletest_phpunit_find_testcases($suite) { $testcases = array(); foreach ($suite as $testcase) { + // Beside from being 'testcases', it could be also a group of testcases. + // This happens if you use a data provider in the phpunit tests. if ($testcase->getName() === 'testcase') { $testcases[] = $testcase; } @@ -786,7 +797,19 @@ function simpletest_phpunit_find_testcases($testsuite) { return $testcases; } -function simpletest_phpunit_testcase_to_row($test_id, $testcase, $file) { +/** + * Converts a PHPUnit testcase result to a simpletest result row. + * + * @param int $test_id + * The current test ID. + * @param \SimpleXMLElement $testcase + * The PHPUnit testcase represented as xml element. + * @param string $file + * The path to test file, which was executed. + * @return array + * An array containg the simpletest result row. + */ +function simpletest_phpunit_testcase_to_row($test_id, \SimpleXMLElement $testcase, $file) { $message = ''; $pass = TRUE; if ($testcase->failure) {