public function getProvider(Browser $browser = null) { if (!$browser) { $browser = $this->getMockBuilder('Buzz\\Browser')->getMock(); } $resizer = $this->getMock('Sonata\\MediaBundle\\Resizer\\ResizerInterface'); $resizer->expects($this->any())->method('resize')->will($this->returnValue(true)); $resizer->expects($this->any())->method('getBox')->will($this->returnValue(new Box(100, 100))); $adapter = $this->getMock('Gaufrette\\Adapter'); $filesystem = $this->getMock('Gaufrette\\Filesystem', array('get'), array($adapter)); $file = $this->getMock('Gaufrette\\File', array(), array('foo', $filesystem)); $filesystem->expects($this->any())->method('get')->will($this->returnValue($file)); $cdn = new \Sonata\MediaBundle\CDN\Server('/updoads/media'); $generator = new \Sonata\MediaBundle\Generator\DefaultGenerator(); $thumbnail = new FormatThumbnail('jpg'); $provider = new YouTubeProvider('file', $filesystem, $cdn, $generator, $thumbnail, $browser); $provider->setResizer($resizer); return $provider; }