コード例 #1
0
ファイル: StorageTest.php プロジェクト: kankje/xi-filelib
 /**
  * @test
  */
 public function retrieveExitsEarlyWithCache()
 {
     $resource = Resource::create();
     $retrieved = new Retrieved('lus', false);
     $this->adapter->expects($this->never())->method('retrieve');
     $this->adapter->expects($this->never())->method('exists');
     $this->cache->expects($this->at(0))->method('get')->with($resource)->will($this->returnValue($retrieved));
     $this->assertEquals('lus', $this->storage->retrieve($resource));
 }
コード例 #2
0
ファイル: FileCopier.php プロジェクト: kankje/xi-filelib
 /**
  * Handles impostor's resource
  *
  * @param File $file
  */
 private function handleImpostorResource(File $file)
 {
     $oldResource = $file->getResource();
     if ($oldResource->isExclusive()) {
         $retrieved = $this->storage->retrieve($oldResource);
         $resource = Resource::create();
         $resource->setDateCreated(new DateTime());
         $resource->setHash($oldResource->getHash());
         $resource->setSize($oldResource->getSize());
         $resource->setMimetype($oldResource->getMimetype());
         $this->resourceRepository->create($resource, $retrieved);
         $file->setResource($resource);
     }
 }