diff --git a/.psalm/baseline.xml b/.psalm/baseline.xml index 26a42470677..fce50f89d5c 100644 --- a/.psalm/baseline.xml +++ b/.psalm/baseline.xml @@ -715,7 +715,7 @@ getResult runTest - + cacheDirectory endTest endTest @@ -730,6 +730,7 @@ getMockForTrait getObjectForTrait new Differ($header) + throw new Exception('This test uses TestCase::prophesize(), but phpspec/prophecy is not installed. Please run "composer require --dev phpspec/prophecy ^1.12.1".'); $beStrictAboutChangesToGlobalState @@ -745,9 +746,6 @@ $runClassInSeparateProcess $runTestInSeparateProcess - - $methodProphecies - (bool) $this->backupStaticAttributes @@ -757,6 +755,22 @@ $this->prophet !== null + + $e + ObjectProphecy + PredictionException + PredictionException + Prophet + Prophet + + + $this->prophet + $this->prophet + \Prophecy\Exception\Doubler\ClassNotFoundException + \Prophecy\Exception\Doubler\DoubleException + \Prophecy\Exception\Doubler\InterfaceNotFoundException + \Prophecy\Prophet + @@ -1295,6 +1309,13 @@ + + Assert + DocBlock + Project + Prophet + Type + diff --git a/ChangeLog-8.5.md b/ChangeLog-8.5.md index 42b4923edde..04ec1cea919 100644 --- a/ChangeLog-8.5.md +++ b/ChangeLog-8.5.md @@ -2,6 +2,12 @@ All notable changes of the PHPUnit 8.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. +## [8.5.29] - 2022-MM-DD + +### Changed + +* [#5033](https://github.com/sebastianbergmann/phpunit/issues/5033): Do not depend on phpspec/prophecy + ## [8.5.28] - 2022-07-29 ### Fixed @@ -233,6 +239,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil * [#3967](https://github.com/sebastianbergmann/phpunit/issues/3967): Cannot double interface that extends interface that extends `\Throwable` * [#3968](https://github.com/sebastianbergmann/phpunit/pull/3968): Test class run in a separate PHP process are passing when `exit` called inside +[8.5.29]: https://github.com/sebastianbergmann/phpunit/compare/8.5.28...8.5 [8.5.28]: https://github.com/sebastianbergmann/phpunit/compare/8.5.27...8.5.28 [8.5.27]: https://github.com/sebastianbergmann/phpunit/compare/8.5.26...8.5.27 [8.5.26]: https://github.com/sebastianbergmann/phpunit/compare/8.5.25...8.5.26 diff --git a/ChangeLog-9.5.md b/ChangeLog-9.5.md index d9cc683e66b..90c23b09eb9 100644 --- a/ChangeLog-9.5.md +++ b/ChangeLog-9.5.md @@ -2,6 +2,12 @@ All notable changes of the PHPUnit 9.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. +## [9.5.23] - 2022-MM-DD + +### Changed + +* [#5033](https://github.com/sebastianbergmann/phpunit/issues/5033): Do not depend on phpspec/prophecy + ## [9.5.22] - 2022-08-20 ### Fixed @@ -172,6 +178,7 @@ All notable changes of the PHPUnit 9.5 release series are documented in this fil * [#4535](https://github.com/sebastianbergmann/phpunit/issues/4535): `getMockFromWsdl()` does not handle methods that do not have parameters correctly +[9.5.23]: https://github.com/sebastianbergmann/phpunit/compare/9.5.22...9.5 [9.5.22]: https://github.com/sebastianbergmann/phpunit/compare/9.5.21...9.5.22 [9.5.21]: https://github.com/sebastianbergmann/phpunit/compare/9.5.20...9.5.21 [9.5.20]: https://github.com/sebastianbergmann/phpunit/compare/9.5.19...9.5.20 diff --git a/build.xml b/build.xml index 6e1d3756dc1..56bca57246e 100644 --- a/build.xml +++ b/build.xml @@ -106,6 +106,12 @@ + + + + + + @@ -344,6 +350,11 @@ + + + + + diff --git a/composer.json b/composer.json index f3e63684693..fbe9221f33a 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,6 @@ "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "phpspec/prophecy": "^1.12.1", "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", @@ -50,9 +49,6 @@ "sebastian/type": "^3.0", "sebastian/version": "^3.0.2" }, - "require-dev": { - "phpspec/prophecy-phpunit": "^2.0.1" - }, "config": { "platform": { "php": "7.3.0" diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index a05ed7fbde4..59bf4ec662c 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -1954,6 +1954,10 @@ protected function getObjectForTrait(string $traitName, array $arguments = [], s */ protected function prophesize(?string $classOrInterface = null): ObjectProphecy { + if (!class_exists(Prophet::class)) { + throw new Exception('This test uses TestCase::prophesize(), but phpspec/prophecy is not installed. Please run "composer require --dev phpspec/prophecy".'); + } + $this->addWarning('PHPUnit\Framework\TestCase::prophesize() is deprecated and will be removed in PHPUnit 10. Please use the trait provided by phpspec/prophecy-phpunit.'); if (is_string($classOrInterface)) { diff --git a/tests/_files/ExternalProphecyIntegrationTest.php b/tests/_files/ExternalProphecyIntegrationTest.php deleted file mode 100644 index 9a8aeeec17c..00000000000 --- a/tests/_files/ExternalProphecyIntegrationTest.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TestFixture; - -use PHPUnit\Framework\TestCase; -use Prophecy\PhpUnit\ProphecyTrait; - -final class ExternalProphecyIntegrationTest extends TestCase -{ - use ProphecyTrait; - - public function testOne(): void - { - $prophecy = $this->prophesize(\PHPUnit\TestFixture\AnInterface::class); - $prophecy->doSomething()->willReturn('result')->shouldBeCalled(); - - $revelation = $prophecy->reveal(); - - $this->assertSame('result', $revelation->doSomething()); - } -} diff --git a/tests/_files/InternalProphecyIntegrationTest.php b/tests/_files/InternalProphecyIntegrationTest.php deleted file mode 100644 index 882d1f70878..00000000000 --- a/tests/_files/InternalProphecyIntegrationTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TestFixture; - -use PHPUnit\Framework\TestCase; - -final class InternalProphecyIntegrationTest extends TestCase -{ - public function testOne(): void - { - $prophecy = $this->prophesize(\PHPUnit\TestFixture\AnInterface::class); - $prophecy->doSomething()->willReturn('result')->shouldBeCalled(); - - $revelation = $prophecy->reveal(); - - $this->assertSame('result', $revelation->doSomething()); - } -} diff --git a/tests/end-to-end/generic/external-prophecy-integration-test.phpt b/tests/end-to-end/generic/external-prophecy-integration-test.phpt deleted file mode 100644 index 001f0cea425..00000000000 --- a/tests/end-to-end/generic/external-prophecy-integration-test.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -phpunit ../../_files/ExternalProphecyIntegrationTest.php ---FILE-- -