示例#1
0
 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);
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function save(File $file, Adapter $adapter)
 {
     $datetime = $file->getLastAccess();
     if (null !== $datetime) {
         $adapter->writeLastAccess($file->getName(), $datetime->format('U'));
     }
     return $this;
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function save(File $file, Adapter $adapter)
 {
     $adapter->writeMetadata($file->getName(), $file->getMetadata());
 }
示例#4
0
 function let(CanUseFile $adapter, Adapter $other, File $file)
 {
     $adapter->implement('Gaufrette\\Core\\Adapter');
     $file->getName()->willReturn('file.png');
 }
示例#5
0
 function it_sets_mimeType(KnowsMimeType $adapter, File $file)
 {
     $file->setMimeType('text/plain')->shouldBeCalled();
     $this->load($file, $adapter);
 }
示例#6
0
 /**
  * {@inheritdoc}
  */
 public function load(File $file, Adapter $adapter)
 {
     $file->setSize($adapter->readSize($file->getName()));
 }
示例#7
0
 function it_sets_size(KnowsSize $adapter, File $file)
 {
     $file->setSize(1234567890)->shouldBeCalled();
     $this->load($file, $adapter);
 }
示例#8
0
 /**
  * {@inheritdoc}
  */
 public function save(File $file, Adapter $adapter)
 {
     $adapter->writeContent($file->getName(), $file->getContent());
 }
示例#9
0
 /**
  * {@inheritdoc}
  */
 public function load(File $file, Adapter $adapter)
 {
     $file->setChecksum($adapter->readChecksum($file->getName()));
 }
示例#10
0
 function it_reads_metadata(KnowsMetadata $adapter, File $file)
 {
     $file->setMetadata(array('adapter' => true))->shouldBeCalled();
     $this->load($file, $adapter);
 }
示例#11
0
 /**
  * {@inheritdoc}
  */
 public function load(File $file, Adapter $adapter)
 {
     $file->setMimeType($adapter->readMimeType($file->getName()));
 }
示例#12
0
 function it_sets_content(KnowsContent $adapter, File $file)
 {
     $file->setContent('the adapter content')->shouldBeCalled();
     $this->load($file, $adapter);
 }
示例#13
0
 function it_sets_content(KnowsChecksum $adapter, File $file)
 {
     $file->setChecksum('thechecksum')->shouldBeCalled();
     $this->load($file, $adapter);
 }