/** * Get View * * @return \Tlumx\View\View */ public function getView() { if (!$this->_view) { $this->_view = $this->getServiceProvider()->getView(); if ($this->getServiceProvider()->getTemplatesManager()->hasTemplatePath($this->_controllerName)) { $path = $this->getServiceProvider()->getTemplatesManager()->getTemplatePath($this->_controllerName); $this->_view->setTemplatesPath($path); } } return $this->_view; }
public function testGetSetAfterBodyScript() { $view = new View(); $this->assertEquals('', $view->getAfterBodyScripts()); $view->appendAfterBodyScript('file.js'); $view->appendAfterBodyScript('script', false); $expected = "<script src=\"file.js\" type=\"text/javascript\"></script>\n"; $expected .= "<script type=\"text/javascript\">script</script>"; $this->assertEquals($expected, $view->getAfterBodyScripts()); $view->prependAfterBodyScript('file2.js'); $view->prependAfterBodyScript('script2', false); $expected2 = "<script type=\"text/javascript\">script2</script>\n"; $expected2 .= "<script src=\"file2.js\" type=\"text/javascript\"></script>\n"; $expected2 .= $expected; $this->assertEquals($expected2, $view->getAfterBodyScripts()); }