Ejemplo n.º 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());
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 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);
 }