You are here

function CallCenterSpec::it_executes_promise_of_method_prophecy_that_matches_with_highest_score_to_makeCall in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/spec/Prophecy/Call/CallCenterSpec.php \spec\Prophecy\Call\CallCenterSpec::it_executes_promise_of_method_prophecy_that_matches_with_highest_score_to_makeCall()

Parameters

\Prophecy\Prophecy\MethodProphecy $method1:

\Prophecy\Prophecy\MethodProphecy $method2:

\Prophecy\Prophecy\MethodProphecy $method3:

\Prophecy\Argument\ArgumentsWildcard $arguments1:

\Prophecy\Argument\ArgumentsWildcard $arguments2:

\Prophecy\Argument\ArgumentsWildcard $arguments3:

\Prophecy\Promise\PromiseInterface $promise:

File

vendor/phpspec/prophecy/spec/Prophecy/Call/CallCenterSpec.php, line 99

Class

CallCenterSpec

Namespace

spec\Prophecy\Call

Code

function it_executes_promise_of_method_prophecy_that_matches_with_highest_score_to_makeCall($objectProphecy, $method1, $method2, $method3, $arguments1, $arguments2, $arguments3, $promise) {
  $method1
    ->getMethodName()
    ->willReturn('getName');
  $method1
    ->getArgumentsWildcard()
    ->willReturn($arguments1);
  $arguments1
    ->scoreArguments(array(
    'world',
    'everything',
  ))
    ->willReturn(50);
  $method2
    ->getMethodName()
    ->willReturn('getName');
  $method2
    ->getArgumentsWildcard()
    ->willReturn($arguments2);
  $method2
    ->getPromise()
    ->willReturn($promise);
  $arguments2
    ->scoreArguments(array(
    'world',
    'everything',
  ))
    ->willReturn(300);
  $method3
    ->getMethodName()
    ->willReturn('getName');
  $method3
    ->getArgumentsWildcard()
    ->willReturn($arguments3);
  $arguments3
    ->scoreArguments(array(
    'world',
    'everything',
  ))
    ->willReturn(200);
  $objectProphecy
    ->getMethodProphecies()
    ->willReturn(array(
    'method1' => array(
      $method1,
    ),
    'method2' => array(
      $method2,
      $method3,
    ),
  ));
  $objectProphecy
    ->getMethodProphecies('getName')
    ->willReturn(array(
    $method1,
    $method2,
    $method3,
  ));
  $objectProphecy
    ->reveal()
    ->willReturn(new \stdClass());
  $promise
    ->execute(array(
    'world',
    'everything',
  ), $objectProphecy
    ->getWrappedObject(), $method2)
    ->willReturn('second');
  $this
    ->makeCall($objectProphecy, 'getName', array(
    'world',
    'everything',
  ))
    ->shouldReturn('second');
}