public function testAddUrlBaseHostToVideos()
 {
     $dumper = new TestableMemoryDumper();
     $sitemap = new TestableSitemap($dumper, new TextFormatter(), 'http://www.google.fr');
     $url = new Url();
     $url->setLoc('http://www.joe.fr/search');
     $video = new Video();
     $video->setThumbnailLoc('/thumbs/123.jpg');
     $video->setContentLoc('/content/123.avi');
     $video->setPlayerLoc('/player/123.swf');
     $video->setGalleryLoc('/gallery/123');
     $url->addVideo($video);
     $sitemap->add($url);
     $this->assertEquals('http://www.google.fr/thumbs/123.jpg', $video->getThumbnailLoc());
     $this->assertEquals('http://www.google.fr/content/123.avi', $video->getContentLoc());
     $player = $video->getPlayerLoc();
     $this->assertEquals('http://www.google.fr/player/123.swf', $player['loc']);
     $gallery = $video->getGalleryLoc();
     $this->assertEquals('http://www.google.fr/gallery/123', $gallery['loc']);
 }
 public function testFormatFullVideo()
 {
     $formatter = new TestableXmlFormatter();
     $video = new Video();
     $video->setThumbnailLoc('http://www.example.com/thumbs/123.jpg');
     $video->setTitle('Grilling steaks for summer');
     $video->setDescription('Alkis shows you how to get perfectly done steaks every time');
     $video->setContentLoc('http://www.example.com/video123.flv');
     $video->setPlayerLoc('http://www.example.com/videoplayer.swf?video=123', true, 'ap=1');
     $video->setDuration(600);
     $video->setExpirationDate('2012-12-23');
     $video->setRating(2.2);
     $video->setViewCount(42);
     $video->setFamilyFriendly(false);
     $video->setTags(array('test', 'video'));
     $video->setCategory('test category');
     $video->setRestrictions(array('fr', 'us'), Video::RESTRICTION_DENY);
     $video->setGalleryLoc('http://www.example.com/gallery/foo', 'Foo gallery');
     $video->setRequiresSubscription(true);
     $video->setUploader('K-Phoen', 'http://www.kevingomez.fr');
     $video->setPlatforms(array(Video::PLATFORM_TV => Video::RESTRICTION_ALLOW, Video::PLATFORM_WEB => Video::RESTRICTION_ALLOW));
     $video->setLive(false);
     $this->assertEquals("\t<video:video>\n" . "\t\t<video:title>Grilling steaks for summer</video:title>\n" . "\t\t<video:description>Alkis shows you how to get perfectly done steaks every time</video:description>\n" . "\t\t<video:thumbnail_loc>http://www.example.com/thumbs/123.jpg</video:thumbnail_loc>\n" . "\t\t<video:content_loc>http://www.example.com/video123.flv</video:content_loc>\n" . "\t\t<video:player_loc allow_embed=\"yes\" autoplay=\"ap=1\">http://www.example.com/videoplayer.swf?video=123</video:player_loc>\n" . "\t\t<video:duration>600</video:duration>\n" . sprintf("\t\t<video:expiration_date>%s</video:expiration_date>\n", $this->dateFormatW3C('2012-12-23')) . "\t\t<video:rating>2.2</video:rating>\n" . "\t\t<video:view_count>42</video:view_count>\n" . "\t\t<video:family_friendly>no</video:family_friendly>\n" . "\t\t<video:tag>test</video:tag>\n" . "\t\t<video:tag>video</video:tag>\n" . "\t\t<video:category>test category</video:category>\n" . "\t\t<video:restriction relationship=\"deny\">fr us</video:restriction>\n" . "\t\t<video:gallery_loc title=\"Foo gallery\">http://www.example.com/gallery/foo</video:gallery_loc>\n" . "\t\t<video:requires_subscription>yes</video:requires_subscription>\n" . "\t\t<video:uploader info=\"http://www.kevingomez.fr\">K-Phoen</video:uploader>\n" . "\t\t<video:platform relationship=\"allow\">tv</video:platform>\n" . "\t\t<video:platform relationship=\"allow\">web</video:platform>\n" . "\t\t<video:live>no</video:live>\n" . "\t</video:video>\n", $formatter->testFormatVideo($video));
 }