diff --git a/core/lib/Drupal/Core/Test/JUnitConverter.php b/core/lib/Drupal/Core/Test/JUnitConverter.php index f539a3ffbe..db4f88b2cd 100644 --- a/core/lib/Drupal/Core/Test/JUnitConverter.php +++ b/core/lib/Drupal/Core/Test/JUnitConverter.php @@ -17,7 +17,7 @@ class JUnitConverter { * @param string $phpunit_xml_file * Path to the PHPUnit XML file. * - * @return array[] + * @return array[]|null * The results as array of rows in a format that can be inserted into * {simpletest}. */ @@ -27,9 +27,9 @@ public static function xmlToRows($test_id, $phpunit_xml_file) { return; } $records = []; - $testcases = static::findTestcases(new \SimpleXMLElement($contents)); - foreach ($testcases as $testcase) { - $records[] = static::testcaseToSimpletestRow($test_id, $testcase); + $test_cases = static::findTestCases(new \SimpleXMLElement($contents)); + foreach ($test_cases as $test_case) { + $records[] = static::convertTestCaseToSimpletestRow($test_id, $test_case); } return $records; } @@ -45,22 +45,22 @@ public static function xmlToRows($test_id, $phpunit_xml_file) { * @return array * A list of all test cases. */ - public static function findTestcases(\SimpleXMLElement $element, \SimpleXMLElement $parent = NULL) { - $testcases = []; + public static function findTestCases(\SimpleXMLElement $element, \SimpleXMLElement $parent = NULL) { + $test_cases = []; if (!isset($parent)) { $parent = $element; } if ($element->getName() === 'testcase' && (int) $parent->attributes()->tests > 0) { - // Add the class attribute if the testcase does not have one. This is the + // Add the class attribute if the test case does not have one. This is the // case for tests using a data provider. The name of the parent testsuite // will be in the format class::method. if (!$element->attributes()->class) { $name = explode('::', $parent->attributes()->name, 2); $element->addAttribute('class', $name[0]); } - $testcases[] = $element; + $test_cases[] = $element; } else { foreach ($element as $child) { @@ -68,10 +68,10 @@ public static function findTestcases(\SimpleXMLElement $element, \SimpleXMLEleme if ($file && !$child->attributes()->file) { $child->addAttribute('file', $file); } - $testcases = array_merge($testcases, simpletest_phpunit_find_testcases($child, $element)); + $test_cases = array_merge($test_cases, simpletest_phpunit_find_testcases($child, $element)); } } - return $testcases; + return $test_cases; } /** @@ -79,26 +79,26 @@ public static function findTestcases(\SimpleXMLElement $element, \SimpleXMLEleme * * @param int $test_id * The current test ID. - * @param \SimpleXMLElement $testcase + * @param \SimpleXMLElement $test_case * The PHPUnit test case represented as XML element. * * @return array * An array containing the {simpletest} result row. */ - public static function testcaseToSimpletestRow($test_id, \SimpleXMLElement $testcase) { + public static function convertTestCaseToSimpletestRow($test_id, \SimpleXMLElement $test_case) { $message = ''; $pass = TRUE; - if ($testcase->failure) { - $lines = explode("\n", $testcase->failure); + if ($test_case->failure) { + $lines = explode("\n", $test_case->failure); $message = $lines[2]; $pass = FALSE; } - if ($testcase->error) { - $message = $testcase->error; + if ($test_case->error) { + $message = $test_case->error; $pass = FALSE; } - $attributes = $testcase->attributes(); + $attributes = $test_case->attributes(); $record = [ 'test_id' => $test_id, diff --git a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php index 4a7c5054ed..5fd42fd729 100644 --- a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php @@ -76,7 +76,7 @@ public function __construct($app_root, $working_directory) { * @return string * Path to the PHPUnit XML file to use for the current $test_id. */ - public function xmlLogFilepath($test_id) { + public function xmlLogFilePath($test_id) { return $this->workingDirectory . '/phpunit-' . $test_id . '.xml'; } @@ -210,7 +210,7 @@ public function runCommand(array $unescaped_test_classnames, $phpunit_file, &$st * {simpletest}'s schema. */ public function runTests($test_id, array $unescaped_test_classnames, &$status = NULL) { - $phpunit_file = $this->xmlLogFilepath($test_id); + $phpunit_file = $this->xmlLogFilePath($test_id); // Store ouptut from our test run. $output = []; $this->runCommand($unescaped_test_classnames, $phpunit_file, $status, $output); diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index 0e56f0566f..35303b4e24 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -181,7 +181,7 @@ function simpletest_run_tests($test_list) { * The parsed results of PHPUnit's JUnit XML output, in the format of * {simpletest}'s schema. * - * @deprecated in Drupal 8.5.x, will be removed before 9.0.0. Use + * @deprecated in Drupal 8.6.x, will be removed before 9.0.0. Use * \Drupal\Core\Test\PhpUnitTestRunner::runTests(). */ function simpletest_run_phpunit_tests($test_id, array $unescaped_test_classnames, &$status = NULL) { @@ -260,12 +260,12 @@ function simpletest_summarize_phpunit_result($results) { * @return string * Path to the PHPUnit XML file to use for the current $test_id. * - * @deprecated in Drupal 8.5.x, will be removed before 9.0.0. Use + * @deprecated in Drupal 8.6.x, will be removed before 9.0.0. Use * \Drupal\Core\Test\PhpUnitTestRunner::xmlLogFilepath(). */ function simpletest_phpunit_xml_filepath($test_id) { $runner = PhpUnitTestRunner::create(\Drupal::getContainer()); - return $runner->xmlLogFilepath($test_id); + return $runner->xmlLogFilePath($test_id); } /** @@ -302,7 +302,7 @@ function simpletest_phpunit_configuration_filepath() { * @return string * The results as returned by exec(). * - * @deprecated in Drupal 8.5.x, will be removed before 9.0.0. Use + * @deprecated in Drupal 8.6.x, will be removed before 9.0.0. Use * \Drupal\Core\Test\PhpUnitTestRunner::runCommand(). */ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpunit_file, &$status = NULL, &$output = NULL) { @@ -316,7 +316,7 @@ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpun * @return string * The command that can be run through exec(). * - * @deprecated in Drupal 8.5.x, will be removed before 9.0.0. Use + * @deprecated in Drupal 8.6.x, will be removed before 9.0.0. Use * \Drupal\Core\Test\PhpUnitTestRunner::phpUnitCommand(). */ function simpletest_phpunit_command() { @@ -702,7 +702,7 @@ function simpletest_mail_alter(&$message) { * {simpletest}. If the phpunit_xml_file does not have any contents then the * function will return NULL. * - * @deprecated in Drupal 8.5.x, will be removed before 9.0.0. Use + * @deprecated in Drupal 8.6.x, will be removed before 9.0.0. Use * \Drupal\Core\Test\JUnitConverter::xmlToRows(). */ function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) { @@ -720,11 +720,11 @@ function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) { * @return array * A list of all test cases. * - * @deprecated in Drupal 8.5.x, will be removed before 9.0.0. Use + * @deprecated in Drupal 8.6.x, will be removed before 9.0.0. Use * \Drupal\Core\Test\JUnitConverter::findTestCases(). */ function simpletest_phpunit_find_testcases(\SimpleXMLElement $element, \SimpleXMLElement $parent = NULL) { - return JUnitConverter::findTestcases($element, $parent); + return JUnitConverter::findTestCases($element, $parent); } /** @@ -732,15 +732,15 @@ function simpletest_phpunit_find_testcases(\SimpleXMLElement $element, \SimpleXM * * @param int $test_id * The current test ID. - * @param \SimpleXMLElement $testcase + * @param \SimpleXMLElement $test_case * The PHPUnit test case represented as XML element. * * @return array * An array containing the {simpletest} result row. * - * @deprecated in Drupal 8.5.x, will be removed before 9.0.0. Use - * \Drupal\Core\Test\JUnitConverter::testcaseToSimpletestRow(). + * @deprecated in Drupal 8.6.x, will be removed before 9.0.0. Use + * \Drupal\Core\Test\JUnitConverter::convertTestCaseToSimpletestRow(). */ -function simpletest_phpunit_testcase_to_row($test_id, \SimpleXMLElement $testcase) { - return JUnitConverter::testcaseToSimpletestRow($test_id, $testcase); +function simpletest_phpunit_testcase_to_row($test_id, \SimpleXMLElement $test_case) { + return JUnitConverter::convertTestCaseToSimpletestRow($test_id, $test_case); }