/** * {@inheritdoc} */ public function save(File $file, Adapter $adapter) { $datetime = $file->getLastAccess(); if (null !== $datetime) { $adapter->writeLastAccess($file->getName(), $datetime->format('U')); } return $this; }
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); }