From 71ffc678c28888ebb7a1b57d1148f92efb68f3fc Mon Sep 17 00:00:00 2001 From: ornicar Date: Tue, 10 May 2011 09:21:50 -0700 Subject: [PATCH] Add HTML & XSS injection tests - they fail --- Tests/EscapingTest.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Tests/EscapingTest.php diff --git a/Tests/EscapingTest.php b/Tests/EscapingTest.php new file mode 100644 index 0000000..9e578dd --- /dev/null +++ b/Tests/EscapingTest.php @@ -0,0 +1,31 @@ +parser = new Parser(); + } + + public function testHtmlEscaping() + { + $text = 'a tag injection'; + $html = '

<a>a tag injection</a>

'; + + $this->assertSame($html, $this->parser->transform($text)); + } + + public function testScriptEscaping() + { + $text = ''; + $html = '<script>alert("haha");</script>'; + + $this->assertSame($html, $this->parser->transform($text)); + } +}