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)); }
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); }
public function testNotInCacheAtInitialization() { $o = new FileAccess(__FILE__); $this->assertFalse($o->inCache(__FILE__)); }
public function testFilePathSameAsGetUri() { $o = new FileAccess(__FILE__); $this->assertEquals(__FILE__, $o->getUri()); }
public function testBasicGetFile() { $this->assertEquals(file_get_contents(__FILE__), FileAccess::getFile(__FILE__)); }
public function testEmptyAtInitialization() { $o = new FileAccess(__FILE__); $this->assertNull($o->getCachePath()); }
public function testBasicSetCachePath() { $o = new FileAccess(__FILE__); $o->setCachePath(VSC_FIXTURE_PATH); $this->assertEquals(VSC_FIXTURE_PATH, $o->getCachePath()); }
public function testEmpty() { $o = new FileAccess(''); $this->assertEquals(DIRECTORY_SEPARATOR, $o->getLocalPath('')); }
public function testBasicInitialization() { $o = new FileAccess(__FILE__); $this->assertEquals(__FILE__, $o->getUri()); }
public function testLocalFileIsLocal() { $o = new FileAccess(__FILE__); $this->assertTrue($o->isLocalFile()); }
public function testGetSignatureSameAsMD5OfPathDate() { $o = new FileAccess(''); $this->assertEquals(md5(__FILE__ . date('Ymd')), $o->getSignature(__FILE__)); }