Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. InvokedCount.php

function InvokedCount::invokedDo

Throws

ExpectationFailedException

Overrides InvocationOrder::invokedDo

File

vendor/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/InvokedCount.php, line 75

Class

InvokedCount
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

Namespace

PHPUnit\Framework\MockObject\Rule

Code

protected function invokedDo(BaseInvocation $invocation) : void {
    $count = $this->numberOfInvocations();
    if ($count > $this->expectedCount) {
        $message = $invocation->toString() . ' ';
        $message .= match ($this->expectedCount) {    0 => 'was not expected to be called.',
            1 => 'was not expected to be called more than once.',
            default => sprintf('was not expected to be called more than %d times.', $this->expectedCount),
        
        };
        throw new ExpectationFailedException($message);
    }
}
RSS feed
Powered by Drupal