diff --git a/tests/php/test-amp-gallery-embed-handler.php b/tests/php/test-amp-gallery-embed-handler.php index 3a685e1eb0f..1990c24ff87 100644 --- a/tests/php/test-amp-gallery-embed-handler.php +++ b/tests/php/test-amp-gallery-embed-handler.php @@ -280,7 +280,7 @@ public function test__conversion( $source, $expected, $use_legacy_mode = false ) $content = str_replace( 'jpg.webp', '.jpg', $content ); // Remove lazy loading attribute. - $content = str_replace( 'loading="lazy" ', '', $content ); + $content = preg_replace( '/\s+loading="lazy"/', '', $content ); $this->assertEquals( $this->normalize( $expected ),