Ejemplo n.º 1
0
 /**
  * @test
  */
 public function providesAllVersions()
 {
     copy(ROOT_TESTS . '/data/self-lussing-manatee.jpg', ROOT_TESTS . '/data/temp/temporary-manatee.jpg');
     copy(ROOT_TESTS . '/data/self-lussing-manatee.jpg', ROOT_TESTS . '/data/temp/temporary-manatee2.jpg');
     $this->assertFileExists(ROOT_TESTS . '/data/temp/temporary-manatee.jpg');
     $this->assertFileExists(ROOT_TESTS . '/data/temp/temporary-manatee2.jpg');
     $file = File::create(array('resource' => Resource::create()));
     $this->plugin->attachTo($this->filelib);
     $this->plugin->expects($this->any())->method('getProvidedVersions')->will($this->returnValue(array('tooxer', 'mooxer')));
     $this->plugin->expects($this->once())->method('doCreateAllTemporaryVersions')->will($this->returnValue(array('tooxer' => ROOT_TESTS . '/data/temp/temporary-manatee.jpg', 'mooxer' => ROOT_TESTS . '/data/temp/temporary-manatee2.jpg')));
     $this->plugin->expects($this->exactly(1))->method('areSharedVersionsAllowed')->will($this->returnValue(false));
     $this->storage->expects($this->exactly(2))->method('storeVersion')->with($this->isInstanceOf('Xi\\Filelib\\File\\File'), $this->isInstanceOf('Xi\\Filelib\\Version'), $this->isType('string'));
     $this->fire->expects($this->once())->method('update')->with($file);
     $this->ed->expects($this->once())->method('dispatch')->with(VPEvents::VERSIONS_PROVIDED, new VersionProviderEvent($this->plugin, $file, array(Version::get('tooxer'), Version::get('mooxer'))));
     $this->plugin->provideAllVersions($file);
     $this->assertFileNotExists(ROOT_TESTS . '/data/temp/temporary-manatee.jpg');
     $this->assertFileNotExists(ROOT_TESTS . '/data/temp/temporary-manatee2.jpg');
 }
Ejemplo n.º 2
0
 /**
  * @param FileLibrary $filelib
  */
 public function attachTo(FileLibrary $filelib)
 {
     parent::attachTo($filelib);
     $this->tempFiles = $filelib->getTemporaryFileManager();
 }