function testLoadFromCache() { $php = ' <?php $cache_resolved_paths = array("path-to-file' . md5(serialize(array())). '" => "resolved-path-to-file"); ?>'; file_put_contents($this->cache_file, $php); $local_resolver = new CachingFileResolver($this->wrapped_resolver); $this->wrapped_resolver->expectNever('resolve'); $this->assertEqual($local_resolver->resolve('path-to-file'), 'resolved-path-to-file'); unlink($this->cache_file); }
function testLoadFromCache() { $php = ' <?php $cache_resolved_paths = array("path-to-file' . md5(serialize(array())). '" => "resolved-path-to-file"); ?>'; $fh = fopen($this->cache_file, 'w'); fwrite($fh, $php, strlen($php)); fclose($fh); $this->wrapped_resolver->expectNever('resolve'); $local_resolver = new CachingFileResolver($this->wrapped_resolver); $this->assertEqual($local_resolver->resolve('path-to-file'), 'resolved-path-to-file'); unlink($this->cache_file); }