/** * @expectedException snakevil\zen\Utility\ExCacheWriteDenied */ public function testGenerateWriteDenied() { $p_sub = $this->vfs->url() . '/' . time(); mkdir($p_sub, 0500); Unit::root($p_sub); $this->unit->store(microtime()); }
/** * 缓存指定视图。 * * @param ZenView\IView $view 待缓存地视图 * @param string $path 缓存文件路径 * @param \DateTime|string|int $expires 可选。指定过期时间 * @param \DateTime|string|int $mtime 可选。指定修改时间 * * @return bool */ protected function cache(ZenView\IView $view, $path, $expires = false, $mtime = false) { if ($this->inDev() || !isset($this->config['caching.solid'])) { return false; } $s_lob = (string) $view; if (!$s_lob) { return false; } zen\Utility\Cache::root($this->config['caching.solid']); $o_cache = new zen\Utility\Cache($path); $o_cache->store($s_lob, $mtime); if (false !== $expires) { $o_cache->expires($expires); } return true; }