function testLoadFromCache() { $php = serialize(array("path-to-file" => "located-path-to-file")); file_put_contents($this->cache_file, $php); $this->wrapped_locator->expectNever('locate'); $local_locator = new lmbCachingFileLocator($this->wrapped_locator, LIMB_VAR_DIR); $this->assertEqual($local_locator->locate('path-to-file'), 'located-path-to-file'); unlink($this->cache_file); }
function testLocateAll_LoadFromCache() { $alias = 'path-to-dir/*/path-to-files'; $located_files = array('located-path-to-file_1', 'located-path-to-file_2'); $php = serialize(array(md5($alias) => $located_files)); file_put_contents($this->cache_file, $php); $this->wrapped_locator->expectNever('locateAll'); $local_locator = new lmbCachingFileLocator($this->wrapped_locator, LIMB_VAR_DIR); $this->assertEqual($local_locator->locateAll($alias), $located_files); }