Skip to content

Commit

Permalink
Closes #5424
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jul 19, 2024
1 parent fb692a7 commit 1324c22
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 110 deletions.
105 changes: 0 additions & 105 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1003,110 +997,11 @@ final protected function atMost(int $allowedInvocations): InvokedAtMostCountMatc
return new InvokedAtMostCountMatcher($allowedInvocations);
}

/**
* @deprecated Use <code>$double->willReturn()</code> instead of <code>$double->will($this->returnValue())</code>
* @see https://github.com/sebastianbergmann/phpunit/issues/5423
*
* @codeCoverageIgnore
*/
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);
}

/**
* @param array<mixed> $valueMap
*
* @deprecated Use <code>$double->willReturnMap()</code> instead of <code>$double->will($this->returnValueMap())</code>
* @see https://github.com/sebastianbergmann/phpunit/issues/5423
*
* @codeCoverageIgnore
*/
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 <code>$double->willReturnArgument()</code> instead of <code>$double->will($this->returnArgument())</code>
* @see https://github.com/sebastianbergmann/phpunit/issues/5423
*
* @codeCoverageIgnore
*/
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 <code>$double->willReturnCallback()</code> instead of <code>$double->will($this->returnCallback())</code>
* @see https://github.com/sebastianbergmann/phpunit/issues/5423
*
* @codeCoverageIgnore
*/
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 <code>$double->willReturnSelf()</code> instead of <code>$double->will($this->returnSelf())</code>
* @see https://github.com/sebastianbergmann/phpunit/issues/5423
*
* @codeCoverageIgnore
*/
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 <code>$double->willReturn()</code> instead of <code>$double->will($this->onConsecutiveCalls())</code>
* @see https://github.com/sebastianbergmann/phpunit/issues/5423
* @see https://github.com/sebastianbergmann/phpunit/issues/5425
*
* @codeCoverageIgnore
*/
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;
Expand Down
5 changes: 0 additions & 5 deletions tests/unit/Framework/MockObject/Creation/MockBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@
*/
namespace PHPUnit\Framework\MockObject;

use function assert;
use function class_exists;
use function interface_exists;
use function md5;
use function mt_rand;
use function substr;
use function trait_exists;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations;
Expand Down

0 comments on commit 1324c22

Please sign in to comment.