Exemplo n.º 1
0
 public function testGetInputForward()
 {
     // Input forward
     $this->actionMapping->setInput('aPath');
     $forward = $this->actionMapping->getInputForward();
     $this->assertNotEmpty($forward);
     $this->assertEquals('aPath', $forward->getPath());
     // Controller based input forward
     $controllerConfig = new \Phruts\Config\ControllerConfig();
     $controllerConfig->setInputForward(true);
     $this->actionMapping->setInput('path1');
     $this->moduleConfig->setControllerConfig($controllerConfig);
     $forward = $this->actionMapping->getInputForward();
     $this->assertNotEmpty($forward);
     $this->assertEquals('path1', $forward->getName());
 }
Exemplo 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);
 }