diff --git a/projects/plugins/jetpack/tests/php/modules/sitemaps/test-class.sitemap-buffer.php b/projects/plugins/jetpack/tests/php/modules/sitemaps/test-class.sitemap-buffer.php
index 27a52aacc6142..75d6b4b30498c 100644
--- a/projects/plugins/jetpack/tests/php/modules/sitemaps/test-class.sitemap-buffer.php
+++ b/projects/plugins/jetpack/tests/php/modules/sitemaps/test-class.sitemap-buffer.php
@@ -226,21 +226,6 @@ public function test_news_sitemap_item_to_xml() {
),
);
- $xml = '' . PHP_EOL
- . ''
- . 'http://example.com/blog-url-about-stuff'
- . "$timestamp"
- . ''
- . ''
- . 'Blog about stuff'
- . 'en'
- . ''
- . 'Stuff with stuff to escape, like less than signs: < and ampersands: &'
- . "$timestamp"
- . 'Blog with some already escaped stuff: &Ł'
- . ''
- . '' . PHP_EOL;
-
foreach (
array(
new Jetpack_Sitemap_Buffer_Dummy( JP_SITEMAP_MAX_ITEMS, JP_SITEMAP_MAX_BYTES, $timestamp ),
@@ -249,9 +234,24 @@ public function test_news_sitemap_item_to_xml() {
) {
$buffer->append( $array );
+ // Normalize the XML by removing whitespace between tags and normalizing newlines
+ $actual = preg_replace( '/>\s+', '><', $buffer->contents() );
+ $actual = str_replace( "\r\n", "\n", $actual );
+
+ $expected = 'http://example.com/blog-url-about-stuff'
+ . "$timestamp"
+ . ''
+ . 'Blog about stuff'
+ . 'en'
+ . ''
+ . 'Stuff with stuff to escape, like less than signs: < and ampersands: &'
+ . "$timestamp"
+ . 'Blog with some already escaped stuff: &Ł'
+ . '' . "\n";
+
$this->assertEquals(
- $xml,
- $buffer->contents(),
+ $expected,
+ $actual,
get_class( $buffer )
);
}