diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php index cbd8c31f30..49dfc0fef7 100644 --- a/tests/phpunit/includes/abstract-testcase.php +++ b/tests/phpunit/includes/abstract-testcase.php @@ -724,24 +724,36 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { * @since 5.8.0 Added support for nested arrays. * @since 5.9.0 Added the `$message` parameter. * - * @param string|array $expected The expected value. - * @param string|array $actual The actual value. - * @param string $message Optional. Message to display when the assertion fails. + * @param mixed $expected The expected value. + * @param mixed $actual The actual value. + * @param string $message Optional. Message to display when the assertion fails. */ public function assertSameIgnoreEOL( $expected, $actual, $message = '' ) { - $expected = map_deep( - $expected, - static function ( $value ) { - return str_replace( "\r\n", "\n", $value ); - } - ); + if ( null !== $expected ) { + $expected = map_deep( + $expected, + static function ( $value ) { + if ( is_string( $value ) ) { + return str_replace( "\r\n", "\n", $value ); + } - $actual = map_deep( - $actual, - static function ( $value ) { - return str_replace( "\r\n", "\n", $value ); - } - ); + return $value; + } + ); + } + + if ( null !== $actual ) { + $actual = map_deep( + $actual, + static function ( $value ) { + if ( is_string( $value ) ) { + return str_replace( "\r\n", "\n", $value ); + } + + return $value; + } + ); + } $this->assertSame( $expected, $actual, $message ); } @@ -753,8 +765,8 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { * @since 5.6.0 Turned into an alias for `::assertSameIgnoreEOL()`. * @since 5.9.0 Added the `$message` parameter. * - * @param string $expected The expected value. - * @param string $actual The actual value. + * @param mixed $expected The expected value. + * @param mixed $actual The actual value. * @param string $message Optional. Message to display when the assertion fails. */ public function assertEqualsIgnoreEOL( $expected, $actual, $message = '' ) {