示例#1
0
 function testSetters()
 {
     $templateXML = simplexml_load_string($this->fullTemplateString, "SimpleXMLElement");
     $template = new TemplateDef($templateXML);
     // test param merger
     $this->assertEquals(5, count($template->getParams()));
     $template->addParam("newKey", "newValue");
     $this->assertEquals(6, count($template->getParams()));
     $this->assertEquals("newValue", $template->getParam("newKey"));
     // test original path
     $this->assertEquals("templates/default.php", $template->getPath());
     $template->setPath("templates/minimal.php");
     // should not change due to already being set
     $this->assertEquals("templates/default.php", $template->getPath());
     // test override when nothing orginally set
     $templateXML = simplexml_load_string($this->noPathTemplateString, "SimpleXMLElement");
     $template = new TemplateDef($templateXML);
     $this->assertEquals("", $template->getPath());
     $template->setPath("templates/minimal.php");
     $this->assertEquals("templates/minimal.php", $template->getPath());
 }