Exemplo n.º 1
0
 /**
  * @test
  */
 public function storeVersionDelegates()
 {
     $resource = Resource::create();
     $path = '/tenhunen/lipaisee.lus';
     $version = Version::get('lusso');
     $this->adapter->expects($this->once())->method('storeVersion')->with($resource, $version, $path)->will($this->returnValue('lus'));
     $this->ed->expects($this->once())->method('dispatch')->with(Events::BEFORE_STORE, $this->isInstanceOf('Xi\\Filelib\\Event\\StorageEvent'));
     $this->assertEquals('lus', $this->storage->storeVersion($resource, $version, $path));
 }
Exemplo n.º 2
0
 public function provideAllVersions(File $file)
 {
     $versionable = $this->getApplicableVersionable($file);
     $versions = $this->createAllTemporaryVersions($file);
     foreach ($versions as $version => $tmp) {
         $version = Version::get($version);
         $this->storage->storeVersion($versionable, $version, $tmp);
         $versionable->addVersion($version);
         unlink($tmp);
     }
     $this->fileRepository->update($file);
     $event = new VersionProviderEvent($this, $file, array_keys($versions));
     $this->eventDispatcher->dispatch(Events::VERSIONS_PROVIDED, $event);
 }