function JUnitConverter::findTestCases

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Test/JUnitConverter.php \Drupal\Core\Test\JUnitConverter::findTestCases()
  2. 10 core/lib/Drupal/Core/Test/JUnitConverter.php \Drupal\Core\Test\JUnitConverter::findTestCases()
  3. 9 core/lib/Drupal/Core/Test/JUnitConverter.php \Drupal\Core\Test\JUnitConverter::findTestCases()
  4. 8.9.x core/lib/Drupal/Core/Test/JUnitConverter.php \Drupal\Core\Test\JUnitConverter::findTestCases()

Finds all test cases recursively from a test suite list.

@internal

Parameters

\SimpleXMLElement $element: The PHPUnit xml to search for test cases.

\SimpleXMLElement $parent: (Optional) The parent of the current element. Defaults to NULL.

Return value

array A list of all test cases.

1 call to JUnitConverter::findTestCases()
JUnitConverter::xmlElementToRows in core/lib/Drupal/Core/Test/JUnitConverter.php
Parse test cases from XML to {simpletest} schema.

File

core/lib/Drupal/Core/Test/JUnitConverter.php, line 74

Class

JUnitConverter
Converts JUnit XML to Drupal's {simpletest} schema.

Namespace

Drupal\Core\Test

Code

public static function findTestCases(\SimpleXMLElement $element, ?\SimpleXMLElement $parent = NULL) : array {
  if ($element->getName() === 'testcase') {
    return [
      $element,
    ];
  }
  $test_cases = [];
  foreach ($element as $child) {
    $test_cases[] = static::findTestCases($child, $element);
  }
  return array_merge(...$test_cases);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.