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

Breadcrumb

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

function Matcher::matches

Same name in this branch
  1. 11.1.x vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Matcher.php \DeepCopy\Matcher\Matcher::matches()

Throws

ExpectationFailedException

MatchBuilderNotFoundException

MethodNameNotConfiguredException

RuntimeException

File

vendor/phpunit/phpunit/src/Framework/MockObject/Runtime/Matcher.php, line 134

Class

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

Namespace

PHPUnit\Framework\MockObject

Code

public function matches(Invocation $invocation) : bool {
    if ($this->afterMatchBuilderId !== null) {
        $matcher = $invocation->object()
            ->__phpunit_getInvocationHandler()
            ->lookupMatcher($this->afterMatchBuilderId);
        if (!$matcher) {
            throw new MatchBuilderNotFoundException($this->afterMatchBuilderId);
        }
        if (!$matcher->invocationRule
            ->hasBeenInvoked()) {
            return false;
        }
    }
    if ($this->methodNameRule === null) {
        throw new MethodNameNotConfiguredException();
    }
    if (!$this->invocationRule
        ->matches($invocation)) {
        return false;
    }
    try {
        if (!$this->methodNameRule
            ->matches($invocation)) {
            return false;
        }
    } catch (ExpectationFailedException $e) {
        throw new ExpectationFailedException(sprintf("Expectation failed for %s when %s\n%s", $this->methodNameRule
            ->toString(), $this->invocationRule
            ->toString(), $e->getMessage()), $e->getComparisonFailure());
    }
    return true;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal