/** * Fetch rendered template * * @param string $template Template pathname relative to templates directory * @param array $data Associative array of template variables * * @return string */ public function fetch($template, $data = []) { $data = array_merge($this->defaultVariables, $data); $this->smarty->assign($data); return $this->smarty->fetch($template); }
public function testFetch() { $output = $this->view->fetch('hello.tpl', ['name' => 'Matheus']); $this->assertEquals("<p>Hello, my name is Matheus.</p>\n", $output); }
public function testPlugin() { $output = $this->view->fetch('plugin.tpl'); $this->assertEquals("<p>Plugin return: base_url_test.</p>\n", $output); }