/**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->dir = vfsStream::setup();
     $dir = $this->dir;
     $tempDir = vfsStream::url($dir->getName()) . '/';
     $this->media = $this->getMock('\\Oryzone\\MediaStorage\\Model\\MediaInterface');
     $this->media->expects($this->any())->method('getContext')->will($this->returnValue('default'));
     $this->media->expects($this->any())->method('getName')->will($this->returnValue('sample'));
     $this->media->expects($this->any())->method('getContent')->will($this->returnValue('http://vimeo.com/56974716'));
     $this->media->expects($this->any())->method('getMetaValue')->will($this->returnValueMap(array(array('id', null, '56974716'))));
     $this->variant = $this->getMock('\\Oryzone\\MediaStorage\\Variant\\VariantInterface');
     $this->variant->expects($this->any())->method('getName')->will($this->returnValue('default'));
     $this->variant->expects($this->any())->method('getOptions')->will($this->returnValue(array('width' => 50, 'height' => 30, 'resize' => 'stretch')));
     $this->variant->expects($this->any())->method('getMetaValue')->will($this->returnValueMap(array(array('width', null, 50), array('height', null, 30))));
     $image = $this->getMock('\\Imagine\\Image\\ImageInterface');
     $image->expects($this->any())->method('save')->will($this->returnCallback(function ($destFile) use($dir) {
         $temp = vfsStream::newFile(basename($destFile));
         $dir->addChild($temp);
         return true;
     }));
     $imagine = $this->getMock('\\Imagine\\Image\\ImagineInterface');
     $imagine->expects($this->any())->method('open')->will($this->returnValue($image));
     $downloader = $this->getMock('\\Oryzone\\MediaStorage\\Downloader\\DownloaderInterface');
     $downloader->expects($this->any())->method('download')->will($this->returnCallback(function ($url, $destination) use($dir) {
         $temp = vfsStream::newFile(basename($destination));
         $temp->setContent(file_get_contents(__DIR__ . '/../fixtures/images/sample.jpg'));
         $dir->addChild($temp);
         return true;
     }));
     $videoService = $this->getMock('\\Oryzone\\MediaStorage\\Integration\\Video\\VideoServiceInterface');
     $this->provider = new VimeoProvider($tempDir, $imagine, $videoService, $downloader);
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->dir = vfsStream::setup();
     vfsStream::copyFromFileSystem(__DIR__ . '/../fixtures/images', $this->dir);
     $dir = $this->dir;
     $image = $this->getMock('\\Imagine\\Image\\ImageInterface');
     $image->expects($this->any())->method('save')->will($this->returnCallback(function ($destFile) use($dir) {
         $temp = vfsStream::newFile(basename($destFile));
         $dir->addChild($temp);
         return TRUE;
     }));
     $imagine = $this->getMock('\\Imagine\\Image\\ImagineInterface');
     $imagine->expects($this->any())->method('open')->will($this->returnValue($image));
     $this->media = $this->getMock('\\Oryzone\\MediaStorage\\Model\\MediaInterface');
     $this->media->expects($this->any())->method('getContext')->will($this->returnValue('default'));
     $this->media->expects($this->any())->method('getName')->will($this->returnValue('sample'));
     $this->variant = $this->getMock('\\Oryzone\\MediaStorage\\Variant\\VariantInterface');
     $this->variant->expects($this->any())->method('getName')->will($this->returnValue('default'));
     $this->variant->expects($this->any())->method('getOptions')->will($this->returnValue(array('width' => 50, 'height' => 30, 'resize' => 'stretch')));
     $this->variant->expects($this->any())->method('getMetaValue')->will($this->returnValueMap(array(array('width', NULL, 50), array('height', NULL, 30))));
     $this->provider = new ImageProvider(vfsStream::url($this->dir->getName()) . '/', $imagine);
 }