You are here

public function ObjectProphecy::__call in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php \Prophecy\Prophecy\ObjectProphecy::__call()

Creates new method prophecy using specified method name and arguments.

Parameters

string $methodName:

array $arguments:

Return value

MethodProphecy

File

vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php, line 240

Class

ObjectProphecy
Object prophecy.

Namespace

Prophecy\Prophecy

Code

public function __call($methodName, array $arguments) {
  $arguments = new ArgumentsWildcard($this->revealer
    ->reveal($arguments));
  foreach ($this
    ->getMethodProphecies($methodName) as $prophecy) {
    $argumentsWildcard = $prophecy
      ->getArgumentsWildcard();
    $comparator = $this->comparatorFactory
      ->getComparatorFor($argumentsWildcard, $arguments);
    try {
      $comparator
        ->assertEquals($argumentsWildcard, $arguments);
      return $prophecy;
    } catch (ComparisonFailure $failure) {
    }
  }
  return new MethodProphecy($this, $methodName, $arguments);
}