From 1d7c4c51e32f3b9cc8eb57a0434f80cb3f6efb6f Mon Sep 17 00:00:00 2001 From: Ewout Pieter den Ouden Date: Sat, 2 Jun 2018 17:11:03 +0200 Subject: [PATCH 1/6] Add regression test for #3165 with supplied sample code --- .../Regression/GitHub/3156/Issue3156Test.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/Regression/GitHub/3156/Issue3156Test.php diff --git a/tests/Regression/GitHub/3156/Issue3156Test.php b/tests/Regression/GitHub/3156/Issue3156Test.php new file mode 100644 index 00000000000..b35a45ecc95 --- /dev/null +++ b/tests/Regression/GitHub/3156/Issue3156Test.php @@ -0,0 +1,35 @@ +assertStringEndsWith('/', "/"); + return new stdClass(); + } + + public function dataSelectOperatorsProvider(): array + { + return [ + ["1"], + ["2"] + ]; + } + + /** + * @depends testConstants + * @dataProvider dataSelectOperatorsProvider + * + * @return void + */ + public function testDependsRequire(string $val, stdClass $obj): void + { + $this->assertStringEndsWith('/', "/"); + } +} From 5c3dbfadaf8674c04d8376ec2cd96167a2122bf1 Mon Sep 17 00:00:00 2001 From: Ewout Pieter den Ouden Date: Sat, 2 Jun 2018 19:14:58 +0200 Subject: [PATCH 2/6] Fix #3156 by restoring code for dependencies in dataproviders The @depends annotation is used to supply additional parameters in combination with @dataprovider. For this to work the dependencies of the dataprovider suite need to be copied over to each individual test. --- src/Framework/DataProviderTestSuite.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Framework/DataProviderTestSuite.php b/src/Framework/DataProviderTestSuite.php index cc898ef77f3..af119d27fc1 100644 --- a/src/Framework/DataProviderTestSuite.php +++ b/src/Framework/DataProviderTestSuite.php @@ -22,6 +22,10 @@ class DataProviderTestSuite extends TestSuite public function setDependencies(array $dependencies): void { $this->dependencies = $dependencies; + + foreach ($this->tests as $test) { + $test->setDependencies($dependencies); + } } public function getDependencies(): array From baef0d01f01ca44f4b29036d24f19274982fe32f Mon Sep 17 00:00:00 2001 From: Ewout Pieter den Ouden Date: Sat, 2 Jun 2018 19:16:00 +0200 Subject: [PATCH 3/6] CS/WS fixes --- .../Regression/GitHub/3156/Issue3156Test.php | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/Regression/GitHub/3156/Issue3156Test.php b/tests/Regression/GitHub/3156/Issue3156Test.php index b35a45ecc95..f733c7b6904 100644 --- a/tests/Regression/GitHub/3156/Issue3156Test.php +++ b/tests/Regression/GitHub/3156/Issue3156Test.php @@ -1,35 +1,42 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Test; + use PHPUnit\Framework\TestCase; -use \stdClass; +use stdClass; class TestTest extends TestCase { - public function testConstants(): stdClass { - $this->assertStringEndsWith('/', "/"); + $this->assertStringEndsWith('/', '/'); + return new stdClass(); } public function dataSelectOperatorsProvider(): array { return [ - ["1"], - ["2"] + ['1'], + ['2'] ]; } /** * @depends testConstants * @dataProvider dataSelectOperatorsProvider - * - * @return void */ public function testDependsRequire(string $val, stdClass $obj): void { - $this->assertStringEndsWith('/', "/"); + $this->assertStringEndsWith('/', '/'); } } From a1211d749ad94b36c1586934eeefc26009ac095c Mon Sep 17 00:00:00 2001 From: Ewout Pieter den Ouden Date: Sat, 2 Jun 2018 19:56:49 +0200 Subject: [PATCH 4/6] Make the regression test feel more welcome --- tests/Regression/GitHub/3156/Issue3156Test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Regression/GitHub/3156/Issue3156Test.php b/tests/Regression/GitHub/3156/Issue3156Test.php index f733c7b6904..d4eec8544d7 100644 --- a/tests/Regression/GitHub/3156/Issue3156Test.php +++ b/tests/Regression/GitHub/3156/Issue3156Test.php @@ -14,7 +14,7 @@ use PHPUnit\Framework\TestCase; use stdClass; -class TestTest extends TestCase +class Issue3156Test extends TestCase { public function testConstants(): stdClass { From d17d5aef6eff468fab75a6c9c7878cbe9d52498e Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sun, 3 Jun 2018 08:03:46 +0200 Subject: [PATCH 5/6] Update ChangeLog --- ChangeLog-7.2.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ChangeLog-7.2.md b/ChangeLog-7.2.md index a7023dd9a04..3c65023f6a6 100644 --- a/ChangeLog-7.2.md +++ b/ChangeLog-7.2.md @@ -2,6 +2,12 @@ All notable changes of the PHPUnit 7.2 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## [7.2.3] - 2018-MM-DD + +### Fixed + +* Fixed [#3156](https://github.com/sebastianbergmann/phpunit/issues/3156): Combined use of `@depends` and `@dataProvider` is not handled correctly + ## [7.2.2] - 2018-06-01 ### Changed @@ -10,6 +16,8 @@ All notable changes of the PHPUnit 7.2 release series are documented in this fil ## [7.2.1] - 2018-06-01 +### Fixed + * Fixed [#3155](https://github.com/sebastianbergmann/phpunit/issues/3155): Calling `getStatus()` on a `TestCase` object before the respective test has been executed results in type error ## [7.2.0] - 2018-06-01 @@ -32,6 +40,7 @@ All notable changes of the PHPUnit 7.2 release series are documented in this fil * Fixed [#3069](https://github.com/sebastianbergmann/phpunit/issues/3069): Method `ResultPrinter::printWaitPrompt()` seems to be unused +[7.2.3]: https://github.com/sebastianbergmann/phpunit/compare/7.2.2...7.2.3 [7.2.2]: https://github.com/sebastianbergmann/phpunit/compare/7.2.1...7.2.2 [7.2.1]: https://github.com/sebastianbergmann/phpunit/compare/7.2.0...7.2.1 [7.2.0]: https://github.com/sebastianbergmann/phpunit/compare/7.1...7.2.0 From 42bb8f5b2cb36483907a20f45e4cd1665c24d8a7 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sun, 3 Jun 2018 08:05:05 +0200 Subject: [PATCH 6/6] Prepare release --- ChangeLog-7.2.md | 2 +- src/Runner/Version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog-7.2.md b/ChangeLog-7.2.md index 3c65023f6a6..27128083f32 100644 --- a/ChangeLog-7.2.md +++ b/ChangeLog-7.2.md @@ -2,7 +2,7 @@ All notable changes of the PHPUnit 7.2 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. -## [7.2.3] - 2018-MM-DD +## [7.2.3] - 2018-06-03 ### Fixed diff --git a/src/Runner/Version.php b/src/Runner/Version.php index a08370db418..e913c600301 100644 --- a/src/Runner/Version.php +++ b/src/Runner/Version.php @@ -30,7 +30,7 @@ public static function id(): string } if (self::$version === null) { - $version = new VersionId('7.2.2', \dirname(__DIR__, 2)); + $version = new VersionId('7.2.3', \dirname(__DIR__, 2)); self::$version = $version->getVersion(); }