public function populate(Sitemap $sitemap) { $url = new Url(); $url->setLoc('http://www.google.fr'); $url->setChangefreq(Url::CHANGEFREQ_NEVER); $url->setLastmod('2012-12-19 02:28'); $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'); $url->addVideo($video); $sitemap->add($url); $url = new Url(); $url->setLoc('http://github.com'); $url->setChangefreq(Url::CHANGEFREQ_ALWAYS); $url->setPriority(0.2); $sitemap->add($url); }
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 testFormatUrlWithVideos() { $url = new Url(); $url->setLoc('http://www.google.fr'); $url->setPriority(0.2); $url->setChangefreq(Url::CHANGEFREQ_NEVER); $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'); $url->addVideo($video); $video = new Video(); $video->setThumbnailLoc('http://www.example.com/thumbs/456.jpg'); $video->setTitle('Grilling steaks for summer - 2'); $video->setDescription('Alkis shows you how to get perfectly done steaks every time - 2'); $url->addVideo($video); $this->assertEquals("<url>\n" . "\t<loc>http://www.google.fr</loc>\n" . "\t<changefreq>never</changefreq>\n" . "\t<priority>0.2</priority>\n" . "\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</video:video>\n" . "\t<video:video>\n" . "\t\t<video:title>Grilling steaks for summer - 2</video:title>\n" . "\t\t<video:description>Alkis shows you how to get perfectly done steaks every time - 2</video:description>\n" . "\t\t<video:thumbnail_loc>http://www.example.com/thumbs/456.jpg</video:thumbnail_loc>\n" . "\t</video:video>\n" . "</url>\n", $this->formatter->formatUrl($url)); }