【发布时间】:2013-07-19 23:43:54
【问题描述】:
$client = Mockery::mock();
$client->shouldReceive('send')->andThrow($error)->andReturn(true);
不幸的是,它只返回 true 而不会首先抛出异常。如何在第一次调用时抛出异常,然后在第二次调用该方法时返回值?
编辑:
如果我手动编辑Mockery\Expectation.php 并设置$_throw
= true,这将有效。
$client->shouldReceive('send')->twice()->andReturn($error, true);
【问题讨论】: