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