function let(KnowsLastAccess $adapter, Adapter $other, File $file) { $date = new \DateTime('2015-01-01', new \DateTimeZone("Europe/Paris")); $adapter->implement('Gaufrette\\Core\\Adapter'); $adapter->readLastAccess('file.png')->willReturn(1234566000); $file->getName()->willReturn('file.png'); $file->getLastAccess()->willReturn($date); }
/** * {@inheritdoc} */ public function save(File $file, Adapter $adapter) { $datetime = $file->getLastAccess(); if (null !== $datetime) { $adapter->writeLastAccess($file->getName(), $datetime->format('U')); } return $this; }
/** * {@inheritdoc} */ public function save(File $file, Adapter $adapter) { $adapter->writeMetadata($file->getName(), $file->getMetadata()); }
function let(CanUseFile $adapter, Adapter $other, File $file) { $adapter->implement('Gaufrette\\Core\\Adapter'); $file->getName()->willReturn('file.png'); }
function it_sets_mimeType(KnowsMimeType $adapter, File $file) { $file->setMimeType('text/plain')->shouldBeCalled(); $this->load($file, $adapter); }
/** * {@inheritdoc} */ public function load(File $file, Adapter $adapter) { $file->setSize($adapter->readSize($file->getName())); }
function it_sets_size(KnowsSize $adapter, File $file) { $file->setSize(1234567890)->shouldBeCalled(); $this->load($file, $adapter); }
/** * {@inheritdoc} */ public function save(File $file, Adapter $adapter) { $adapter->writeContent($file->getName(), $file->getContent()); }
/** * {@inheritdoc} */ public function load(File $file, Adapter $adapter) { $file->setChecksum($adapter->readChecksum($file->getName())); }
function it_reads_metadata(KnowsMetadata $adapter, File $file) { $file->setMetadata(array('adapter' => true))->shouldBeCalled(); $this->load($file, $adapter); }
/** * {@inheritdoc} */ public function load(File $file, Adapter $adapter) { $file->setMimeType($adapter->readMimeType($file->getName())); }
function it_sets_content(KnowsContent $adapter, File $file) { $file->setContent('the adapter content')->shouldBeCalled(); $this->load($file, $adapter); }
function it_sets_content(KnowsChecksum $adapter, File $file) { $file->setChecksum('thechecksum')->shouldBeCalled(); $this->load($file, $adapter); }