public function testThumbnail()
 {
     $provider = $this->getProvider();
     $media = new Media();
     $media->setProviderName('youtube');
     $media->setProviderReference('BDYAbAtaDzA');
     $media->setProviderMetadata(json_decode('{"provider_url": "http:\\/\\/www.youtube.com\\/", "title": "Nono le petit robot", "html": "<object width=\\"425\\" height=\\"344\\"><param name=\\"movie\\" value=\\"http:\\/\\/www.youtube.com\\/v\\/BDYAbAtaDzA?fs=1\\"><\\/param><param name=\\"allowFullScreen\\" value=\\"true\\"><\\/param><param name=\\"allowscriptaccess\\" value=\\"always\\"><\\/param><embed src=\\"http:\\/\\/www.youtube.com\\/v\\/BDYAbAtaDzA?fs=1\\" type=\\"application\\/x-shockwave-flash\\" width=\\"425\\" height=\\"344\\" allowscriptaccess=\\"always\\" allowfullscreen=\\"true\\"><\\/embed><\\/object>", "author_name": "timan38", "height": 344, "thumbnail_width": 480, "width": 425, "version": "1.0", "author_url": "http:\\/\\/www.youtube.com\\/user\\/timan38", "provider_name": "YouTube", "thumbnail_url": "http:\\/\\/i3.ytimg.com\\/vi\\/BDYAbAtaDzA\\/hqdefault.jpg", "type": "video", "thumbnail_height": 360}', true));
     $media->setId(1023457);
     $this->assertTrue($provider->requireThumbnails($media));
     $provider->addFormat('big', array('width' => 200, 'height' => 100, 'constraint' => true));
     $this->assertNotEmpty($provider->getFormats(), '::getFormats() return an array');
     $provider->generateThumbnails($media);
     $this->assertEquals('default/0011/24/thumb_1023457_big.jpg', $provider->generatePrivateUrl($media, 'big'));
 }
 public function testThumbnail()
 {
     $provider = $this->getProvider();
     $media = new Media();
     $media->setName('les tests fonctionnels - Symfony Live 2009');
     $media->setProviderName('dailymotion');
     $media->setProviderReference('x9wjql');
     $media->setProviderMetadata(json_decode('{"type":"video","version":"1.0","provider_name":"Dailymotion","provider_url":"http:\\/\\/www.dailymotion.com","title":"Thomas Rabaix - les tests fonctionnels - Symfony Live 2009","author_name":"Guillaume Pon\\u00e7on","author_url":"http:\\/\\/www.dailymotion.com\\/phptv","width":480,"height":270,"html":"<iframe src=\\"http:\\/\\/www.dailymotion.com\\/embed\\/video\\/x9wjql\\" width=\\"480\\" height=\\"270\\" frameborder=\\"0\\"><\\/iframe>","thumbnail_url":"http:\\/\\/ak2.static.dailymotion.com\\/static\\/video\\/711\\/536\\/16635117:jpeg_preview_large.jpg?20100801072241","thumbnail_width":426.666666667,"thumbnail_height":240}', true));
     $media->setId(1023458);
     $this->assertTrue($provider->requireThumbnails($media));
     $provider->addFormat('big', array('width' => 200, 'height' => null, 'constraint' => true));
     $this->assertNotEmpty($provider->getFormats(), '::getFormats() return an array');
     $provider->generateThumbnails($media);
     $this->assertEquals('default/0011/24/thumb_1023458_big.jpg', $provider->generatePrivateUrl($media, 'big'));
 }
 public function testThumbnail()
 {
     $provider = $this->getProvider();
     $media = new Media();
     $media->setName('Blinky™');
     $media->setProviderName('vimeo');
     $media->setProviderReference('21216091');
     $media->setProviderMetadata(json_decode('{"type":"video","version":"1.0","provider_name":"Vimeo","provider_url":"http:\\/\\/vimeo.com\\/","title":"Blinky\\u2122","author_name":"Ruairi Robinson","author_url":"http:\\/\\/vimeo.com\\/ruairirobinson","is_plus":"1","html":"<iframe src=\\"http:\\/\\/player.vimeo.com\\/video\\/21216091\\" width=\\"1920\\" height=\\"1080\\" frameborder=\\"0\\"><\\/iframe>","width":"1920","height":"1080","duration":"771","description":"","thumbnail_url":"http:\\/\\/b.vimeocdn.com\\/ts\\/136\\/375\\/136375440_1280.jpg","thumbnail_width":1280,"thumbnail_height":720,"video_id":"21216091"}', true));
     $media->setId(1023457);
     $this->assertTrue($provider->requireThumbnails($media));
     $provider->addFormat('big', array('width' => 200, 'height' => 100, 'constraint' => true));
     $this->assertNotEmpty($provider->getFormats(), '::getFormats() return an array');
     $provider->generateThumbnails($media);
     $this->assertEquals('default/0011/24/thumb_1023457_big.jpg', $provider->generatePrivateUrl($media, 'big'));
 }
 public function testThumbnail()
 {
     $response = $this->getMock('Buzz\\Message\\AbstractMessage');
     $response->expects($this->once())->method('getContent')->will($this->returnValue('content'));
     $browser = $this->getMockBuilder('Buzz\\Browser')->getMock();
     $browser->expects($this->once())->method('get')->will($this->returnValue($response));
     $provider = $this->getProvider($browser);
     $media = new Media();
     $media->setProviderName('sapo');
     $media->setProviderReference('4MyqjpF3WWNpiTCvNJ60');
     $media->setContext('default');
     $media->setProviderMetadata(json_decode('{"version":"1.0","type":"video","title":"Inferno T5 :: PROMO Ep.106","author_name":"canalq","author_url":"http:\\/\\/videos.sapo.pt\\/canalq","synopse":"Promo do epis\\u00f3dio 106 da temporada 5 do Inferno.\\n\\nHor\\u00e1rio: Segunda a Sexta, \\u00e0s 22h30 e 1h, no Canal Q. \\n\\nDispon\\u00edvel tamb\\u00e9m em facebook.com\\/canalq e twitter.com\\/canalq. \\nGrava\\u00e7\\u00f5es autom\\u00e1ticas MEO e NOS.","provider_name":"Sapo Videos","provider_url":"http:\\/\\/videos.sapo.pt","width":"640","height":"360","hd":"false","html":"<iframe src=\\"http:\\/\\/rd3.videos.sapo.pt\\/playhtml?file=http:\\/\\/rd3.videos.sapo.pt\\/4MyqjpF3WWNpiTCvNJ60\\/mov\\/1&quality=sd\\" frameborder=\\"0\\" scrolling=\\"no\\" width=\\"640\\" height=\\"360\\" webkitallowfullscreen mozallowfullscreen allowfullscreen ><\\/iframe>"}', true));
     $media->setId(1023457);
     $this->assertTrue($provider->requireThumbnails($media));
     $provider->addFormat('big', array('width' => 200, 'height' => 100, 'constraint' => true));
     $this->assertNotEmpty($provider->getFormats(), '::getFormats() return an array');
     $provider->generateThumbnails($media);
     $this->assertSame('default/0011/24/thumb_1023457_big.jpg', $provider->generatePrivateUrl($media, 'big'));
 }
 public function testThumbnail()
 {
     $response = $this->getMock('Buzz\\Message\\AbstractMessage');
     $response->expects($this->once())->method('getContent')->will($this->returnValue('content'));
     $browser = $this->getMockBuilder('Buzz\\Browser')->getMock();
     $browser->expects($this->once())->method('get')->will($this->returnValue($response));
     $provider = $this->getProvider($browser);
     $media = new Media();
     $media->setProviderName('playwire');
     $media->setProviderReference('1000748|4517915');
     $media->setContext('default');
     $media->setProviderMetadata(json_decode('{"settings":{"watermark":{"image":"https://cdn.video.playwire.com/1000748/watermarks/thumb_Untitled-1.jpg","href":"http://ainanas.com","text":""},"title":"Quanto é um trilião elevado a 10?","autoplay":false,"branding":true,"skin":"","share":true,"automute":false,"loop":false,"googleAnalytics":"UA-838216-9","defaultHD":false,"showEmbed":true,"bigButton":true,"appearance":{"colors":{"background":"rgb(191,191,191)","foreground":"rgb(255, 255, 255)","active":"rgb(255,255,255)"},"text":{"provider":"google","font":"Open Sans","color":"rgb(0,0,0)"},"scrubber":{"progress":{"backgroundColor":"rgb(243,24,24)"}},"controlbar":{"backgroundColor":{"primary":"rgb(49,49,49)","secondary":"rgb(34,34,34)","style":"flat"},"corner":"sharp","position":"docked"},"watermark":{"position":"bottom-right","opacity":null}}},"type":"video","version":2,"duration":53314,"publisherId":1000748,"hostingId":1000748,"content":{"videoId":4517915,"poster":"https://cdn.video.playwire.com/1000748/videos/4517915/poster_0000.png","media":{"f4m":"https://config.playwire.com/1000748/videos/v2/4517915/manifest.f4m"},"captions":[]},"advertising":{"videoAdRatio":1,"trueView":false,"on":true,"servers":[{"type":"adtech-intergi","tags":{"default":{"standard":{"preroll":"http://ads.intergi.com/adrawdata/3.0/5205/3708267/4517915/4296/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__;headerbids=amazon","midroll":"http://ads.intergi.com/adrawdata/3.0/5205/3708267/4517915/4296/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__;headerbids=amazon","video300x250":"http://ads.intergi.com/addyn/3.0/5205/3708314/4517915/170/ADTECH;loc=100;target=_blank;key=key1+key2+key3+key4;grp=[group];misc="},"html5":{"desktop":{"preroll":"http://ads.intergi.com/adrawdata/3.0/5205/3708267/4517915/4296/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__;headerbids=amazon","midroll":"http://ads.intergi.com/adrawdata/3.0/5205/3708267/4517915/4296/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__;headerbids=amazon","video300x250":"http://ads.intergi.com/addyn/3.0/5205/3708314/4517915/170/ADTECH;loc=100;target=_blank;key=key1+key2+key3+key4;grp=[group];misc="},"mobile":{"preroll":"http://ads.intergi.com/adrawdata/3.0/5205/3708226/4517915/6251/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__","midroll":"http://ads.intergi.com/adrawdata/3.0/5205/3708226/4517915/6251/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__","video300x250":"http://ads.intergi.com/addyn/3.0/5205/3708314/4517915/170/ADTECH;loc=100;target=_blank;key=key1+key2+key3+key4;grp=[group];misc="}}},"ainanas.com":{"standard":{"preroll":"http://ads.intergi.com/adrawdata/3.0/5205/3355960/4517915/1013/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__;headerbids=amazon","midroll":"http://ads.intergi.com/adrawdata/3.0/5205/3355960/4517915/1013/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__;headerbids=amazon","video300x250":"http://ads.intergi.com/addyn/3.0/5205/3708434/4517915/170/ADTECH;loc=100;target=_blank;key=key1+key2+key3+key4;grp=[group];misc=","overlay":"http://ads.intergi.com/adrawdata/3.0/5205/3708501/4517915/6744/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__"},"html5":{"desktop":{"preroll":"http://ads.intergi.com/adrawdata/3.0/5205/3355960/4517915/1013/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__;headerbids=amazon","midroll":"http://ads.intergi.com/adrawdata/3.0/5205/3355960/4517915/1013/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__;headerbids=amazon","video300x250":"http://ads.intergi.com/addyn/3.0/5205/3708434/4517915/170/ADTECH;loc=100;target=_blank;key=key1+key2+key3+key4;grp=[group];misc=","overlay":"http://ads.intergi.com/adrawdata/3.0/5205/3708501/4517915/6744/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__"},"mobile":{"preroll":"http://ads.intergi.com/adrawdata/3.0/5205/3355958/4517915/4796/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__","midroll":"http://ads.intergi.com/adrawdata/3.0/5205/3355958/4517915/4796/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__","video300x250":"http://ads.intergi.com/addyn/3.0/5205/3708434/4517915/170/ADTECH;loc=100;target=_blank;key=key1+key2+key3+key4;grp=[group];misc=","overlay":"http://ads.intergi.com/adrawdata/3.0/5205/3708552/4517915/6744/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__"}}}}}],"cuepoints":[]}}', true));
     $media->setId(1023457);
     $this->assertTrue($provider->requireThumbnails($media));
     $provider->addFormat('big', array('width' => 200, 'height' => 100, 'constraint' => true));
     $this->assertNotEmpty($provider->getFormats(), '::getFormats() return an array');
     $provider->generateThumbnails($media);
     $this->assertSame('default/0011/24/thumb_1023457_big.jpg', $provider->generatePrivateUrl($media, 'big'));
 }
 /**
  * @group fail
  */
 public function testThumbnail()
 {
     $response = $this->getMock('Buzz\\Message\\AbstractMessage');
     $response->expects($this->once())->method('getContent')->will($this->returnValue('content'));
     $browser = $this->getMockBuilder('Buzz\\Browser')->getMock();
     $browser->expects($this->once())->method('get')->will($this->returnValue($response));
     $provider = $this->getProvider($browser);
     $media = new Media();
     $media->setProviderName('soundcloud');
     $media->setProviderReference('https://soundcloud.com/petduo/sets/petduos-hard-education-podcast');
     $media->setContext('default');
     $media->setProviderMetadata(json_decode('{"version":1.0,"type":"rich","provider_name":"SoundCloud","provider_url":"http://soundcloud.com","height":450,"width":"100%","title":"PETDuo\'s Hard Education Podcast by PETDuo","description":null,"thumbnail_url":"http://i1.sndcdn.com/artworks-000137368162-i418pc-t500x500.jpg","html":"\\u003Ciframe width=\\"100%\\" height=\\"450\\" scrolling=\\"no\\" frameborder=\\"no\\" src=\\"https://w.soundcloud.com/player/?visual=true\\u0026url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F166668959\\u0026show_artwork=true\\"\\u003E\\u003C/iframe\\u003E","author_name":"PETDuo","author_url":"http://soundcloud.com/petduo"}', true));
     $media->setId(1023457);
     $this->assertTrue($provider->requireThumbnails($media));
     $provider->addFormat('big', array('width' => 200, 'height' => 100, 'constraint' => true));
     $this->assertNotEmpty($provider->getFormats(), '::getFormats() return an array');
     $provider->generateThumbnails($media);
     $this->assertSame('default/0011/24/thumb_1023457_big.jpg', $provider->generatePrivateUrl($media, 'big'));
 }