Upgrade bundled PHPUnit #60

Open
opened 2026-01-24 11:40:35 +01:00 by admin · 0 comments
Owner

Originally created by @cmb69 on GitHub (Nov 15, 2019).

The files in cache/util/PEAR/pear/PHPUnit are currently PHPUnit 3.6.11, DBUnit 1.2.0 and phpunit-mock-objects; so all pretty old versions, and the latter two projects are even abandoned, whereby the MockObjects have been bundled with PHPUnit in the meantime.

However, the bundled PHPUnit has been patched:

--- b/cache/util/PEAR/pear/PHPUnit/Framework/TestCase.php
+++ a/cache/util/PEAR/pear/PHPUnit/Framework/TestCase.php
@@ -484,6 +484,21 @@
         $this->expectedExceptionCode    = $exceptionCode;
         $this->expectedExceptionTrace   = debug_backtrace();
     }
+	
+	public function pftt_step1() {
+		$this->setUpBeforeClass();
+		$this->setExpectedExceptionFromAnnotation();
+        $this->setUp();
+        $this->checkRequirements();
+        $this->assertPreConditions();
+	}
+	public function pftt_step2() {
+		$this->verifyMockObjects();
+        $this->assertPostConditions();
+	}
+	public function pftt_step3() {
+        $this->tearDown();
+	}
 
     /**
      * @since  Method available since Release 3.4.0
@@ -766,7 +781,6 @@
     public function runBare()
     {
         $this->numAssertions = 0;
-
         // Backup the $GLOBALS array and static attributes.
         if ($this->runTestInSeparateProcess !== TRUE &&
             $this->inIsolation !== TRUE) {
@@ -786,17 +800,15 @@
         }
 
         // Start output buffering.
+        // TODO ob_start();
-        ob_start();
         $this->outputBufferingActive = TRUE;
 
         // Clean up stat cache.
         clearstatcache();
-
         try {
             if ($this->inIsolation) {
                 $this->setUpBeforeClass();
             }
-
             $this->setExpectedExceptionFromAnnotation();
             $this->setUp();
             $this->checkRequirements();
--- b/cache/util/PEAR/pear/PHPUnit/Util/PHP.php
+++ a/cache/util/PEAR/pear/PHPUnit/Util/PHP.php
@@ -115,7 +115,9 @@
                     PHP_BINDIR . '/php',
                     PHP_BINDIR . '/php-cli.exe',
                     PHP_BINDIR . '/php.exe',
+					/* -- begin PFTT -- */
+                    'C:\php-sdk\php-5.4-nts-windows-vc9-x86-r9fe8c58\php.exe',
+					/* -- end PFTT -- */
-                    '@php_bin@',
                 );
                 foreach ($possibleBinaryLocations as $binary) {
                     if (is_readable($binary)) {

Also cache/util/PEAR/phpunit(.bat) have been patched as well.

So we have to figure out the details of upgrading and possibly unbundling:

  • Are these patches necessary? How to do without them?
  • Is DBUnit actually used?
  • Which further adaptions would be needed to upgrade to some supported PHPUnit version?
  • Do we have to stick with a slightly older PHPUnit version, to be able to test the PHP 5.6 and 7.0 backports?
Originally created by @cmb69 on GitHub (Nov 15, 2019). The files in cache/util/PEAR/pear/PHPUnit are currently [PHPUnit 3.6.11](https://github.com/sebastianbergmann/phpunit/releases/tag/3.6.11), [DBUnit 1.2.0](https://github.com/sebastianbergmann/dbunit/releases/tag/1.2.0) and [phpunit-mock-objects](https://github.com/sebastianbergmann/phpunit-mock-objects/releases/tag/1.1.1); so all pretty old versions, and the latter two projects are even [abandoned](https://github.com/sebastianbergmann/dbunit/issues/217), whereby the MockObjects have been [bundled with PHPUnit](https://github.com/sebastianbergmann/phpunit-mock-objects/issues/425) in the meantime. However, the bundled PHPUnit has been patched: ````.diff --- b/cache/util/PEAR/pear/PHPUnit/Framework/TestCase.php +++ a/cache/util/PEAR/pear/PHPUnit/Framework/TestCase.php @@ -484,6 +484,21 @@ $this->expectedExceptionCode = $exceptionCode; $this->expectedExceptionTrace = debug_backtrace(); } + + public function pftt_step1() { + $this->setUpBeforeClass(); + $this->setExpectedExceptionFromAnnotation(); + $this->setUp(); + $this->checkRequirements(); + $this->assertPreConditions(); + } + public function pftt_step2() { + $this->verifyMockObjects(); + $this->assertPostConditions(); + } + public function pftt_step3() { + $this->tearDown(); + } /** * @since Method available since Release 3.4.0 @@ -766,7 +781,6 @@ public function runBare() { $this->numAssertions = 0; - // Backup the $GLOBALS array and static attributes. if ($this->runTestInSeparateProcess !== TRUE && $this->inIsolation !== TRUE) { @@ -786,17 +800,15 @@ } // Start output buffering. + // TODO ob_start(); - ob_start(); $this->outputBufferingActive = TRUE; // Clean up stat cache. clearstatcache(); - try { if ($this->inIsolation) { $this->setUpBeforeClass(); } - $this->setExpectedExceptionFromAnnotation(); $this->setUp(); $this->checkRequirements(); --- b/cache/util/PEAR/pear/PHPUnit/Util/PHP.php +++ a/cache/util/PEAR/pear/PHPUnit/Util/PHP.php @@ -115,7 +115,9 @@ PHP_BINDIR . '/php', PHP_BINDIR . '/php-cli.exe', PHP_BINDIR . '/php.exe', + /* -- begin PFTT -- */ + 'C:\php-sdk\php-5.4-nts-windows-vc9-x86-r9fe8c58\php.exe', + /* -- end PFTT -- */ - '@php_bin@', ); foreach ($possibleBinaryLocations as $binary) { if (is_readable($binary)) { ```` Also cache/util/PEAR/phpunit(.bat) have been patched as well. So we have to figure out the details of upgrading and possibly unbundling: * Are these patches necessary? How to do without them? * Is DBUnit actually used? * Which further adaptions would be needed to upgrade to some supported PHPUnit version? * Do we have to stick with a slightly older PHPUnit version, to be able to test the PHP 5.6 and 7.0 backports?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: php/pftt2#60