- View::set_cache_path($path);
- $this->assertEquals($path, View::cache_path());
- }
-
- public function testCtorAndTemplateName()
- {
- $view = $this->getMock('phalanx\views\View', NULL, array('test_tpl'));
- $this->assertEquals('test_tpl', $view->template_name());
-
- $this->assertType('phalanx\base\Dictionary', $view->vars());
- $this->assertEquals(0, $view->vars()->Count());
- }
-
- public function testProcessTemplateEntities()
- {
- $view = new TestView('test');
- $data = '<strong>Some day, is it not, <'.'?php echo "Rob" ?'.'>?</strong>';
- $this->assertEquals($data, $view->T_ProcessTemplate($data));
- }
-
- public function testProcessTemplateMacro()
- {
- $view = new TestView('test');
- $in = 'foo $[some.value] bar';
- $out = 'foo <?php echo $view->GetHTML("some.value") ?> bar';
- $this->assertEquals($out, $view->T_ProcessTemplate($in));
- }
-
- public function testProcessTemplateShortTags()
- {
- $view = new TestView('test');
- $in = 'foo <?php echo "Not this one"; ?> bar <? echo "But this one!" ?> moo';
- $out = 'foo <?php echo "Not this one"; ?> bar <?php echo "But this one!" ?> moo';
- $this->assertEquals($out, $view->T_ProcessTemplate($in));
- }
-
- public function testMagicGetterSetter()
- {
- $view = new View('test');
- $view->foo = 'abc';
- $this->assertEquals('abc', $view->foo);
- $this->assertEquals('abc', $view->vars()->Get('foo'));
-
- $view->foo = array();
- $view->{"foo.bar"} = '123';
- $this->assertEquals('123', $view->{"foo.bar"});
- $this->assertEquals('123', $view->vars()->Get('foo.bar'));