. * */ OC::autoload('OC_Template'); class Test_TemplateFunctions extends PHPUnit_Framework_TestCase { public function testP() { // FIXME: do we need more testcases? $htmlString = ""; ob_start(); p($htmlString); $result = ob_get_clean(); $this->assertEquals("<script>alert('xss');</script>", $result); } public function testPNormalString() { $normalString = "This is a good string!"; ob_start(); p($normalString); $result = ob_get_clean(); $this->assertEquals("This is a good string!", $result); } public function testPrintUnescaped() { $htmlString = ""; ob_start(); print_unescaped($htmlString); $result = ob_get_clean(); $this->assertEquals($htmlString, $result); } public function testPrintUnescapedNormalString() { $normalString = "This is a good string!"; ob_start(); print_unescaped($normalString); $result = ob_get_clean(); $this->assertEquals("This is a good string!", $result); } }