/** * @dataProvider providerTestRender */ public function testRender($name, $form, $exceptionName = '') { $sourceFolder = Miao_PHPUnit::getSourceFolder(__METHOD__); $actualFilename = $sourceFolder . '/form_' . $name . '_actual.html'; $actual = file_get_contents($actualFilename); $tmplFilename = 'form_' . $name . '.tpl'; $tmpl = new Miao_TemplatesEngine_PhpNative($sourceFolder, true); $tmpl->setValueOf('form', $form); $expected = $tmpl->fetch($tmplFilename); $this->assertEquals($this->_clearSpace($expected), $this->_clearSpace($actual)); }
/** * * Enter description here ... * @param string $templates Default = index.tpl */ public function fetch($templates = '') { if (!empty($templates) && is_string($templates)) { $templates = array($templates); } if (empty($templates)) { $templates = $this->_templates; } $result = ''; foreach ($templates as $templateName) { $result .= $this->_templateEngine->fetch($templateName); } return $result; }
/** * @dataProvider providerTestException * @param unknown_type $tmplDir * @param unknown_type $debugMode * @param unknown_type $templateFilename * @param unknown_type $actual * @param unknown_type $exception */ public function testException($tmplDir, $debugMode, $templateFilename, $expected, $exception = '') { $tplObj = new Miao_TemplatesEngine_PhpNative($tmplDir, $debugMode); $actual = $tplObj->fetch($templateFilename); $this->assertEquals($expected, $actual); }