Skip to content

Commit

Permalink
Closes #4298
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 4, 2020
1 parent 18f6cc7 commit 41bdc60
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 116 deletions.
1 change: 1 addition & 0 deletions ChangeLog-10.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ All notable changes of the PHPUnit 10.0 release series are documented in this fi
* [#4273](https://github.com/sebastianbergmann/phpunit/issues/4273): Remove `PHPUnit\Framework\TestCase::$backupGlobalsBlacklist`
* [#4274](https://github.com/sebastianbergmann/phpunit/issues/4274): Remove `PHPUnit\Framework\TestCase::$backupStaticAttributesBlacklist`
* [#4278](https://github.com/sebastianbergmann/phpunit/issues/4278): Remove `--whitelist` option
* [#4298](https://github.com/sebastianbergmann/phpunit/issues/4298): Remove `at()` matcher

[10.0.0]: https://github.com/sebastianbergmann/phpunit/compare/9.5...master
12 changes: 0 additions & 12 deletions src/Framework/Assert/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
use PHPUnit\Framework\Constraint\TraversableContainsIdentical;
use PHPUnit\Framework\Constraint\TraversableContainsOnly;
use PHPUnit\Framework\MockObject\Rule\AnyInvokedCount as AnyInvokedCountMatcher;
use PHPUnit\Framework\MockObject\Rule\InvokedAtIndex as InvokedAtIndexMatcher;
use PHPUnit\Framework\MockObject\Rule\InvokedAtLeastCount as InvokedAtLeastCountMatcher;
use PHPUnit\Framework\MockObject\Rule\InvokedAtLeastOnce as InvokedAtLeastOnceMatcher;
use PHPUnit\Framework\MockObject\Rule\InvokedAtMostCount as InvokedAtMostCountMatcher;
Expand Down Expand Up @@ -2755,17 +2754,6 @@ function atMost(int $allowedInvocations): InvokedAtMostCountMatcher
}
}

if (!function_exists('PHPUnit\Framework\at')) {
/**
* Returns a matcher that matches when the method is executed
* at the given index.
*/
function at(int $index): InvokedAtIndexMatcher
{
return new InvokedAtIndexMatcher($index);
}
}

if (!function_exists('PHPUnit\Framework\returnValue')) {
function returnValue($value): ReturnStub
{
Expand Down
75 changes: 0 additions & 75 deletions src/Framework/MockObject/Rule/InvokedAtIndex.php

This file was deleted.

29 changes: 0 additions & 29 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use function array_flip;
use function array_keys;
use function array_merge;
use function array_pop;
use function array_search;
use function array_unique;
use function array_values;
Expand All @@ -32,7 +31,6 @@
use function class_exists;
use function clearstatcache;
use function count;
use function debug_backtrace;
use function defined;
use function explode;
use function get_class;
Expand Down Expand Up @@ -75,7 +73,6 @@
use PHPUnit\Framework\MockObject\MockBuilder;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\MockObject\Rule\AnyInvokedCount as AnyInvokedCountMatcher;
use PHPUnit\Framework\MockObject\Rule\InvokedAtIndex as InvokedAtIndexMatcher;
use PHPUnit\Framework\MockObject\Rule\InvokedAtLeastCount as InvokedAtLeastCountMatcher;
use PHPUnit\Framework\MockObject\Rule\InvokedAtLeastOnce as InvokedAtLeastOnceMatcher;
use PHPUnit\Framework\MockObject\Rule\InvokedAtMostCount as InvokedAtMostCountMatcher;
Expand Down Expand Up @@ -388,32 +385,6 @@ public static function atMost(int $allowedInvocations): InvokedAtMostCountMatche
return new InvokedAtMostCountMatcher($allowedInvocations);
}

/**
* Returns a matcher that matches when the method is executed
* at the given index.
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4297
* @codeCoverageIgnore
*/
public static function at(int $index): InvokedAtIndexMatcher
{
$stack = debug_backtrace();

while (!empty($stack)) {
$frame = array_pop($stack);

if (isset($frame['object']) && $frame['object'] instanceof self) {
$frame['object']->addWarning(
'The at() matcher has been deprecated. It will be removed in PHPUnit 10. Please refactor your test to not rely on the order in which methods are invoked.'
);

break;
}
}

return new InvokedAtIndexMatcher($index);
}

public static function returnValue($value): ReturnStub
{
return new ReturnStub($value);
Expand Down

0 comments on commit 41bdc60

Please sign in to comment.