荫100%的代码覆盖率的粉丝,但我不知道如何测试Zend框架的ErrorController。单元测试误差控制在Zend框架
这是没有问题的测试404Action和errorAction:
public function testDispatchErrorAction()
{
$this->dispatch('/error/error');
$this->assertResponseCode(200);
$this->assertController('error');
$this->assertAction('error');
}
public function testDispatch404()
{
$this->dispatch('/error/errorxxxxx');
$this->assertResponseCode(404);
$this->assertController('error');
$this->assertAction('error');
}
但是如何测试应用程序错误(500)? 也许我需要这样的东西?
public function testDispatch500()
{
throw new Exception('test');
$this->dispatch('/error/error');
$this->assertResponseCode(500);
$this->assertController('error');
$this->assertAction('error');
}