Exemple #1
0
 function testHttp_ViewSetEscape()
 {
     $locator = new A_Locator();
     $view = new A_Http_View($locator);
     $str = '<hr style="foo"> &';
     $str_escaped = '&lt;hr style=&quot;foo&quot;&gt; &amp;';
     $file = 'foobar.php';
     $view->setTemplate($file);
     $view->setTemplatePath(dirname(__FILE__) . '/templates');
     $view->setEscape('foo', $str);
     $view->set('bar', '');
     $this->assertEqual($str_escaped, $view->render());
     $view->escapeField('foo');
     $view->set('foo', $str);
     $view->set('bar', '');
     $this->assertEqual($str_escaped, $view->render());
     $view->escapeField(array('foo', 'bar'));
     $view->set('foo', $str);
     $view->set('bar', $str);
     $this->assertEqual($str_escaped . $str_escaped, $view->render());
 }