/** * @test */ public function shouldEscapeHtmlSpecialChars() { $expectedContent = <<<'HTML' <!DOCTYPE html> <html> <head> <title>Redirecting...</title> </head> <body onload="document.forms[0].submit();"> <form action="theUrl" method="post"> <p>Redirecting to payment page...</p> <p><input type="hidden" name="foo" value="<>&"" /> <input type="submit" value="Continue" /></p> </form> </body> </html> HTML; $request = new PostRedirectUrlInteractiveRequest('theUrl', array('foo' => '<>&"')); $this->assertEquals($expectedContent, $request->getContent()); }
/** * @test */ public function shouldSetResponseIfExceptionInstanceOfPostRedirectUrlInteractiveRequest() { $interactiveRequest = new PostRedirectUrlInteractiveRequest('anUrl', array('foo' => 'foo')); $event = new GetResponseForExceptionEvent($this->createHttpKernelMock(), new Request(), 'requestType', $interactiveRequest); $listener = new InteractiveRequestListener(); $listener->onKernelException($event); $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $event->getResponse()); $this->assertEquals(200, $event->getResponse()->getStatusCode()); $this->assertEquals($interactiveRequest->getContent(), $event->getResponse()->getContent()); }