Soy fanático de la cobertura del 100% del código, pero no tengo idea de cómo probar el ErrorController en Zend Framework.UnitTest Error Controller en Zend Framework
No es ningún problema para probar la 404Action y la 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');
}
Pero cómo probar para un error de aplicación (500)? tal vez necesito algo como esto?
public function testDispatch500()
{
throw new Exception('test');
$this->dispatch('/error/error');
$this->assertResponseCode(500);
$this->assertController('error');
$this->assertAction('error');
}