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)); + } +}