Example #1
0
 /**
  * Flush the in-memory caches for this request - $isFileCache
  * and $isDirCache
  */
 public static function resetMemoryCaches()
 {
     self::$isFileCache = array();
     self::$isDirCache = array();
 }
 function testGetUrlFetchedNoRefetchYet()
 {
     $bucket = $this->getS3Bucket();
     $s3 = $this->getS3Client();
     $storage = new binarypool_storage_driver_s3($bucket['storage'], $s3, $this->getMockCache(), $this->time);
     $s3->expectOnce('getObjectInfo', array('bin.staticlocal.ch', 'test/downloaded/9f/9fae60fc483eef3a55cbad16b9f13c94eb81a5de.link', false));
     $s3->setReturnValue('getObjectInfo', true);
     $s3->expectAt(0, 'getObject', array('bin.staticlocal.ch', 'test/downloaded/9f/9fae60fc483eef3a55cbad16b9f13c94eb81a5de.link'));
     $s3->setReturnValueAt(0, 'getObject', $this->prepareGetObjectResponse(json_encode(array('link' => '../../../9f/9fae60fc483eef3a55cbad16b9f13c94eb81a5de/index.xml', 'mtime' => $this->time - 10))));
     $retval = $storage->getURLLastModified('http://www.patrice.ch/', 'test/downloaded/9f/9fae60fc483eef3a55cbad16b9f13c94eb81a5de', 'test_s3');
     $this->assertEqual($retval, array('time' => $this->time - 10, 'revalidate' => false, 'cache_age' => 10));
 }