From ea26c45976301818bf48f53e1e3b085599d3f42f Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Tue, 14 Nov 2017 15:47:40 +0100 Subject: [PATCH 1/4] Revert "Changing method-local, static variable to private, dynamic" This reverts commit 4730e9fba7b00b8b5f4636aa31be53821453a6e3. --- src/Framework/TestSuite.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Framework/TestSuite.php b/src/Framework/TestSuite.php index 890432ff843..0e42784f7d2 100644 --- a/src/Framework/TestSuite.php +++ b/src/Framework/TestSuite.php @@ -87,11 +87,6 @@ class PHPUnit_Framework_TestSuite implements PHPUnit_Framework_Test, PHPUnit_Fra */ private $iteratorFilter = null; - /** - * @var array - */ - private $declaredClasses; - /** * Constructs a new TestSuite: * @@ -116,8 +111,6 @@ class PHPUnit_Framework_TestSuite implements PHPUnit_Framework_Test, PHPUnit_Fra */ public function __construct($theClass = '', $name = '') { - $this->declaredClasses = get_declared_classes(); - $argumentsValid = false; if (is_object($theClass) && @@ -299,6 +292,12 @@ public function addTestSuite($testClass) */ public function addTestFile($filename) { + static $declaredClasses; + + if ($declaredClasses === null) { + $declaredClasses = get_declared_classes(); + } + if (!is_string($filename)) { throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); } @@ -314,7 +313,7 @@ public function addTestFile($filename) // The given file may contain further stub classes in addition to the // test class itself. Figure out the actual test class. $filename = PHPUnit_Util_Fileloader::checkAndLoad($filename); - $newClasses = array_diff(get_declared_classes(), $this->declaredClasses); + $newClasses = array_diff(get_declared_classes(), $declaredClasses); // The diff is empty in case a parent class (with test methods) is added // AFTER a child class that inherited from it. To account for that case, @@ -325,7 +324,7 @@ public function addTestFile($filename) // process discovered classes in approximate LIFO order, so as to // avoid unnecessary reflection. $this->foundClasses = array_merge($newClasses, $this->foundClasses); - $this->declaredClasses = get_declared_classes(); + $declaredClasses = get_declared_classes(); } // The test class's name must match the filename, either in full, or as From 8f9ec3609e190eac8a12ffc8bfaa4856779f1a0c Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Tue, 14 Nov 2017 15:47:43 +0100 Subject: [PATCH 2/4] Revert "Fix for declaring test case in data provider" This reverts commit 096049b60a05fdb71bae17a4a267f29dc0975ec1. --- src/Framework/TestSuite.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Framework/TestSuite.php b/src/Framework/TestSuite.php index 0e42784f7d2..6d5a3df9614 100644 --- a/src/Framework/TestSuite.php +++ b/src/Framework/TestSuite.php @@ -292,12 +292,6 @@ public function addTestSuite($testClass) */ public function addTestFile($filename) { - static $declaredClasses; - - if ($declaredClasses === null) { - $declaredClasses = get_declared_classes(); - } - if (!is_string($filename)) { throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); } @@ -312,8 +306,9 @@ public function addTestFile($filename) // The given file may contain further stub classes in addition to the // test class itself. Figure out the actual test class. + $classes = get_declared_classes(); $filename = PHPUnit_Util_Fileloader::checkAndLoad($filename); - $newClasses = array_diff(get_declared_classes(), $declaredClasses); + $newClasses = array_diff(get_declared_classes(), $classes); // The diff is empty in case a parent class (with test methods) is added // AFTER a child class that inherited from it. To account for that case, @@ -324,7 +319,6 @@ public function addTestFile($filename) // process discovered classes in approximate LIFO order, so as to // avoid unnecessary reflection. $this->foundClasses = array_merge($newClasses, $this->foundClasses); - $declaredClasses = get_declared_classes(); } // The test class's name must match the filename, either in full, or as From 19937bc99331e12340324df9657a47ebcb4ea258 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Tue, 14 Nov 2017 15:47:44 +0100 Subject: [PATCH 3/4] Revert "Test for data provider declaring class" This reverts commit 7e8e2625c289a63285625dcdd657b824797a3717. --- tests/TextUI/dataprovider-pair.phpt | 17 --------------- tests/_files/DataProviderPair/FirstTest.php | 23 -------------------- tests/_files/DataProviderPair/SecondTest.php | 15 ------------- 3 files changed, 55 deletions(-) delete mode 100644 tests/TextUI/dataprovider-pair.phpt delete mode 100644 tests/_files/DataProviderPair/FirstTest.php delete mode 100644 tests/_files/DataProviderPair/SecondTest.php diff --git a/tests/TextUI/dataprovider-pair.phpt b/tests/TextUI/dataprovider-pair.phpt deleted file mode 100644 index e1d33a7e1a8..00000000000 --- a/tests/TextUI/dataprovider-pair.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -phpunit ../_files/DataProviderPair ---FILE-- -assertTrue(true); - } - - public function provide() - { - SecondTest::DUMMY; - - return [[true]]; - } -} diff --git a/tests/_files/DataProviderPair/SecondTest.php b/tests/_files/DataProviderPair/SecondTest.php deleted file mode 100644 index 92e48e65d2c..00000000000 --- a/tests/_files/DataProviderPair/SecondTest.php +++ /dev/null @@ -1,15 +0,0 @@ -assertTrue(true); - } -} From 4b1c822a68ae6577df38a59eb49b046712ec0f6a Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Tue, 14 Nov 2017 15:50:51 +0100 Subject: [PATCH 4/4] Prepare release --- ChangeLog-5.7.md | 7 +++++++ src/Runner/Version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog-5.7.md b/ChangeLog-5.7.md index f42c9ec85ca..cdfd5b5ca5f 100644 --- a/ChangeLog-5.7.md +++ b/ChangeLog-5.7.md @@ -2,6 +2,12 @@ All notable changes of the PHPUnit 5.7 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## [5.7.25] - 2017-11-14 + +### Fixed + +* Fixed [#2859](https://github.com/sebastianbergmann/phpunit/issues/2859): Regression caused by fix for [#2833](https://github.com/sebastianbergmann/phpunit/issues/2833) + ## [5.7.24] - 2017-11-14 ### Fixed @@ -189,6 +195,7 @@ All notable changes of the PHPUnit 5.7 release series are documented in this fil * The `--tap` and `--log-tap` commandline options have been deprecated * The `--self-update` and `--self-upgrade` commandline options have been deprecated (PHAR binary only) +[5.7.25]: https://github.com/sebastianbergmann/phpunit/compare/5.7.24...5.7.25 [5.7.24]: https://github.com/sebastianbergmann/phpunit/compare/5.7.23...5.7.24 [5.7.23]: https://github.com/sebastianbergmann/phpunit/compare/5.7.22...5.7.23 [5.7.22]: https://github.com/sebastianbergmann/phpunit/compare/5.7.21...5.7.22 diff --git a/src/Runner/Version.php b/src/Runner/Version.php index fa468325d3f..b68de8906cf 100644 --- a/src/Runner/Version.php +++ b/src/Runner/Version.php @@ -30,7 +30,7 @@ public static function id() } if (self::$version === null) { - $version = new Version('5.7.24', dirname(dirname(__DIR__))); + $version = new Version('5.7.25', dirname(dirname(__DIR__))); self::$version = $version->getVersion(); }