/** * @param \Prophecy\Prophecy\ObjectProphecy $object * @param \Prophecy\Prophecy\MethodProphecy $method * @param \Prophecy\Argument\ArgumentsWildcard $arguments */ function it_throws_NoCallsException_if_no_calls_found($object, $method, $arguments) { $method->getObjectProphecy()->willReturn($object); $method->getMethodName()->willReturn('getName'); $method->getArgumentsWildcard()->willReturn($arguments); $arguments->__toString()->willReturn('123'); $object->reveal()->willReturn(new \stdClass()); $object->findProphecyMethodCalls('getName', Argument::any())->willReturn(array()); $this->shouldThrow('Prophecy\\Exception\\Prediction\\NoCallsException')->duringCheck(array(), $object, $method); }
/** * @param \Prophecy\Prophecy\ObjectProphecy $object * @param \Prophecy\Prophecy\MethodProphecy $method * @param \Prophecy\Call\Call $call * @param \Prophecy\Argument\ArgumentsWildcard $arguments */ function it_throws_UnexpectedCallsCountException_if_calls_found($object, $method, $call, $arguments) { $method->getObjectProphecy()->willReturn($object); $method->getMethodName()->willReturn('getName'); $method->getArgumentsWildcard()->willReturn($arguments); $arguments->__toString()->willReturn('123'); $call->getMethodName()->willReturn('getName'); $call->getArguments()->willReturn(array(5, 4, 'three')); $call->getCallPlace()->willReturn('unknown'); $this->shouldThrow('Prophecy\\Exception\\Prediction\\UnexpectedCallsCountException')->duringCheck(array($call), $object, $method); }
/** * @param \Prophecy\Prophecy\ObjectProphecy $objectProphecy * @param \Prophecy\Prophecy\MethodProphecy $methodProphecy * @param \Prophecy\Call\Call $call1 * @param \Prophecy\Call\Call $call2 */ function let($objectProphecy, $methodProphecy, $call1, $call2) { $methodProphecy->getObjectProphecy()->willReturn($objectProphecy); $this->beConstructedWith('message', $methodProphecy, 5, array($call1, $call2)); }
/** * @param \Prophecy\Prophecy\MethodProphecy $methodProphecy */ function its_addMethodProphecy_throws_exception_when_method_has_no_ArgumentsWildcard($methodProphecy) { $methodProphecy->getArgumentsWildcard()->willReturn(null); $methodProphecy->getObjectProphecy()->willReturn($this); $methodProphecy->getMethodName()->willReturn('getTitle'); $this->shouldThrow('Prophecy\\Exception\\Prophecy\\MethodProphecyException')->duringAddMethodProphecy($methodProphecy); }
function let(ObjectProphecy $objectProphecy, MethodProphecy $methodProphecy) { $methodProphecy->getObjectProphecy()->willReturn($objectProphecy); $this->beConstructedWith('message', $methodProphecy); }
public function __construct($message, MethodProphecy $methodProphecy) { parent::__construct($message, $methodProphecy->getObjectProphecy()); $this->methodProphecy = $methodProphecy; }