diff --git a/core/lib/Drupal/Core/Test/JUnitConverter.php b/core/lib/Drupal/Core/Test/JUnitConverter.php index 65fdf165d2..01b36ef2ee 100644 --- a/core/lib/Drupal/Core/Test/JUnitConverter.php +++ b/core/lib/Drupal/Core/Test/JUnitConverter.php @@ -17,14 +17,14 @@ class JUnitConverter { * @param string $phpunit_xml_file * Path to the PHPUnit XML file. * - * @return array[]|null - * The results as array of rows in a format that can be inserted into - * {simpletest}. + * @return array[] + * The results as array of rows in a format that can be inserted into the + * {simpletest} table of the results database. */ public static function xmlToRows($test_id, $phpunit_xml_file) { $contents = @file_get_contents($phpunit_xml_file); if (!$contents) { - return; + return []; } $records = []; $test_cases = static::findTestCases(new \SimpleXMLElement($contents)); diff --git a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php index 5fd42fd729..983d5780d9 100644 --- a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php @@ -3,6 +3,7 @@ namespace Drupal\Core\Test; use Drupal\Core\Database\Database; +use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Tests\Listeners\SimpletestUiPrinter; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Process\PhpExecutableFinder; @@ -19,7 +20,7 @@ * $results = $runner->runTests($test_id, $test_list['phpunit']); * @endcode */ -class PhpUnitTestRunner { +class PhpUnitTestRunner implements ContainerInjectionInterface { /** * Path to the working directory. diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index fdb41962f7..1dc6529fc5 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -188,14 +188,14 @@ 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.6.x, will be removed before 9.0.0. Use - * \Drupal\Core\Test\PhpUnitTestRunner::runTests(). + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\Core\Test\PhpUnitTestRunner::runTests() instead. * * @see https://www.drupal.org/node/2948547 */ function simpletest_run_phpunit_tests($test_id, array $unescaped_test_classnames, &$status = NULL) { $runner = PhpUnitTestRunner::create(\Drupal::getContainer()); - @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\PhpUnitTestRunner::runTests() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED); + @trigger_error(__FUNCTION__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\PhpUnitTestRunner::runTests() instead. See https://www.drupal.org/node/2948547', E_USER_DEPRECATED); return $runner->runTests($test_id, $unescaped_test_classnames, $status); } @@ -270,14 +270,14 @@ 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.6.x, will be removed before 9.0.0. Use - * \Drupal\Core\Test\PhpUnitTestRunner::xmlLogFilepath(). + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\Core\Test\PhpUnitTestRunner::xmlLogFilepath() instead. * * @see https://www.drupal.org/node/2948547 */ function simpletest_phpunit_xml_filepath($test_id) { $runner = PhpUnitTestRunner::create(\Drupal::getContainer()); - @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\PhpUnitTestRunner::xmlLogFilepath() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED); + @trigger_error(__FUNCTION__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\PhpUnitTestRunner::xmlLogFilepath() instead. See https://www.drupal.org/node/2948547', E_USER_DEPRECATED); return $runner->xmlLogFilePath($test_id); } @@ -315,14 +315,14 @@ function simpletest_phpunit_configuration_filepath() { * @return string * The results as returned by exec(). * - * @deprecated in Drupal 8.6.x, will be removed before 9.0.0. Use - * \Drupal\Core\Test\PhpUnitTestRunner::runCommand(). + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\Core\Test\PhpUnitTestRunner::runCommand() instead. * * @see https://www.drupal.org/node/2948547 */ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpunit_file, &$status = NULL, &$output = NULL) { $runner = PhpUnitTestRunner::create(\Drupal::getContainer()); - @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\PhpUnitTestRunner::runCommand() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED); + @trigger_error(__FUNCTION__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\PhpUnitTestRunner::runCommand() instead. See https://www.drupal.org/node/2948547', E_USER_DEPRECATED); return $runner->runCommand($unescaped_test_classnames, $phpunit_file, $status, $output); } @@ -332,14 +332,14 @@ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpun * @return string * The command that can be run through exec(). * - * @deprecated in Drupal 8.6.x, will be removed before 9.0.0. Use - * \Drupal\Core\Test\PhpUnitTestRunner::phpUnitCommand(). + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\Core\Test\PhpUnitTestRunner::phpUnitCommand() instead. * * @see https://www.drupal.org/node/2948547 */ function simpletest_phpunit_command() { $runner = PhpUnitTestRunner::create(\Drupal::getContainer()); - @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\PhpUnitTestRunner::phpUnitCommand() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED); + @trigger_error(__FUNCTION__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\PhpUnitTestRunner::phpUnitCommand() instead. See https://www.drupal.org/node/2948547', E_USER_DEPRECATED); return $runner->phpUnitCommand(); } @@ -782,13 +782,13 @@ 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.6.x, will be removed before 9.0.0. Use - * \Drupal\Core\Test\JUnitConverter::xmlToRows(). + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\Core\Test\JUnitConverter::xmlToRows() instead. * * @see https://www.drupal.org/node/2948547 */ function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) { - @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\JUnitConverter::xmlToRows() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED); + @trigger_error(__FUNCTION__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\JUnitConverter::xmlToRows() instead. See https://www.drupal.org/node/2948547', E_USER_DEPRECATED); return JUnitConverter::xmlToRows($test_id, $phpunit_xml_file); } @@ -803,13 +803,13 @@ function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) { * @return array * A list of all test cases. * - * @deprecated in Drupal 8.6.x, will be removed before 9.0.0. Use - * \Drupal\Core\Test\JUnitConverter::findTestCases(). + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\Core\Test\JUnitConverter::findTestCases() instead. * * @see https://www.drupal.org/node/2948547 */ function simpletest_phpunit_find_testcases(\SimpleXMLElement $element, \SimpleXMLElement $parent = NULL) { - @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\JUnitConverter::findTestCases() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED); + @trigger_error(__FUNCTION__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\JUnitConverter::findTestCases() instead. See https://www.drupal.org/node/2948547', E_USER_DEPRECATED); return JUnitConverter::findTestCases($element, $parent); } @@ -824,12 +824,12 @@ function simpletest_phpunit_find_testcases(\SimpleXMLElement $element, \SimpleXM * @return array * An array containing the {simpletest} result row. * - * @deprecated in Drupal 8.6.x, will be removed before 9.0.0. Use - * \Drupal\Core\Test\JUnitConverter::convertTestCaseToSimpletestRow(). + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\Core\Test\JUnitConverter::convertTestCaseToSimpletestRow() instead. * * @see https://www.drupal.org/node/2948547 */ function simpletest_phpunit_testcase_to_row($test_id, \SimpleXMLElement $test_case) { - @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\JUnitConverter::convertTestCaseToSimpletestRow() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED); + @trigger_error(__FUNCTION__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\JUnitConverter::convertTestCaseToSimpletestRow() instead. See https://www.drupal.org/node/2948547', E_USER_DEPRECATED); return JUnitConverter::convertTestCaseToSimpletestRow($test_id, $test_case); } diff --git a/core/modules/simpletest/tests/src/Kernel/PhpUnitErrorTest.php b/core/modules/simpletest/tests/src/Kernel/PhpUnitErrorTest.php index 941f41e91e..700df282ae 100644 --- a/core/modules/simpletest/tests/src/Kernel/PhpUnitErrorTest.php +++ b/core/modules/simpletest/tests/src/Kernel/PhpUnitErrorTest.php @@ -22,7 +22,7 @@ class PhpUnitErrorTest extends KernelTestBase { /** * Test errors reported. * - * @expectedDeprecation simpletest_phpunit_xml_to_rows is deprecated. Use \Drupal\Core\Test\JUnitConverter::xmlToRows() instead. https://www.drupal.org/node/2948547 + * @expectedDeprecation simpletest_phpunit_xml_to_rows is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\JUnitConverter::xmlToRows() instead. See https://www.drupal.org/node/2948547 */ public function testPhpUnitXmlParsing() { $phpunit_error_xml = __DIR__ . '/../../fixtures/phpunit_error.xml'; diff --git a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php index 844b1107b2..4f90438d1d 100644 --- a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php +++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php @@ -106,8 +106,8 @@ public function provideStatusCodes() { * * @dataProvider provideStatusCodes * - * @expectedDeprecation simpletest_run_phpunit_tests is deprecated. Use \Drupal\Core\Test\PhpUnitTestRunner::runTests() instead. https://www.drupal.org/node/2948547 - * @expectedDeprecation simpletest_phpunit_xml_filepath is deprecated. Use \Drupal\Core\Test\PhpUnitTestRunner::xmlLogFilepath() instead. https://www.drupal.org/node/2948547 + * @expectedDeprecation simpletest_run_phpunit_tests is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\PhpUnitTestRunner::runTests() instead. See https://www.drupal.org/node/2948547 + * @expectedDeprecation simpletest_phpunit_xml_filepath is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\PhpUnitTestRunner::xmlLogFilepath() instead. See https://www.drupal.org/node/2948547 */ public function testSimpletestPhpUnitRunCommand($status, $label) { // Add a default database connection in order for