public function testFileWithTrailingSlash() { $dir = sys_get_temp_dir() . '/google-api-php-client/tests/'; $cache = new Google_Cache_File($dir); $cache->set('foo', 'bar'); $this->assertEquals($cache->get('foo'), 'bar'); $this->getSetDelete($cache); }
public function testFile() { $dir = sys_get_temp_dir() . '/google-api-php-client/tests'; $client = $this->getClient(); $client->setClassConfig('Google_Cache_File', 'directory', $dir); $cache = new Google_Cache_File($client); $cache->set('foo', 'bar'); $this->assertEquals($cache->get('foo'), 'bar'); $this->getSetDelete($cache); }
public function testCacheFilePermissions() { $dir = sys_get_temp_dir() . '/google-api-php-client/tests/'; $cache = new Google_Cache_File($dir); $cache->set('foo', 'bar'); $method = new ReflectionMethod($cache, 'getWriteableCacheFile'); $method->setAccessible(true); $filename = $method->invoke($cache, 'foo'); $stat = stat($filename); $this->assertEquals(0600, $stat['mode'] & 0777); }