Пример #1
0
 public function testSetTemplate()
 {
     $o = new testView();
     $oMap = new ClassMap(__FILE__, '\\A.*\\Z');
     $oMap->setTemplatePath(VSC_FIXTURE_PATH . 'templates/');
     $oMap->setTemplate('main.tpl.php');
     $o->setMap($oMap);
     $this->assertEquals($oMap->getTemplate(), $o->getTemplate());
     $this->assertEquals($oMap->getTemplatePath(), $o->getTemplatePath());
 }
Пример #2
0
 public function testGetTitleFromModel()
 {
     $o = new testView();
     try {
         $this->assertEmpty($o->getTitle());
     } catch (\Exception $e) {
         // catching a model exception
     }
     $oMap = new ClassMap(__FILE__, '\\A.*\\Z');
     $oMap->setTemplatePath(VSC_FIXTURE_PATH . 'templates/');
     $oMap->setTemplate('main.tpl.php');
     $o->setMap($oMap);
     $f = new EmptyModel();
     $o->setModel($f);
     $this->assertEmpty($o->getTitle());
     $t = uniqid('test:');
     $f->setPageTitle($t);
     $this->assertEquals($t, $o->getTitle());
 }
Пример #3
0
 public function testGetOutput()
 {
     $o = new testView();
     try {
         $o->getOutput();
     } catch (\Exception $e) {
         $this->assertInstanceOf(Exception::class, $e);
         $this->assertInstanceOf(ExceptionView::class, $e);
     }
     $t = 'main.tpl.php';
     $oMap = new ClassMap(__FILE__, '\\A.*\\Z');
     $oMap->setTemplatePath(VSC_FIXTURE_PATH . 'templates/');
     $oMap->setTemplate($t);
     $o->setMap($oMap);
     $f = new ModelFixture();
     $o->setModel($f);
     $output = $o->getOutput();
     $this->assertEquals(file_get_contents(VSC_FIXTURE_PATH . 'templates/' . $t), $output);
 }