From c9a047d7c039369ce873d9ddc7b81d243398cb87 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Fri, 5 Oct 2018 17:49:47 -0700 Subject: [PATCH] Port PHPUnit fixes to 9.x (#3117) * Allow PHPUnit to bootstrap from core. (#3071) * Use core's PHPUnit bootstrap file. (#3092) * Remove support for PHPUnit 5. (#3102) --- composer.json | 2 +- config/build.yml | 1 + scripts/phpunit/bootstrap.php | 33 ---------------------- src/Robo/Commands/Tests/PhpUnitCommand.php | 8 ------ template/tests/phpunit/phpunit.xml | 6 ---- tests/phpunit/bootstrap.php | 3 -- 6 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 scripts/phpunit/bootstrap.php delete mode 100644 template/tests/phpunit/phpunit.xml diff --git a/composer.json b/composer.json index 5bfe1bbca..4c2f3b0c8 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "grasmash/yaml-cli": "^1.0.0", "grasmash/yaml-expander": "^1.2.0", "oomphinc/composer-installers-extender": "^1.1", - "phpunit/phpunit": "^4.8|^5.7|^6.5", + "phpunit/phpunit": "^4.8|^6.5", "squizlabs/php_codesniffer": "^2.7", "symfony/console": "^3.4.0", "symfony/twig-bridge": "^3.3", diff --git a/config/build.yml b/config/build.yml index 42497aed2..87833d5c1 100644 --- a/config/build.yml +++ b/config/build.yml @@ -122,6 +122,7 @@ phpcbf: # @todo Move to subkey of tests. phpunit: - path: '${repo.root}/tests/phpunit' + config: '${docroot}/core/phpunit.xml.dist' # Customization for one or more custom phpunit test locations # and if the core (or custom) config file should be included as a -c parameter. # - path: '${docroot}/modules/custom/' diff --git a/scripts/phpunit/bootstrap.php b/scripts/phpunit/bootstrap.php deleted file mode 100644 index 8a92113ad..000000000 --- a/scripts/phpunit/bootstrap.php +++ /dev/null @@ -1,33 +0,0 @@ -=')) { - class_alias('\PHPUnit\Framework\AssertionFailedError', '\PHPUnit_Framework_AssertionFailedError'); - class_alias('\PHPUnit\Framework\Constraint\Count', '\PHPUnit_Framework_Constraint_Count'); - class_alias('\PHPUnit\Framework\Error\Error', '\PHPUnit_Framework_Error'); - class_alias('\PHPUnit\Framework\Error\Warning', '\PHPUnit_Framework_Error_Warning'); - class_alias('\PHPUnit\Framework\ExpectationFailedException', '\PHPUnit_Framework_ExpectationFailedException'); - class_alias('\PHPUnit\Framework\Exception', '\PHPUnit_Framework_Exception'); - class_alias('\PHPUnit\Framework\MockObject\Matcher\InvokedRecorder', '\PHPUnit_Framework_MockObject_Matcher_InvokedRecorder'); - class_alias('\PHPUnit\Framework\SkippedTestError', '\PHPUnit_Framework_SkippedTestError'); - class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase'); - class_alias('\PHPUnit\Util\Test', '\PHPUnit_Util_Test'); - class_alias('\PHPUnit\Util\Xml', '\PHPUnit_Util_XML'); -} diff --git a/src/Robo/Commands/Tests/PhpUnitCommand.php b/src/Robo/Commands/Tests/PhpUnitCommand.php index 48bdad9ed..50a7f8067 100644 --- a/src/Robo/Commands/Tests/PhpUnitCommand.php +++ b/src/Robo/Commands/Tests/PhpUnitCommand.php @@ -18,12 +18,6 @@ class PhpUnitCommand extends BltTasks { * @var string*/ protected $reportsDir; - /** - * The bootstrap filename. - * - * @var string*/ - protected $bootstrapFile; - /** * The filename for PHPUnit report. * @@ -47,7 +41,6 @@ public function initialize() { $this->reportFile = $this->reportsDir . '/results.xml'; $this->testsDir = $this->getConfigValue('repo.root') . '/tests/phpunit'; $this->phpunitConfig = $this->getConfigValue('phpunit'); - $this->bootstrapFile = $this->getConfigValue('blt.root') . '/scripts/phpunit/bootstrap.php'; } /** @@ -60,7 +53,6 @@ public function testsPhpUnit() { $this->createLogs(); foreach ($this->phpunitConfig as $test) { $task = $this->taskPHPUnit() - ->bootstrap($this->bootstrapFile) ->xml($this->reportFile) ->printOutput(TRUE) ->printMetadata(FALSE); diff --git a/template/tests/phpunit/phpunit.xml b/template/tests/phpunit/phpunit.xml deleted file mode 100644 index e47644c3d..000000000 --- a/template/tests/phpunit/phpunit.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index e3299d018..075596e39 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -4,9 +4,6 @@ * @file */ -// Alias PHPUnit classes for backwards compatibility. -include '../../scripts/phpunit/bootstrap.php'; - use Acquia\Blt\Tests\SandboxManager; $sandbox_manager = new SandboxManager();