Skip to content

Commit eb12bb3

Browse files
committed
use xpath instead of iteration through the dom
this should be independent of nested test-suits
1 parent 863227e commit eb12bb3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

functions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ function process_junit_xml( $xml_string )
104104
);
105105

106106
$results['testsuites'] = array();
107-
foreach ( $project->testsuite as $testsuite ) {
107+
108+
$testsuites = $xml->xpath( '//testsuites//testsuite[ ( @file ) and ( @errors > 0 or @failures > 0 ) ]' );
109+
foreach ( $testsuites as $testsuite ) {
108110
// Handle nested testsuites like tests with data providers.
109111
$testsuite = isset( $testsuite->testsuite ) ? $testsuite->testsuite : $testsuite;
110112
$result = array(

0 commit comments

Comments
 (0)