Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图用我的规范捕捉异常,但我不能让它工作。这是我的代码:
$this->edit('updated comment', $comment, $user) ->shouldReturnAnInstanceOf('\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException');
我做错了什么?
根据文档,您可以使用Matcher测试异常来执行以下操作:
Matcher
$this ->shouldThrow('Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException') ->during('edit', array('updated comment', $comment, $user));
您还可以查看Github 上phpspec存储库中的说明书。