Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public function testInvalidActionForm()
 {
     // Mock a request
     $request = Request::create('http://localhost/test', 'GET', array(), array(), array(), array('PATH_INFO' => '/test'));
     $formConfig = new FormBeanConfig();
     $formConfig->setName('form1');
     $formConfig->setType('\\ActionTest\\MyInvalidForm');
     $this->moduleConfig->addFormBeanConfig($formConfig);
     $actionMapping = new ActionMapping();
     $actionMapping->setScope('request');
     $actionMapping->setPath('/test');
     $actionMapping->setType('\\Phruts\\Actions\\ForwardAction');
     $actionMapping->setParameter('success');
     $actionMapping->setName('form1');
     $actionMapping->setInput('myinput.html.twig');
     $forwardConfig = new ForwardConfig();
     $forwardConfig->setName('success');
     $forwardConfig->setPath('success.html.twig');
     $actionMapping->addForwardConfig($forwardConfig);
     $actionMapping->setModuleConfig($this->moduleConfig);
     $this->moduleConfig->addActionConfig($actionMapping);
     $this->requestProcessor->process($request, $this->response);
 }