本文整理匯總了PHP中Prophecy\Prophecy\MethodProphecy::getObjectProphecy方法的典型用法代碼示例。如果您正苦於以下問題:PHP MethodProphecy::getObjectProphecy方法的具體用法?PHP MethodProphecy::getObjectProphecy怎麽用?PHP MethodProphecy::getObjectProphecy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Prophecy\Prophecy\MethodProphecy
的用法示例。
在下文中一共展示了MethodProphecy::getObjectProphecy方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
/**
* @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);
}
示例2:
/**
* @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);
}
示例3: let
/**
* @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));
}
示例4:
/**
* @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);
}
示例5: let
function let(ObjectProphecy $objectProphecy, MethodProphecy $methodProphecy)
{
$methodProphecy->getObjectProphecy()->willReturn($objectProphecy);
$this->beConstructedWith('message', $methodProphecy);
}
示例6: __construct
public function __construct($message, MethodProphecy $methodProphecy)
{
parent::__construct($message, $methodProphecy->getObjectProphecy());
$this->methodProphecy = $methodProphecy;
}