diff --git a/src/Sitemap/Sitemapindex.php b/src/Sitemap/Sitemapindex.php index c4f57e5..32f0f44 100644 --- a/src/Sitemap/Sitemapindex.php +++ b/src/Sitemap/Sitemapindex.php @@ -75,10 +75,10 @@ protected function getSitemapXml(Urlset $urlset): string protected function getStructureXml(): string { $struct = ''; - $struct .= ' */ - protected $customNamespaces = ['xhtml' => 'https://www.w3.org/1999/xhtml']; + protected $customNamespaces = ['xhtml' => 'http://www.w3.org/1999/xhtml']; /** * @var string diff --git a/src/Sitemap/Url/GoogleNewsUrlDecorator.php b/src/Sitemap/Url/GoogleNewsUrlDecorator.php index 8574dfa..982a1d2 100644 --- a/src/Sitemap/Url/GoogleNewsUrlDecorator.php +++ b/src/Sitemap/Url/GoogleNewsUrlDecorator.php @@ -32,7 +32,7 @@ class GoogleNewsUrlDecorator extends UrlDecorator /** * @var array */ - protected $customNamespaces = ['news' => 'https://www.google.com/schemas/sitemap-news/0.9']; + protected $customNamespaces = ['news' => 'http://www.google.com/schemas/sitemap-news/0.9']; /** * @var string diff --git a/src/Sitemap/Url/GoogleVideoUrlDecorator.php b/src/Sitemap/Url/GoogleVideoUrlDecorator.php index 7cab5a6..6a81ab7 100644 --- a/src/Sitemap/Url/GoogleVideoUrlDecorator.php +++ b/src/Sitemap/Url/GoogleVideoUrlDecorator.php @@ -25,7 +25,7 @@ class GoogleVideoUrlDecorator extends UrlDecorator /** * @var array */ - protected $customNamespaces = ['video' => 'https://www.google.com/schemas/sitemap-video/1.1']; + protected $customNamespaces = ['video' => 'http://www.google.com/schemas/sitemap-video/1.1']; /** * @var string diff --git a/src/Sitemap/Url/UrlConcrete.php b/src/Sitemap/Url/UrlConcrete.php index 675a3eb..5e07c4a 100644 --- a/src/Sitemap/Url/UrlConcrete.php +++ b/src/Sitemap/Url/UrlConcrete.php @@ -132,7 +132,7 @@ public function setChangefreq(string $changefreq = null): self throw new \RuntimeException( sprintf( 'The value "%s" is not supported by the option changefreq.' . - ' See https://www.sitemaps.org/protocol.html#xmlTagDefinitions', + ' See http://www.sitemaps.org/protocol.html#xmlTagDefinitions', $changefreq ) ); @@ -177,7 +177,7 @@ public function setPriority($priority = null): self sprintf( 'The value "%s" is not supported by the option priority,' . ' it must be a numeric between 0.0 and 1.0.' . - ' See https://www.sitemaps.org/protocol.html#xmlTagDefinitions', + ' See http://www.sitemaps.org/protocol.html#xmlTagDefinitions', $priority ) ); diff --git a/src/Sitemap/Urlset.php b/src/Sitemap/Urlset.php index cad4694..7d2780c 100644 --- a/src/Sitemap/Urlset.php +++ b/src/Sitemap/Urlset.php @@ -125,7 +125,7 @@ protected function appendXML(string $urlXml): void protected function getStructureXml(): string { $struct = ''; - $struct .= 'URLS'; + $struct .= 'URLS'; $namespaces = ''; foreach ($this->customNamespaces as $key => $location) { diff --git a/tests/Integration/src/Listener/SitemapListener.php b/tests/Integration/src/Listener/SitemapListener.php index ee56001..743ef44 100644 --- a/tests/Integration/src/Listener/SitemapListener.php +++ b/tests/Integration/src/Listener/SitemapListener.php @@ -33,7 +33,7 @@ final class SitemapListener implements EventSubscriberInterface [ 'title' => 'Post with one image', 'slug' => 'post-with-one-image', - 'images' => ['https://lorempixel.com/400/200/technics/1'], + 'images' => ['http://lorempixel.com/400/200/technics/1'], 'video' => null, ], [ @@ -45,7 +45,7 @@ final class SitemapListener implements EventSubscriberInterface [ 'title' => 'Post with multimedia', 'slug' => 'post-with-multimedia', - 'images' => ['https://lorempixel.com/400/200/technics/2', 'https://lorempixel.com/400/200/technics/3'], + 'images' => ['http://lorempixel.com/400/200/technics/2', 'http://lorempixel.com/400/200/technics/3'], 'video' => 'https://www.youtube.com/watch?v=JugaMuswrmk', ], ]; diff --git a/tests/Integration/tests/BaseSitemapTestCase.php b/tests/Integration/tests/BaseSitemapTestCase.php index e8ad675..543c939 100644 --- a/tests/Integration/tests/BaseSitemapTestCase.php +++ b/tests/Integration/tests/BaseSitemapTestCase.php @@ -23,7 +23,7 @@ abstract class BaseSitemapTestCase extends WebTestCase protected static function assertIndex(string $xml, bool $gzip = false): void { $index = simplexml_load_string($xml); - $index->registerXPathNamespace('sm', 'https://www.sitemaps.org/schemas/sitemap/0.9'); + $index->registerXPathNamespace('sm', 'http://www.sitemaps.org/schemas/sitemap/0.9'); self::assertIndexContainsSectionLink($index, 'static', $gzip); self::assertIndexContainsSectionLink($index, 'blog', $gzip); @@ -34,7 +34,7 @@ protected static function assertIndex(string $xml, bool $gzip = false): void protected static function assertStaticSection(string $xml): void { $static = simplexml_load_string($xml); - $static->registerXPathNamespace('sm', 'https://www.sitemaps.org/schemas/sitemap/0.9'); + $static->registerXPathNamespace('sm', 'http://www.sitemaps.org/schemas/sitemap/0.9'); if (Kernel::VERSION_ID >= 50100) { self::assertSectionContainsCountUrls($static, 'static', 4); @@ -58,9 +58,9 @@ protected static function assertStaticSection(string $xml): void protected static function assertBlogSection(string $xml): void { $blog = simplexml_load_string($xml); - $blog->registerXPathNamespace('sm', 'https://www.sitemaps.org/schemas/sitemap/0.9'); - $blog->registerXPathNamespace('image', 'https://www.google.com/schemas/sitemap-image/1.1'); - $blog->registerXPathNamespace('video', 'https://www.google.com/schemas/sitemap-video/1.1'); + $blog->registerXPathNamespace('sm', 'http://www.sitemaps.org/schemas/sitemap/0.9'); + $blog->registerXPathNamespace('image', 'http://www.google.com/schemas/sitemap-image/1.1'); + $blog->registerXPathNamespace('video', 'http://www.google.com/schemas/sitemap-video/1.1'); self::assertSectionContainsCountUrls($blog, 'blog', 5); $list = self::assertSectionContainsPath($blog, 'blog', '/blog'); @@ -68,19 +68,19 @@ protected static function assertBlogSection(string $xml): void $postWithoutMedia = self::assertSectionContainsPath($blog, 'blog', '/blog/post-without-media'); self::assertUrlConcrete($postWithoutMedia, 'blog', 0.5, 'daily'); $postWithOneImage = self::assertSectionContainsPath($blog, 'blog', '/blog/post-with-one-image'); - self::assertUrlHasImage($postWithOneImage, 'blog', 'https://lorempixel.com/400/200/technics/1'); + self::assertUrlHasImage($postWithOneImage, 'blog', 'http://lorempixel.com/400/200/technics/1'); $postWithAVideo = self::assertSectionContainsPath($blog, 'blog', '/blog/post-with-a-video'); self::assertUrlHasVideo($postWithAVideo, 'blog', 'https://www.youtube.com/watch?v=j6IKRxH8PTg'); $postWithMultimedia = self::assertSectionContainsPath($blog, 'blog', '/blog/post-with-multimedia'); - self::assertUrlHasImage($postWithMultimedia, 'blog', 'https://lorempixel.com/400/200/technics/2'); - self::assertUrlHasImage($postWithMultimedia, 'blog', 'https://lorempixel.com/400/200/technics/3'); + self::assertUrlHasImage($postWithMultimedia, 'blog', 'http://lorempixel.com/400/200/technics/2'); + self::assertUrlHasImage($postWithMultimedia, 'blog', 'http://lorempixel.com/400/200/technics/3'); self::assertUrlHasVideo($postWithMultimedia, 'blog', 'https://www.youtube.com/watch?v=JugaMuswrmk'); } protected static function assertArchivesSection(string $xml): void { $archives = simplexml_load_string($xml); - $archives->registerXPathNamespace('sm', 'https://www.sitemaps.org/schemas/sitemap/0.9'); + $archives->registerXPathNamespace('sm', 'http://www.sitemaps.org/schemas/sitemap/0.9'); self::assertSectionContainsCountUrls($archives, 'archive', 10); Assert::assertCount( diff --git a/tests/Unit/Service/DumperTest.php b/tests/Unit/Service/DumperTest.php index 11e6362..1d275b9 100644 --- a/tests/Unit/Service/DumperTest.php +++ b/tests/Unit/Service/DumperTest.php @@ -177,9 +177,9 @@ public function existingInvalidSitemap(): \Generator yield [ << - + 2020-08-19T20:04:26+02:00 @@ -191,9 +191,9 @@ public function existingInvalidSitemap(): \Generator yield [ << - + https://acme.org/sitemap.default.xml.gz diff --git a/tests/Unit/Sitemap/SitemapindexTest.php b/tests/Unit/Sitemap/SitemapindexTest.php index 8cdee23..579100d 100644 --- a/tests/Unit/Sitemap/SitemapindexTest.php +++ b/tests/Unit/Sitemap/SitemapindexTest.php @@ -49,7 +49,7 @@ public function testToXml(): void $sitemapindex = new Sitemap\Sitemapindex(); $xml = $sitemapindex->toXml(); self::assertXmlStringEqualsXmlString( - '', + '', $xml ); } diff --git a/tests/Unit/Sitemap/Url/GoogleNewsUrlDecoratorTest.php b/tests/Unit/Sitemap/Url/GoogleNewsUrlDecoratorTest.php index 0c38ca8..7b84640 100644 --- a/tests/Unit/Sitemap/Url/GoogleNewsUrlDecoratorTest.php +++ b/tests/Unit/Sitemap/Url/GoogleNewsUrlDecoratorTest.php @@ -36,7 +36,7 @@ public function testCountNamespaces(): void $dom = new \DOMDocument(); $dom->loadXML($this->generateXml($url)); - $newsTags = $dom->getElementsByTagNameNS('https://www.google.com/schemas/sitemap-news/0.9', '*'); + $newsTags = $dom->getElementsByTagNameNS('http://www.google.com/schemas/sitemap-news/0.9', '*'); self::assertEquals(6, $newsTags->length, 'Could not find news specific tags'); } @@ -54,7 +54,7 @@ public function testDefaultDateFormat(): void $dom = new \DOMDocument(); $dom->loadXML($this->generateXml($url)); - $dateNodes = $dom->getElementsByTagNameNS('https://www.google.com/schemas/sitemap-news/0.9', 'publication_date'); + $dateNodes = $dom->getElementsByTagNameNS('http://www.google.com/schemas/sitemap-news/0.9', 'publication_date'); self::assertEquals(1, $dateNodes->length, 'Could not find news:publication_date tag'); self::assertEquals($date->format(\DateTime::W3C), $dateNodes->item(0)->textContent, 'Date was not formatted properly'); } @@ -73,7 +73,7 @@ public function testCustomDateFormat(): void $dom = new \DOMDocument(); $dom->loadXML($this->generateXml($url)); - $dateNodes = $dom->getElementsByTagNameNS('https://www.google.com/schemas/sitemap-news/0.9', 'publication_date'); + $dateNodes = $dom->getElementsByTagNameNS('http://www.google.com/schemas/sitemap-news/0.9', 'publication_date'); self::assertEquals(1, $dateNodes->length, 'Could not find news:publication_date tag'); self::assertEquals($date->format('Y-m-d'), $dateNodes->item(0)->textContent, 'Date was not formatted properly'); } @@ -103,7 +103,7 @@ public function testAccessPropertyValidation(): void $dom = new \DOMDocument(); $dom->loadXML($this->generateXml($url)); - $accessNodes = $dom->getElementsByTagNameNS('https://www.google.com/schemas/sitemap-news/0.9', 'access'); + $accessNodes = $dom->getElementsByTagNameNS('http://www.google.com/schemas/sitemap-news/0.9', 'access'); self::assertEquals(1, $accessNodes->length, 'Could not find news:access tag'); self::assertEquals('Registration', $accessNodes->item(0)->textContent, 'Acces tag did not contain the right value'); } @@ -134,7 +134,7 @@ public function testGeoLocationPropertyValidation(): void $dom = new \DOMDocument(); $dom->loadXML($this->generateXml($url)); - $geoNodes = $dom->getElementsByTagNameNS('https://www.google.com/schemas/sitemap-news/0.9', 'geo_locations'); + $geoNodes = $dom->getElementsByTagNameNS('http://www.google.com/schemas/sitemap-news/0.9', 'geo_locations'); self::assertEquals(1, $geoNodes->length, 'Could not find news:geo_locations tag'); self::assertEquals('Detroit, Michigan, USA', $geoNodes->item(0)->textContent, 'Locations tag did not contain the right value'); } @@ -191,7 +191,7 @@ public function testStockTickersLimit(): void ); $dom = new \DOMDocument(); $dom->loadXML($this->generateXml($url)); - $stockNodes = $dom->getElementsByTagNameNS('https://www.google.com/schemas/sitemap-news/0.9', 'stock_tickers'); + $stockNodes = $dom->getElementsByTagNameNS('http://www.google.com/schemas/sitemap-news/0.9', 'stock_tickers'); self::assertEquals(1, $stockNodes->length, 'Could not find news:stock_tickers tag'); self::assertEquals('NYSE:OWW, NASDAQ:GTAT', $stockNodes->item(0)->textContent, 'Stock tickers tag did not contain the right value'); } diff --git a/tests/Unit/Sitemap/Url/GoogleVideoUrlDecoratorTest.php b/tests/Unit/Sitemap/Url/GoogleVideoUrlDecoratorTest.php index 846404a..3c16a27 100644 --- a/tests/Unit/Sitemap/Url/GoogleVideoUrlDecoratorTest.php +++ b/tests/Unit/Sitemap/Url/GoogleVideoUrlDecoratorTest.php @@ -64,7 +64,7 @@ protected function setUp(): void $this->xml = new \DOMDocument(); - $xml = 'getCustomNamespaces() as $name => $uri) { $xml .= ' xmlns:' . $name . '="' . $uri . '"'; @@ -77,7 +77,7 @@ protected function setUp(): void public function testCountNamespaces(): void { - $namespaces = $this->xml->getElementsByTagNameNS('https://www.google.com/schemas/sitemap-video/1.1', '*'); + $namespaces = $this->xml->getElementsByTagNameNS('http://www.google.com/schemas/sitemap-video/1.1', '*'); self::assertEquals(72, $namespaces->length); } @@ -117,8 +117,8 @@ public function testItemsLimitExceeded(): void public function testTagsByVideo(): void { $xpath = new \DOMXPath($this->xml); - $xpath->registerNamespace('s', 'https://www.sitemaps.org/schemas/sitemap/0.9'); - $xpath->registerNamespace('v', 'https://www.google.com/schemas/sitemap-video/1.1'); + $xpath->registerNamespace('s', 'http://www.sitemaps.org/schemas/sitemap/0.9'); + $xpath->registerNamespace('v', 'http://www.google.com/schemas/sitemap-video/1.1'); self::assertEquals('http://acme.com/video/thumbnail1.jpg', $xpath->evaluate('string(/s:urlset/s:url/v:video[1]/v:thumbnail_loc)')); self::assertEquals('http://acme.com/video/thumbnail2.jpg', $xpath->evaluate('string(/s:urlset/s:url/v:video[2]/v:thumbnail_loc)')); diff --git a/tests/Unit/Sitemap/Url/UrlConcreteTest.php b/tests/Unit/Sitemap/Url/UrlConcreteTest.php index 9a8d556..0f5cee1 100644 --- a/tests/Unit/Sitemap/Url/UrlConcreteTest.php +++ b/tests/Unit/Sitemap/Url/UrlConcreteTest.php @@ -139,7 +139,7 @@ public function testSetInvalidPriority($value): void $this->expectException(\RuntimeException::class); $this->expectExceptionMessage( "The value \"$value\" is not supported by the option priority, it must be a numeric between 0.0 and 1.0." . - " See https://www.sitemaps.org/protocol.html#xmlTagDefinitions" + " See http://www.sitemaps.org/protocol.html#xmlTagDefinitions" ); $url = new UrlConcrete('http://example.com');