public function testExecute() { // Add an exception config $exceptionConfig = new ExceptionConfig(); $exceptionConfig->setPath('/exception.php'); $exceptionConfig->setKey('example.exception'); $exceptionConfig->setType('\\Exception'); // Action Mapping $actionMapping = new ActionMapping(); $actionMapping->setType('\\Phruts\\Actions\\ForwardAction'); $actionMapping->addExceptionConfig($exceptionConfig); $actionMapping->setPath('throw'); $formInstance = null; $request = new Request(); $response = new Response(); $forward = $this->exceptionHandler->execute(new \Exception('Example Error'), $exceptionConfig, $actionMapping, $formInstance, $request, $response); $this->assertTrue($forward instanceof \Phruts\Config\ForwardConfig); }
public function testExceptionConfig() { $config = new ExceptionConfig(); $config->setType('\\Exception'); $config->setKey('key1'); $config->setPath('exception'); $config->setScope('session'); $config->setBundle('mybundle'); $config->setHandler('\\Phruts\\Action\\ExceptionHandler'); $expected = "\\Phruts\\Config\\ExceptionConfig[type=\\Exception,bundle=mybundle,key=key1,path=exception,scope=session]"; $this->assertEquals($expected, (string) $config); // TODO: Test exception $config->freeze(); $this->setExpectedException('\\Phruts\\Exception\\IllegalStateException'); $config->setHandler('\\Handler'); }