Exemplo n.º 1
0
 public function testBasicSetFileContent()
 {
     $value = uniqid('test:');
     $o = new StaticFileModel();
     $o->setFileContent($value);
     $this->assertEquals($value, $o->getFileContent());
 }
Exemplo n.º 2
0
 public function testBasicSetLastModifed()
 {
     $now = date('Y-m-d');
     $o = new StaticFileModel();
     $o->setLastModified($now);
     $this->assertEquals($now, $o->getLastModified());
 }
Exemplo n.º 3
0
 public function fetch($includePath)
 {
     $oModel = $this->getModel();
     /* @var StaticFileModel $oModel */
     if (StaticFileModel::isValid($oModel)) {
         return $oModel->getFileContent();
     } else {
         return parent::fetch($includePath);
     }
 }
Exemplo n.º 4
0
 public function handleRequest(HttpRequestA $oHttpRequest)
 {
     $oModel = new StaticFileModel();
     $oModel->setFilePath($this->sFilePath);
     return $oModel;
 }
Exemplo n.º 5
0
 public function testBasicGetFilePath()
 {
     $o = new StaticFileModel();
     $o->setFilePath(__FILE__);
     $this->assertEquals(__FILE__, $o->getFilePath());
 }
Exemplo n.º 6
0
 public function testBasic__get()
 {
     $o = new StaticFileModel();
     $o->setFilePath(__FILE__);
     $this->assertEquals(file_get_contents(__FILE__), $o->getFileContent());
 }
Exemplo n.º 7
0
 public function testGetLastModifiedMatchesFilemtimeOfFile()
 {
     $o = new StaticFileModel();
     $o->setFilePath(__FILE__);
     $this->assertEquals(date('Y-m-d G:i:s', filemtime(__FILE__)), $o->getLastModified());
 }
Exemplo n.º 8
0
 public function testGetFileNameMatchesAfterSet()
 {
     $o = new StaticFileModel();
     $o->setFilePath(__FILE__);
     $this->assertEquals(basename(__FILE__), $o->getFileName());
 }