예제 #1
0
 /**
  * @test
  */
 public function providesVersion()
 {
     copy(ROOT_TESTS . '/data/self-lussing-manatee.jpg', ROOT_TESTS . '/data/temp/temporary-manatee.jpg');
     $this->assertFileExists(ROOT_TESTS . '/data/temp/temporary-manatee.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')));
     $this->plugin->expects($this->once())->method('doCreateTemporaryVersion')->will($this->returnValue(array('tooxer', ROOT_TESTS . '/data/temp/temporary-manatee.jpg')));
     $this->plugin->expects($this->exactly(1))->method('areSharedVersionsAllowed')->will($this->returnValue(false));
     $this->storage->expects($this->once())->method('storeVersion')->with($this->isInstanceOf('Xi\\Filelib\\File\\File'), Version::get('tooxer'), ROOT_TESTS . '/data/temp/temporary-manatee.jpg');
     $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'))));
     $this->plugin->provideVersion($file, Version::get('tooxer'));
     $this->assertFileNotExists(ROOT_TESTS . '/data/temp/temporary-manatee.jpg');
 }