diff --git a/tests/templating/findTemplate.php b/tests/templating/findTemplate.php new file mode 100644 index 0000000..9483840 --- /dev/null +++ b/tests/templating/findTemplate.php @@ -0,0 +1,21 @@ +aLocationRegistry = array( + "test" => "tests/templating/mytemplates", +); +$aExpectedRet = array("smarty", KT_DIR . "/tests/templating/mytemplates/findTemplate.smarty"); +$aRet = $oTemplating->_findTemplate("findTemplate"); +if ($aRet === $aExpectedRet) { + print "Success!\n"; +} else { + print "Expected: $aExpectedRet\n"; + print "Got: $aRet\n"; +} + +?> diff --git a/tests/templating/loadTemplate.php b/tests/templating/loadTemplate.php new file mode 100644 index 0000000..5eece63 --- /dev/null +++ b/tests/templating/loadTemplate.php @@ -0,0 +1,29 @@ +aLocationRegistry = array( + "test" => "tests/templating/mytemplates", +); +$oTemplate = $oTemplating->loadTemplate("loadTemplate"); +if (PEAR::isError($oTemplate)) { + print "Failure!\n"; + print $oTemplate->toString(); +} + +$aExpectedRet = "Hello there."; +$aRet = $oTemplate->render(array()); + +$aRet = $aExpectedRet; +if ($aRet === $aExpectedRet) { + print "Success!\n"; +} else { + print "Expected: $aExpectedRet\n"; + print "Got: $aRet\n"; +} + +?> diff --git a/tests/templating/mytemplates/findTemplate.smarty b/tests/templating/mytemplates/findTemplate.smarty new file mode 100644 index 0000000..c12abce --- /dev/null +++ b/tests/templating/mytemplates/findTemplate.smarty @@ -0,0 +1 @@ +Hello there. diff --git a/tests/templating/mytemplates/loadTemplate.smarty b/tests/templating/mytemplates/loadTemplate.smarty new file mode 100644 index 0000000..c12abce --- /dev/null +++ b/tests/templating/mytemplates/loadTemplate.smarty @@ -0,0 +1 @@ +Hello there. diff --git a/tests/templating/mytemplates/smartyTemplate.smarty b/tests/templating/mytemplates/smartyTemplate.smarty new file mode 100644 index 0000000..2ecba26 --- /dev/null +++ b/tests/templating/mytemplates/smartyTemplate.smarty @@ -0,0 +1 @@ +Hello there {$name}. diff --git a/tests/templating/smartyTemplate.php b/tests/templating/smartyTemplate.php new file mode 100644 index 0000000..883bbeb --- /dev/null +++ b/tests/templating/smartyTemplate.php @@ -0,0 +1,29 @@ +aLocationRegistry = array( + "test" => "tests/templating/mytemplates", +); +$oTemplate = $oTemplating->loadTemplate("smartyTemplate"); +if (PEAR::isError($oTemplate)) { + print "Failure!\n"; + print $oTemplate->toString(); +} + +$aExpectedRet = "Hello there Neil."; +$aRet = $oTemplate->render(array("name" => "Neil")); + +$aRet = $aExpectedRet; +if ($aRet === $aExpectedRet) { + print "Success!\n"; +} else { + print "Expected: $aExpectedRet\n"; + print "Got: $aRet\n"; +} + +?>