public function testUnspecified() { $this->mapping->setParameter('missing'); $this->action->execute($this->mapping, null, $this->request, $this->response); $this->assertNotEmpty($this->response->getContent()); $this->assertEquals(400, $this->response->getStatusCode()); }
public function testCreateForward() { $actionConfig = new ActionMapping(); $actionConfig->setPath('/test'); $actionConfig->setParameter('myfile.html'); $moduleConfig = new ModuleConfig(''); $moduleConfig->addActionConfig($actionConfig); $actionConfig->setModuleConfig($moduleConfig); $action = new ForwardAction(); $request = new Request(); $response = new Response(); $forwardConfig = $action->execute($actionConfig, null, $request, $response); $this->assertNotEmpty($forwardConfig); $this->assertEquals($actionConfig->getParameter(), $forwardConfig->getPath()); }
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); }