From fc7eadb7274ce9ae6f6f651b41fe1d867956061c Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Wed, 7 Feb 2024 15:53:00 +0100 Subject: [PATCH] Closes #5424 --- src/Framework/TestCase.php | 91 -------------------------------------- 1 file changed, 91 deletions(-) diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index ff6aed7dd65..10335e0f281 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -72,13 +72,7 @@ use PHPUnit\Framework\MockObject\Rule\InvokedAtMostCount as InvokedAtMostCountMatcher; use PHPUnit\Framework\MockObject\Rule\InvokedCount as InvokedCountMatcher; use PHPUnit\Framework\MockObject\Stub; -use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls as ConsecutiveCallsStub; use PHPUnit\Framework\MockObject\Stub\Exception as ExceptionStub; -use PHPUnit\Framework\MockObject\Stub\ReturnArgument as ReturnArgumentStub; -use PHPUnit\Framework\MockObject\Stub\ReturnCallback as ReturnCallbackStub; -use PHPUnit\Framework\MockObject\Stub\ReturnSelf as ReturnSelfStub; -use PHPUnit\Framework\MockObject\Stub\ReturnStub; -use PHPUnit\Framework\MockObject\Stub\ReturnValueMap as ReturnValueMapStub; use PHPUnit\Framework\TestSize\TestSize; use PHPUnit\Framework\TestStatus\TestStatus; use PHPUnit\Metadata\Api\Groups; @@ -966,96 +960,11 @@ final protected function atMost(int $allowedInvocations): InvokedAtMostCountMatc return new InvokedAtMostCountMatcher($allowedInvocations); } - /** - * @deprecated Use $double->willReturn() instead of $double->will($this->returnValue()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - */ - final protected function returnValue(mixed $value): ReturnStub - { - Event\Facade::emitter()->testTriggeredPhpunitDeprecation( - $this->valueObjectForEvents(), - 'returnValue() is deprecated and will be removed in PHPUnit 12. Use $double->willReturn() instead of $double->will($this->returnValue())', - ); - - return new ReturnStub($value); - } - - /** - * @deprecated Use $double->willReturnMap() instead of $double->will($this->returnValueMap()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - */ - final protected function returnValueMap(array $valueMap): ReturnValueMapStub - { - Event\Facade::emitter()->testTriggeredPhpunitDeprecation( - $this->valueObjectForEvents(), - 'returnValueMap() is deprecated and will be removed in PHPUnit 12. Use $double->willReturnMap() instead of $double->will($this->returnValueMap())', - ); - - return new ReturnValueMapStub($valueMap); - } - - /** - * @deprecated Use $double->willReturnArgument() instead of $double->will($this->returnArgument()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - */ - final protected function returnArgument(int $argumentIndex): ReturnArgumentStub - { - Event\Facade::emitter()->testTriggeredPhpunitDeprecation( - $this->valueObjectForEvents(), - 'returnArgument() is deprecated and will be removed in PHPUnit 12. Use $double->willReturnArgument() instead of $double->will($this->returnArgument())', - ); - - return new ReturnArgumentStub($argumentIndex); - } - - /** - * @deprecated Use $double->willReturnCallback() instead of $double->will($this->returnCallback()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - */ - final protected function returnCallback(callable $callback): ReturnCallbackStub - { - Event\Facade::emitter()->testTriggeredPhpunitDeprecation( - $this->valueObjectForEvents(), - 'returnCallback() is deprecated and will be removed in PHPUnit 12. Use $double->willReturnCallback() instead of $double->will($this->returnCallback())', - ); - - return new ReturnCallbackStub($callback); - } - - /** - * @deprecated Use $double->willReturnSelf() instead of $double->will($this->returnSelf()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - */ - final protected function returnSelf(): ReturnSelfStub - { - Event\Facade::emitter()->testTriggeredPhpunitDeprecation( - $this->valueObjectForEvents(), - 'returnSelf() is deprecated and will be removed in PHPUnit 12. Use $double->willReturnSelf() instead of $double->will($this->returnSelf())', - ); - - return new ReturnSelfStub; - } - final protected function throwException(Throwable $exception): ExceptionStub { return new ExceptionStub($exception); } - /** - * @deprecated Use $double->willReturn() instead of $double->will($this->onConsecutiveCalls()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - * @see https://github.com/sebastianbergmann/phpunit/issues/5425 - */ - final protected function onConsecutiveCalls(mixed ...$arguments): ConsecutiveCallsStub - { - Event\Facade::emitter()->testTriggeredPhpunitDeprecation( - $this->valueObjectForEvents(), - 'onConsecutiveCalls() is deprecated and will be removed in PHPUnit 12. Use $double->willReturn() instead of $double->will($this->onConsecutiveCalls())', - ); - - return new ConsecutiveCallsStub($arguments); - } - final protected function getActualOutputForAssertion(): string { $this->outputRetrievedForAssertion = true;