Ejemplo n.º 1
0
 /**
  * @param \Gaufrette\Adapter $adapter
  */
 function it_fails_when_rename_is_not_successful($adapter)
 {
     $adapter->exists('filename')->willReturn(true);
     $adapter->exists('otherFilename')->willReturn(false);
     $adapter->rename('filename', 'otherFilename')->willReturn(false);
     $this->shouldThrow(new \RuntimeException('Could not rename the "filename" key to "otherFilename".'))->duringRename('filename', 'otherFilename');
 }
 /**
  * @param \Gaufrette\Adapter $adapter
  * @param \AmazonS3 $service
  */
 function it_updates_acl_with_users_array_when_rename($adapter, $service)
 {
     $service->set_object_acl('bucketName', 'filename2', array(array('id' => 'someId', 'permission' => \AmazonS3::GRANT_READ)))->shouldBeCalled()->willReturn(new \CFResponse(array(), '', 200));
     $adapter->rename('filename', 'filename2')->willReturn(true);
     $this->setUsers(array(array('id' => 'someId', 'permission' => 'read')));
     $this->rename('filename', 'filename2')->shouldReturn(true);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function rename($key, $new)
 {
     $ok = true;
     try {
         $this->master->rename($key, $new);
     } catch (\Exception $e) {
         if ($this->logger) {
             $this->logger->critical(sprintf('Unable to rename %s, error: %s', $key, $e->getMessage()));
         }
         $ok = false;
     }
     try {
         $this->slave->rename($key, $new);
     } catch (\Exception $e) {
         if ($this->logger) {
             $this->logger->critical(sprintf('Unable to rename %s, error: %s', $key, $e->getMessage()));
         }
         $ok = false;
     }
     return $ok;
 }
Ejemplo n.º 4
0
 /**
  * @param $sourceKey
  * @param $targetKey
  * @return mixed
  */
 public function rename($sourceKey, $targetKey)
 {
     return $this->gaufretteAdapter->rename($sourceKey, $targetKey);
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function rename($key, $new)
 {
     return $this->source->rename($key, $new) && $this->cache->rename($key, $new);
 }
Ejemplo n.º 6
0
 /**
  * @param \Gaufrette\Adapter $source
  * @param \Gaufrette\Adapter $cache
  */
 function it_should_rename_file_in_source_and_cache($source, $cache)
 {
     $source->rename('filename', 'filename2')->shouldBeCalled();
     $cache->rename('filename', 'filename2')->shouldBeCalled()->willReturn(true);
     $this->rename('filename', 'filename2')->shouldReturn(true);
 }
Ejemplo n.º 7
0
 /**
  * {@InheritDoc}
  */
 public function rename($key, $new)
 {
     $this->source->rename($key, $new);
     $this->cache->rename($key, $new);
 }
 /**
  * {@inheritDoc}
  */
 public function rename($key, $new)
 {
     return $this->primary->rename($key, $new);
 }