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