X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fscripts%2Frun-tests.sh;fp=web%2Fcore%2Fscripts%2Frun-tests.sh;h=5ebf9f0c9fba0a8455a4519c547d40a44a9a4e83;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=4eea3cb6b7bd13def2ee496f11620c58b5500907;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/scripts/run-tests.sh b/web/core/scripts/run-tests.sh index 4eea3cb6b..5ebf9f0c9 100755 --- a/web/core/scripts/run-tests.sh +++ b/web/core/scripts/run-tests.sh @@ -17,6 +17,7 @@ use Drupal\Core\Test\TestRunnerKernel; use Drupal\simpletest\Form\SimpletestResultsForm; use Drupal\simpletest\TestBase; use Drupal\simpletest\TestDiscovery; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; $autoloader = require_once __DIR__ . '/../../autoload.php'; @@ -36,7 +37,7 @@ const SIMPLETEST_SCRIPT_EXIT_SUCCESS = 0; const SIMPLETEST_SCRIPT_EXIT_FAILURE = 1; const SIMPLETEST_SCRIPT_EXIT_EXCEPTION = 2; -if (!class_exists('\PHPUnit_Framework_TestCase')) { +if (!class_exists(TestCase::class)) { echo "\nrun-tests.sh requires the PHPUnit testing framework. Please use 'composer install --dev' to ensure that it is present.\n\n"; exit(SIMPLETEST_SCRIPT_EXIT_FAILURE); } @@ -304,6 +305,10 @@ All arguments are long options. --non-html Removes escaping from output. Useful for reading results on the CLI. + --suppress-deprecations + + Stops tests from failing if deprecation errors are triggered. + [,[, ...]] One or more tests to be run. By default, these are interpreted @@ -368,6 +373,7 @@ function simpletest_script_parse_args() { 'test_names' => array(), 'repeat' => 1, 'die-on-fail' => FALSE, + 'suppress-deprecations' => FALSE, 'browser' => FALSE, // Used internally. 'test-id' => 0, @@ -783,7 +789,13 @@ function simpletest_script_run_one_test($test_id, $test_class) { $methods = array(); } $test = new $class_name($test_id); - if (is_subclass_of($test_class, '\PHPUnit_Framework_TestCase')) { + if ($args['suppress-deprecations']) { + putenv('SYMFONY_DEPRECATIONS_HELPER=disabled'); + } + else { + putenv('SYMFONY_DEPRECATIONS_HELPER=strict'); + } + if (is_subclass_of($test_class, TestCase::class)) { $status = simpletest_script_run_phpunit($test_id, $test_class); } else { @@ -833,7 +845,7 @@ function simpletest_script_command($test_id, $test_class) { } $command .= ' --php ' . escapeshellarg($php); $command .= " --test-id $test_id"; - foreach (array('verbose', 'keep-results', 'color', 'die-on-fail') as $arg) { + foreach (array('verbose', 'keep-results', 'color', 'die-on-fail', 'suppress-deprecations') as $arg) { if ($args[$arg]) { $command .= ' --' . $arg; } @@ -865,7 +877,7 @@ function simpletest_script_command($test_id, $test_class) { * @see simpletest_script_run_one_test() */ function simpletest_script_cleanup($test_id, $test_class, $exitcode) { - if (is_subclass_of($test_class, '\PHPUnit_Framework_TestCase')) { + if (is_subclass_of($test_class, TestCase::class)) { // PHPUnit test, move on. return; } @@ -1020,7 +1032,7 @@ function simpletest_script_get_test_list() { else { foreach ($matches[1] as $class_name) { $namespace_class = $namespace . '\\' . $class_name; - if (is_subclass_of($namespace_class, '\Drupal\simpletest\TestBase') || is_subclass_of($namespace_class, '\PHPUnit_Framework_TestCase')) { + if (is_subclass_of($namespace_class, '\Drupal\simpletest\TestBase') || is_subclass_of($namespace_class, TestCase::class)) { $test_list[] = $namespace_class; } } @@ -1074,7 +1086,7 @@ function simpletest_script_get_test_list() { else { foreach ($matches[1] as $class_name) { $namespace_class = $namespace . '\\' . $class_name; - if (is_subclass_of($namespace_class, '\Drupal\simpletest\TestBase') || is_subclass_of($namespace_class, '\PHPUnit_Framework_TestCase')) { + if (is_subclass_of($namespace_class, '\Drupal\simpletest\TestBase') || is_subclass_of($namespace_class, TestCase::class)) { $test_list[] = $namespace_class; } }