Пример #1
0
 public function testLoadFromCacheWorks()
 {
     $file = 'test';
     $value = uniqid('test:');
     $o = new FileAccess('');
     $o->setCachePath(VSC_FIXTURE_PATH);
     $o->cacheFile($file, $value);
     $this->assertEquals($value, $o->loadFromCache($file));
     unlink(VSC_FIXTURE_PATH . $o->getSignature($file));
 }
Пример #2
0
 public function testBasicCacheFile()
 {
     $value = uniqid('test:');
     $file = __FILE__;
     $o = new FileAccess(__FILE__);
     $o->setCachePath(VSC_FIXTURE_PATH);
     $o->cacheFile($file, $value);
     $sig = $o->getSignature($file);
     $this->assertTrue(is_file(VSC_FIXTURE_PATH . $sig));
     $this->assertEquals($value, file_get_contents(VSC_FIXTURE_PATH . $sig));
     unlink(VSC_FIXTURE_PATH . $sig);
 }
Пример #3
0
 public function testNotInCacheAtInitialization()
 {
     $o = new FileAccess(__FILE__);
     $this->assertFalse($o->inCache(__FILE__));
 }
Пример #4
0
 public function testFilePathSameAsGetUri()
 {
     $o = new FileAccess(__FILE__);
     $this->assertEquals(__FILE__, $o->getUri());
 }
Пример #5
0
 public function testBasicGetFile()
 {
     $this->assertEquals(file_get_contents(__FILE__), FileAccess::getFile(__FILE__));
 }
Пример #6
0
 public function testEmptyAtInitialization()
 {
     $o = new FileAccess(__FILE__);
     $this->assertNull($o->getCachePath());
 }
Пример #7
0
 public function testBasicSetCachePath()
 {
     $o = new FileAccess(__FILE__);
     $o->setCachePath(VSC_FIXTURE_PATH);
     $this->assertEquals(VSC_FIXTURE_PATH, $o->getCachePath());
 }
Пример #8
0
 public function testEmpty()
 {
     $o = new FileAccess('');
     $this->assertEquals(DIRECTORY_SEPARATOR, $o->getLocalPath(''));
 }
Пример #9
0
 public function testBasicInitialization()
 {
     $o = new FileAccess(__FILE__);
     $this->assertEquals(__FILE__, $o->getUri());
 }
Пример #10
0
 public function testLocalFileIsLocal()
 {
     $o = new FileAccess(__FILE__);
     $this->assertTrue($o->isLocalFile());
 }
Пример #11
0
 public function testGetSignatureSameAsMD5OfPathDate()
 {
     $o = new FileAccess('');
     $this->assertEquals(md5(__FILE__ . date('Ymd')), $o->getSignature(__FILE__));
 }