Skip to content

Support PHPUnit 9.2.6 (via copypasta) #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed

Support PHPUnit 9.2.6 (via copypasta) #9

wants to merge 8 commits into from

Conversation

mfn
Copy link

@mfn mfn commented Aug 3, 2020

Same tragedy as #8 but tried to separate the absolute minimum changes to phpunit sources and kept the original library files as much as possible

Couldn't resist to use github actions, apologies. It's so much more convenient.

This is the commit showing the minimal changes to the official files => 27ad279

diff --git a/src/Vendor/PHPUnit/TextUI/Command.php b/src/Vendor/PHPUnit/TextUI/Command.php
index 9e5fb7d..b6bf800 100644
--- a/src/Vendor/PHPUnit/TextUI/Command.php
+++ b/src/Vendor/PHPUnit/TextUI/Command.php
@@ -7,7 +7,7 @@
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
  */
-namespace PHPUnit\TextUI;
+namespace Wizaplace\PHPUnit\Slicer\Vendor\PHPUnit\TextUI;
 
 use PharIo\Manifest\ApplicationName;
 use PharIo\Manifest\Exception as ManifestException;
@@ -26,6 +26,7 @@
 use PHPUnit\TextUI\Configuration\PhpHandler;
 use PHPUnit\TextUI\Configuration\Registry;
 use PHPUnit\TextUI\Configuration\TestSuiteMapper;
+use PHPUnit\TextUI\Help;
 use PHPUnit\Util\FileLoader;
 use PHPUnit\Util\Filesystem;
 use PHPUnit\Util\Printer;
@@ -127,7 +128,7 @@ public function run(array $argv, bool $exit = true): int
     /**
      * Create a TestRunner, override in subclasses.
      */
-    protected function createRunner(): TestRunner
+    protected function createRunner()
     {
         return new TestRunner($this->arguments['loader']);
     }
diff --git a/src/Vendor/PHPUnit/TextUI/TestRunner.php b/src/Vendor/PHPUnit/TextUI/TestRunner.php
index 8db607e..8c7d8ea 100644
--- a/src/Vendor/PHPUnit/TextUI/TestRunner.php
+++ b/src/Vendor/PHPUnit/TextUI/TestRunner.php
@@ -7,7 +7,7 @@
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
  */
-namespace PHPUnit\TextUI;
+namespace Wizaplace\PHPUnit\Slicer\Vendor\PHPUnit\TextUI;
 
 use PHPUnit\Framework\Exception;
 use PHPUnit\Framework\TestResult;
@@ -33,6 +33,8 @@
 use PHPUnit\TextUI\Configuration\ExtensionHandler;
 use PHPUnit\TextUI\Configuration\PhpHandler;
 use PHPUnit\TextUI\Configuration\Registry;
+use PHPUnit\TextUI\DefaultResultPrinter;
+use PHPUnit\TextUI\ResultPrinter;
 use PHPUnit\Util\Filesystem;
 use PHPUnit\Util\Log\JUnit;
 use PHPUnit\Util\Log\TeamCity;
@@ -59,7 +61,7 @@
 /**
  * @internal This class is not covered by the backward compatibility promise for PHPUnit
  */
-final class TestRunner extends BaseTestRunner
+class TestRunner extends BaseTestRunner
 {
     public const SUCCESS_EXIT = 0;
 
@@ -853,7 +855,7 @@ private function write(string $buffer): void
     /**
      * @throws Exception
      */
-    private function handleConfiguration(array &$arguments): void
+    protected function handleConfiguration(array &$arguments): void
     {
         if (isset($arguments['configuration']) &&
             !$arguments['configuration'] instanceof Configuration) {

See my repo for successful GHA run => https://github.com/mfn/phpunit-slicer/actions

@mfn
Copy link
Author

mfn commented Sep 7, 2020

Closing as it's unlikely this gets merged, doesn't make much sense.

On top of that, in PHPUnit the classes changed again.

The diffs as outlined in the PR description did not really change, the high level changes are still the same:

  • copy PHPUnit/TextUI/Command.php
  • copy PHPUnit/TextUI/TestRunner.php
  • adjust namespace
  • add missing imports
  • apply the patches
  • done

I just did it in a private codebase for PHPUnit 9.3 all over again (too 5mins, still 😢 )

@mfn mfn closed this Sep 7, 2020
@mfn mfn deleted the mfn-copypasta branch September 7, 2020 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant