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';
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);
}
--non-html Removes escaping from output. Useful for reading results on the
CLI.
+ --suppress-deprecations
+
+ Stops tests from failing if deprecation errors are triggered.
+
<test1>[,<test2>[,<test3> ...]]
One or more tests to be run. By default, these are interpreted
'test_names' => array(),
'repeat' => 1,
'die-on-fail' => FALSE,
+ 'suppress-deprecations' => FALSE,
'browser' => FALSE,
// Used internally.
'test-id' => 0,
$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 {
}
$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;
}
* @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;
}
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;
}
}
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;
}
}