From bb37d755bb8b2e0d14b5d5bdfd4324ff3be0ad04 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 5 Oct 2022 14:04:05 +0000 Subject: [PATCH] Tests: Ignore EOL differences in Style Engine API tests. Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (`<<<`) or multiline strings as the expected result. This resolves two failures when running the test suite on Windows along the lines of: {{{ 1) Tests_Style_Engine_wpStyleEngineCSSRule::test_should_prettify_css_rule_output Failed asserting that two strings are identical. --- Expected +++ Actual @@ @@ #Warning: Strings contain different line endings! -'.baptiste { - margin-left: 0; - font-family: Detective Sans; +'.baptiste { + margin-left: 0; + font-family: Detective Sans; }' /var/www/tests/phpunit/tests/style-engine/wpStyleEngineCssRule.php:159 }}} Follow-up to [46612], [48443], [48466], [49691], [51135], [53282], [53319], [54156]. See #56467, #55652. git-svn-id: https://develop.svn.wordpress.org/trunk@54394 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/style-engine/wpStyleEngineCssRule.php | 2 +- tests/phpunit/tests/style-engine/wpStyleEngineProcessor.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/style-engine/wpStyleEngineCssRule.php b/tests/phpunit/tests/style-engine/wpStyleEngineCssRule.php index 959f4092a9..debb09d8d1 100644 --- a/tests/phpunit/tests/style-engine/wpStyleEngineCssRule.php +++ b/tests/phpunit/tests/style-engine/wpStyleEngineCssRule.php @@ -156,6 +156,6 @@ class Tests_Style_Engine_wpStyleEngineCSSRule extends WP_UnitTestCase { font-family: Detective Sans; }'; - $this->assertSame( $expected, $css_rule->get_css( true ) ); + $this->assertSameIgnoreEOL( $expected, $css_rule->get_css( true ) ); } } diff --git a/tests/phpunit/tests/style-engine/wpStyleEngineProcessor.php b/tests/phpunit/tests/style-engine/wpStyleEngineProcessor.php index 05acdc6db5..46201dab14 100644 --- a/tests/phpunit/tests/style-engine/wpStyleEngineProcessor.php +++ b/tests/phpunit/tests/style-engine/wpStyleEngineProcessor.php @@ -92,7 +92,7 @@ class Tests_Style_Engine_wpStyleEngineProcessor extends WP_UnitTestCase { background-color: orange; } '; - $this->assertSame( + $this->assertSameIgnoreEOL( $expected, $a_wonderful_processor->get_css( array( 'prettify' => true ) ) );