class InvokedAtLeastOnce
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
@internal This class is not covered by the backward compatibility promise for PHPUnit
Hierarchy
- class \PHPUnit\Framework\MockObject\Rule\InvocationOrder implements \PHPUnit\Framework\SelfDescribing
- class \PHPUnit\Framework\MockObject\Rule\InvokedAtLeastOnce extends \PHPUnit\Framework\MockObject\Rule\InvocationOrder
Expanded class hierarchy of InvokedAtLeastOnce
2 files declare their use of InvokedAtLeastOnce
- Functions.php in vendor/
phpunit/ phpunit/ src/ Framework/ Assert/ Functions.php - TestCase.php in vendor/
phpunit/ phpunit/ src/ Framework/ TestCase.php
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Runtime/ Rule/ InvokedAtLeastOnce.php, line 20
Namespace
PHPUnit\Framework\MockObject\RuleView source
final class InvokedAtLeastOnce extends InvocationOrder {
public function toString() : string {
return 'invoked at least once';
}
/**
* Verifies that the current expectation is valid. If everything is OK the
* code should just return, if not it must throw an exception.
*
* @throws ExpectationFailedException
*/
public function verify() : void {
$count = $this->numberOfInvocations();
if ($count < 1) {
throw new ExpectationFailedException('Expected invocation at least once but it never occurred.');
}
}
public function matches(BaseInvocation $invocation) : bool {
return true;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
InvocationOrder::$invocations | private | property | @psalm-var list<BaseInvocation> | ||
InvocationOrder::hasBeenInvoked | public | function | |||
InvocationOrder::invoked | final public | function | |||
InvocationOrder::invokedDo | protected | function | 1 | ||
InvocationOrder::numberOfInvocations | public | function | |||
InvokedAtLeastOnce::matches | public | function | Overrides InvocationOrder::matches | ||
InvokedAtLeastOnce::toString | public | function | Returns a string representation of the object. | Overrides SelfDescribing::toString | |
InvokedAtLeastOnce::verify | public | function | Verifies that the current expectation is valid. If everything is OK the code should just return, if not it must throw an exception. |
Overrides InvocationOrder::verify |