diff --git a/ChangeLog-11.0.md b/ChangeLog-11.0.md index b7d19e7cee3..20277bfc10c 100644 --- a/ChangeLog-11.0.md +++ b/ChangeLog-11.0.md @@ -11,6 +11,7 @@ All notable changes of the PHPUnit 11.0 release series are documented in this fi ### Deprecated +* [#5240](https://github.com/sebastianbergmann/phpunit/issues/5240): `TestCase::createTestProxy()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) * [#5241](https://github.com/sebastianbergmann/phpunit/issues/5241): `TestCase::getMockForAbstractClass()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) * [#5242](https://github.com/sebastianbergmann/phpunit/issues/5242): `TestCase::getMockFromWsdl()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) * [#5243](https://github.com/sebastianbergmann/phpunit/issues/5243): `TestCase::getMockForTrait()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) diff --git a/DEPRECATIONS.md b/DEPRECATIONS.md index 499a896777e..7d069da45f2 100644 --- a/DEPRECATIONS.md +++ b/DEPRECATIONS.md @@ -10,7 +10,6 @@ This functionality is currently [soft-deprecated](https://phpunit.de/backward-co | Issue | Description | Since | Replacement | |-------------------------------------------------------------------|---------------------------------------------------|--------|-----------------------------------------------------------------------------------------| -| [#5240](https://github.com/sebastianbergmann/phpunit/issues/5240) | `TestCase::createTestProxy()` | 10.1.0 | | | [#5305](https://github.com/sebastianbergmann/phpunit/issues/5305) | `MockBuilder::getMockForAbstractClass()` | 10.1.0 | | | [#5306](https://github.com/sebastianbergmann/phpunit/issues/5306) | `MockBuilder::getMockForTrait()` | 10.1.0 | | | [#5307](https://github.com/sebastianbergmann/phpunit/issues/5307) | `MockBuilder::disableProxyingToOriginalMethods()` | 10.1.0 | | @@ -83,6 +82,7 @@ This functionality is currently [hard-deprecated](https://phpunit.de/backward-co | Issue | Description | Since | Replacement | |-------------------------------------------------------------------|---------------------------------------|--------|-------------| +| [#5240](https://github.com/sebastianbergmann/phpunit/issues/5240) | `TestCase::createTestProxy()` | 10.1.0 | | | [#5241](https://github.com/sebastianbergmann/phpunit/issues/5241) | `TestCase::getMockForAbstractClass()` | 10.1.0 | | | [#5242](https://github.com/sebastianbergmann/phpunit/issues/5242) | `TestCase::getMockFromWsdl()` | 10.1.0 | | | [#5243](https://github.com/sebastianbergmann/phpunit/issues/5243) | `TestCase::getMockForTrait()` | 10.1.0 | | diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index a07a8dfcef8..6c298e6935c 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -1312,6 +1312,11 @@ final protected function createPartialMock(string $originalClassName, array $met */ final protected function createTestProxy(string $originalClassName, array $constructorArguments = []): MockObject { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'createTestProxy() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $testProxy = $this->getMockBuilder($originalClassName) ->setConstructorArgs($constructorArguments) ->enableProxyingToOriginalMethods() diff --git a/tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php b/tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php index fcfc5cbb5eb..9ca8cd00720 100644 --- a/tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php +++ b/tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php @@ -11,6 +11,7 @@ use function assert; use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\Attributes\Medium; use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\TestCase; @@ -21,6 +22,7 @@ #[Group('test-doubles/test-proxy')] #[Medium] #[TestDox('createTestProxy()')] +#[IgnorePhpunitDeprecations] final class CreateTestProxyTest extends TestCase { public function testCreatesTestProxyForExtendableClass(): void