diff --git a/tests/lib/template.php b/tests/lib/template.php
new file mode 100644
index 0000000000..27feec13d0
--- /dev/null
+++ b/tests/lib/template.php
@@ -0,0 +1,67 @@
+.
+*
+*/
+
+require_once("lib/template.php");
+
+class Test_TemplateFunctions extends UnitTestCase {
+
+ public function testP(){
+ // FIXME: do we need more testcases?
+ $htmlString = "";
+ ob_start();
+ p($htmlString);
+ $result = ob_get_clean();
+
+ $this->assertEqual($result, "<script>alert('xss');</script>");
+
+ ob_end_clean();
+ $normalString = "This is a good string!";
+ ob_start();
+ p($normalString);
+ $result = ob_get_clean();
+
+ $this->assertEqual($result, "This is a good string!");
+
+ }
+
+
+ public function testPrintUnescaped(){
+ $htmlString = "";
+
+ ob_start();
+ print_unescaped($htmlString);
+ $result = ob_get_clean();
+
+ $this->assertEqual($result, $htmlString);
+
+ ob_end_clean();
+ $normalString = "This is a good string!";
+ ob_start();
+ p($normalString);
+ $result = ob_get_clean();
+
+ $this->assertEqual($result, "This is a good string!");
+
+ }
+
+
+}
\ No newline at end of file