public function testAddUrlBaseHostToImages()
 {
     $dumper = new TestableMemoryDumper();
     $sitemap = new TestableSitemap($dumper, new TextFormatter(), 'http://www.google.fr');
     $url = new Url();
     $url->setLoc('http://www.joe.fr/search');
     $image = new Image();
     $image->setLoc('/thumbs/123.jpg');
     $image->setLicense('/lic/MIT.txt');
     $url->addImage($image);
     $sitemap->add($url);
     $this->assertEquals('http://www.google.fr/thumbs/123.jpg', $image->getLoc());
     $this->assertEquals('http://www.google.fr/lic/MIT.txt', $image->getLicense());
 }
 protected function formatImage(Image $image)
 {
     $buffer = "\t" . '<image:image>' . "\n";
     $buffer .= "\t\t" . '<image:loc>' . $this->escape($image->getLoc()) . '</image:loc>' . "\n";
     if ($image->getCaption() !== null) {
         $buffer .= "\t\t" . '<image:caption>' . $this->escape($image->getCaption()) . '</image:caption>' . "\n";
     }
     if ($image->getGeoLocation() !== null) {
         $buffer .= "\t\t" . '<image:geo_location>' . $this->escape($image->getGeoLocation()) . '</image:geo_location>' . "\n";
     }
     if ($image->getTitle() !== null) {
         $buffer .= "\t\t" . '<image:title>' . $this->escape($image->getTitle()) . '</image:title>' . "\n";
     }
     if ($image->getLicense() !== null) {
         $buffer .= "\t\t" . '<image:license>' . $this->escape($image->getLicense()) . '</image:license>' . "\n";
     }
     return $buffer . "\t" . '</image:image>' . "\n";
 }
 public function testFormatUrlWithFullImage()
 {
     $url = new Url();
     $url->setLoc('http://www.google.fr/?s=joe"');
     $url->setPriority(0.2);
     $url->setChangefreq(Url::CHANGEFREQ_NEVER);
     $image = new Image();
     $image->setLoc('http://www.example.com/thumbs/123.jpg');
     $image->setTitle('Grilling steaks for "summer"');
     $image->setCaption('Some caption');
     $image->setLicense('http://opensource.org/licenses/mit-license.php');
     $image->setGeoLocation('France');
     $url->addImage($image);
     $this->assertEquals("<url>\n" . "\t<loc>http://www.google.fr/?s=joe&quot;</loc>\n" . "\t<changefreq>never</changefreq>\n" . "\t<priority>0.2</priority>\n" . "\t<image:image>\n" . "\t\t<image:loc>http://www.example.com/thumbs/123.jpg</image:loc>\n" . "\t\t<image:caption>Some caption</image:caption>\n" . "\t\t<image:geo_location>France</image:geo_location>\n" . "\t\t<image:title>Grilling steaks for &quot;summer&quot;</image:title>\n" . "\t\t<image:license>http://opensource.org/licenses/mit-license.php</image:license>\n" . "\t</image:image>\n" . "</url>\n", $this->formatter->formatUrl($url));
 }