/** * @param \Gaufrette\Filesystem $filesystem * @param \Gaufrette\Adapter $adapter */ function it_should_not_set_metadata_by_default($filesystem, $adapter) { $metadata = array('id' => '123'); $adapter->setMetadata('filename', $metadata)->shouldNotBeCalled(); $filesystem->getAdapter()->willReturn($adapter); $this->setContent('some content', $metadata); }
/** * Write content to the primary adapter from the fallback */ protected function writeContentToPrimary($key, $contents) { $this->primary->write($key, $contents); if ($this->primary instanceof Adapter\MetadataSupporter && $this->fallback instanceof Adapter\MetadataSupporter) { $this->primary->setMetadata($key, $this->fallback->getMetadata($key)); } }
/** * @param \Gaufrette\Adapter $source * @param \Gaufrette\Adapter $cache */ function it_should_ignore_metadata_when_cached_adapters_does_not_support_metadata($source, $cache) { $source->setMetadata('filename', array('metadata'))->shouldNotBeCalled(); $cache->setMetadata('filename', array('metadata'))->shouldNotBeCalled(); $source->getMetadata('filename')->shouldNotBeCalled(); $this->setMetadata('filename', array('metadata')); $this->getMetadata('filename')->shouldReturn(false); }
/** * {@inheritdoc} */ public function setMetadata($key, $metadata) { if ($this->master instanceof MetadataSupporter) { $this->master->setMetadata($key, $metadata); } if ($this->slave instanceof MetadataSupporter) { $this->slave->setMetadata($key, $metadata); } }
/** * {@inheritdoc} */ public function setMetadata($key, $metadata) { if ($this->source instanceof MetadataSupporter) { $this->source->setMetadata($key, $metadata); } if ($this->cache instanceof MetadataSupporter) { $this->cache->setMetadata($key, $metadata); } }
/** * @param \Gaufrette\Adapter $adapter */ function it_should_not_delegate_metadata_when_delegate_object_does_not_support_it($adapter) { $adapter->setMetadata('filename', array('some'))->shouldNotBeCalled(); $adapter->getMetadata('filename')->shouldNotBeCalled(); $this->setMetadata('filename', array('some')); $this->getMetadata('filename')->shouldReturn(array()); }