Commit bed931bb authored by alexpott's avatar alexpott

Issue #3008870 by amateescu, kostyashupenko, mondrake, jibran, alexpott: Drop...

Issue #3008870 by amateescu, kostyashupenko, mondrake, jibran, alexpott: Drop support for PHPUnit 4.8 once PHP 5 is no longer supported (8.8.x)
parent 43cb1b5c
......@@ -52,8 +52,6 @@
"post-autoload-dump": "Drupal\\Core\\Composer\\Composer::ensureHtaccess",
"post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
"post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
"drupal-phpunit-upgrade-check": "Drupal\\Core\\Composer\\Composer::upgradePHPUnit",
"drupal-phpunit-upgrade": "@composer update phpunit/phpunit phpspec/prophecy symfony/yaml --with-dependencies --no-progress",
"phpcs": "phpcs --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --",
"phpcbf": "phpcbf --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --"
},
......
This diff is collapsed.
......@@ -60,7 +60,7 @@
"jcalderonzumba/gastonjs": "^1.0.2",
"jcalderonzumba/mink-phantomjs-driver": "^0.3.1",
"mikey179/vfsstream": "^1.2",
"phpunit/phpunit": "^4.8.35 || ^6.5",
"phpunit/phpunit": "^6.5",
"phpspec/prophecy": "^1.7",
"symfony/css-selector": "^3.4.0",
"symfony/phpunit-bridge": "^3.4.3",
......
......@@ -149,48 +149,6 @@ public static function ensureHtaccess(Event $event) {
}
}
/**
* Fires the drupal-phpunit-upgrade script event if necessary.
*
* @param \Composer\Script\Event $event
*/
public static function upgradePHPUnit(Event $event) {
$repository = $event->getComposer()->getRepositoryManager()->getLocalRepository();
// This is, essentially, a null constraint. We only care whether the package
// is present in the vendor directory yet, but findPackage() requires it.
$constraint = new Constraint('>', '');
$phpunit_package = $repository->findPackage('phpunit/phpunit', $constraint);
if (!$phpunit_package) {
// There is nothing to do. The user is probably installing using the
// --no-dev flag.
return;
}
// If the PHP version is 7.0 or above and PHPUnit is less than version 6
// call the drupal-phpunit-upgrade script to upgrade PHPUnit.
if (!static::upgradePHPUnitCheck($phpunit_package->getVersion())) {
$event->getComposer()
->getEventDispatcher()
->dispatchScript('drupal-phpunit-upgrade');
}
}
/**
* Determines if PHPUnit needs to be upgraded.
*
* This method is located in this file because it is possible that it is
* called before the autoloader is available.
*
* @param string $phpunit_version
* The PHPUnit version string.
*
* @return bool
* TRUE if the PHPUnit needs to be upgraded, FALSE if not.
*/
public static function upgradePHPUnitCheck($phpunit_version) {
return !(version_compare(PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION, '7.0') >= 0 && version_compare($phpunit_version, '6.1') < 0);
}
/**
* Remove possibly problematic test files from vendored projects.
*
......
......@@ -9,7 +9,6 @@
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Timer;
use Drupal\Component\Uuid\Php;
use Drupal\Core\Composer\Composer;
use Drupal\Core\Asset\AttachedAssets;
use Drupal\Core\Database\Database;
use Drupal\Core\File\Exception\FileException;
......@@ -148,10 +147,6 @@
else {
$phpunit_version = Version::id();
}
if (!Composer::upgradePHPUnitCheck($phpunit_version)) {
simpletest_script_print_error("PHPUnit testing framework version 6 or greater is required when running on PHP 7.0 or greater. Run the command 'composer run-script drupal-phpunit-upgrade' in order to fix this.");
exit(SIMPLETEST_SCRIPT_EXIT_FAILURE);
}
$test_list = simpletest_script_get_test_list();
......
......@@ -8,7 +8,6 @@
*/
use Drupal\Component\Assertion\Handle;
use Drupal\Core\Composer\Composer;
use PHPUnit\Runner\Version;
/**
......@@ -159,11 +158,6 @@ function drupal_phpunit_populate_class_loader() {
else {
$phpunit_version = Version::id();
}
if (!Composer::upgradePHPUnitCheck($phpunit_version)) {
$message = "PHPUnit testing framework version 6 or greater is required when running on PHP 7.0 or greater. Run the command 'composer run-script drupal-phpunit-upgrade' in order to fix this.";
echo "\033[31m" . $message . "\n\033[0m";
exit(1);
}
// Set sane locale settings, to ensure consistent string, dates, times and
// numbers handling.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment