function simpletest_phpunit_find_testcases

Find all testcases recursively from a testsuite list.

Parameters

array $suite: The list of testcases contained in the PHPUnit XML.

Return value

array A list of all testcases.

1 call to simpletest_phpunit_find_testcases()
simpletest_phpunit_xml_to_rows in drupal/core/modules/simpletest/simpletest.module
Converts phpunit's junit xml output to an array.

File

drupal/core/modules/simpletest/simpletest.module, line 776
Provides testing functionality.

Code

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;
    }
    elseif (isset($testcase->testcase) && (int) $testcase
      ->attributes()->tests > 0) {
      foreach ($testcase->testcase as $childtestcase) {
        $testcases[] = $childtestcase;
      }
    }
  }
  return $testcases;
}