/** * Test * * @return void */ public function testCreateSubdir() { $cache = new CCache(); $cache->setDir(CACHE_PATH); $subdir = "__test__"; $cache->removeSubdir($subdir); $exp = "does not exist"; $res = $cache->getStatusOfSubdir($subdir, false); $this->assertEquals($exp, $res, "Subdir should not be created."); $res = $cache->getPathToSubdir($subdir); $exp = realpath(CACHE_PATH . "/{$subdir}"); $this->assertEquals($exp, $res, "Subdir path missmatch."); $exp = "exists, writable"; $res = $cache->getStatusOfSubdir($subdir); $this->assertEquals($exp, $res, "Subdir should exist."); $res = $cache->removeSubdir($subdir); $this->assertTrue($res, "Remove subdir."); }
verbose("referer host = {$refererHost}"); $autoloader = getConfig('autoloader', false); $cimageClass = getConfig('cimage_class', false); if ($autoloader) { require $autoloader; } elseif ($cimageClass) { require $cimageClass; } $img = new CImage(); $img->setVerbose($verbose || $verboseFile); $cachePath = getConfig('cache_path', __DIR__ . '/../cache/'); $cache = new CCache(); $cache->setDir($cachePath); $allowRemote = getConfig('remote_allow', false); if ($allowRemote && $passwordMatch !== false) { $cacheRemote = $cache->getPathToSubdir("remote"); $pattern = getConfig('remote_pattern', null); $img->setRemoteDownload($allowRemote, $cacheRemote, $pattern); $whitelist = getConfig('remote_whitelist', null); $img->setRemoteHostWhitelist($whitelist); } $shortcut = get(array('shortcut', 'sc'), null); $shortcutConfig = getConfig('shortcut', array('sepia' => "&f=grayscale&f0=brightness,-10&f1=contrast,-20&f2=colorize,120,60,0,0&sharpen")); verbose("shortcut = {$shortcut}"); if (isset($shortcut) && isset($shortcutConfig[$shortcut])) { parse_str($shortcutConfig[$shortcut], $get); verbose("shortcut-constant = {$shortcutConfig[$shortcut]}"); $_GET = array_merge($_GET, $get); } $srcImage = urldecode(get('src')) or errorPage('Must set src-attribute.', 404); $imagePath = getConfig('image_path', __DIR__ . '/img/');
/** * Setup environment * * @return void */ protected function setUp() { $cache = new CCache(); $cache->setDir(CACHE_PATH); $this->cachepath = $cache->getPathToSubdir(self::DUMMY); }