diff --git a/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php b/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php
index 92ac3cec7a..84d5d1da0a 100644
--- a/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php
@@ -29,6 +29,7 @@ public function testBuild(SvgIconBuilder $icon_builder, $icon_map, $expected) {
$output = (string) $renderer->executeInRenderContext(new RenderContext(), function () use ($build, $renderer) {
return $renderer->render($build);
});
+ $expected = str_replace(["\r", "\n"], '', $expected);
$this->assertSame($expected, $output);
}
diff --git a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
index fe128b22a4..43081b1850 100644
--- a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
@@ -206,7 +206,7 @@ public function providerPreRenderHtmlTag() {
$element = [
'#tag' => 'link',
];
- $tags['link'] = [HtmlTag::preRenderConditionalComments($element), '' . "\n"];
+ $tags['link'] = [HtmlTag::preRenderConditionalComments($element), ''];
// Conditional link.
$element = [
@@ -215,6 +215,7 @@ public function providerPreRenderHtmlTag() {
'IE' => TRUE,
'!IE' => FALSE,
],
+ '#suffix' => "\n",
];
$tags['conditional-link'] = [HtmlTag::preRenderConditionalComments($element), "\n" . '' . "\n"];