Esempio n. 1
0
 /**
  * @test
  */
 public function canBeEagerAndPreCreateSomeVersions()
 {
     $this->arbitrary->enableLazyMode(false);
     $manateePath = ROOT_TESTS . '/data/self-lussing-manatee.jpg';
     $file = $this->filelib->uploadFile(new FileUpload($manateePath));
     $this->assertInstanceOf('Xi\\Filelib\\File\\File', $file);
     $resource = $file->getResource();
     $this->assertCount(5, $resource->getVersions());
 }
 /**
  * @test
  */
 public function createsTemporaryVersions()
 {
     $plugin = new ArbitraryVersionPlugin('arbitrary', function () {
         return array('xoo');
     }, function () {
         return array();
     }, function () {
         return array('xoo' => 'xuu');
     }, function () {
         return true;
     }, function () {
         return array();
     }, function () {
         return 'image/jpeg';
     });
     $resource = Resource::create(array('mimetype' => 'image/jpeg'));
     $file = File::create(array('resource' => $resource));
     $storage = $this->getMockedStorage();
     $storage->expects($this->atLeastOnce())->method('retrieve')->with($resource)->will($this->returnValue(ROOT_TESTS . '/data/self-lussing-manatee.jpg'));
     $filelib = $this->getMockedFilelib(null, array('tempDir' => ROOT_TESTS . '/data/temp', 'storage' => $storage));
     $plugin->attachTo($filelib);
     $ret = $plugin->createAllTemporaryVersions($file);
     $this->assertCount(1, $ret);
     $this->assertArrayHasKey('arbitrary::xoo:xuu', $ret);
     $this->assertStringStartsWith(ROOT_TESTS . '/data/temp', array_pop($ret));
 }