Esempio n. 1
0
 public function testGetViewFolder()
 {
     $o = new testView();
     $t = 'test';
     $o->setFolder($t);
     $this->assertEquals($t, $o->getViewFolder());
 }
Esempio n. 2
0
 public function testSetMainTemplateBroken()
 {
     $o = new testView();
     $t = '';
     try {
         $o->setMainTemplate($t);
     } catch (\Exception $e) {
         $this->assertInstanceOf(Exception::class, $e);
         $this->assertInstanceOf(ExceptionPath::class, $e);
     }
     $this->assertEmpty($o->getMainTemplate());
 }
Esempio n. 3
0
 public function testGetModel()
 {
     $o = new testView();
     try {
         // empty
         $o->getModel();
     } catch (\Exception $e) {
         $this->assertInstanceOf(Exception::class, $e);
         $this->assertInstanceOf(ExceptionView::class, $e);
     }
     $f = new ModelFixture();
     $o->setModel($f);
     $m = $o->getModel();
     $this->assertInstanceOf(ModelA::class, $m);
     $this->assertInstanceOf(ModelFixture::class, $m);
     $this->assertEquals($f, $m);
 }
Esempio n. 4
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);
 }
Esempio n. 5
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());
 }
Esempio n. 6
0
 public function testGetMainTemplateEmpty()
 {
     $o = new testView();
     $path = $o->getMainTemplate();
     $this->assertEmpty($path);
 }
Esempio n. 7
0
 public function testGetUriParser()
 {
     $o = new testView();
     $p = $o->getUriParser();
     $this->assertInstanceOf(UrlParserA::class, $p);
 }
Esempio n. 8
0
 public function testGetContentTypeEmpty()
 {
     $o = new testView();
     $this->assertEmpty($o->getContentType());
 }