diff --git a/src/Traits/InteractsWithConsole.php b/src/Traits/InteractsWithConsole.php index c77e05c..8868dd3 100644 --- a/src/Traits/InteractsWithConsole.php +++ b/src/Traits/InteractsWithConsole.php @@ -25,7 +25,7 @@ trait InteractsWithConsole $output = $this->runCommand($command, $args); foreach ((array) $strings as $string) { - $this->assertStringContainsString( + $this->assertStringContainsStringIgnoringLineEndings( $string, $output, \sprintf( diff --git a/tests/app/Command/MultilineCommand.php b/tests/app/Command/MultilineCommand.php new file mode 100644 index 0000000..c3884c6 --- /dev/null +++ b/tests/app/Command/MultilineCommand.php @@ -0,0 +1,20 @@ +writeln('first line'); + $this->writeln('second line'); + + return self::SUCCESS; + } +} diff --git a/tests/src/ConsoleTest.php b/tests/src/ConsoleTest.php index 2c79ac9..0114eca 100644 --- a/tests/src/ConsoleTest.php +++ b/tests/src/ConsoleTest.php @@ -20,4 +20,9 @@ final class ConsoleTest extends TestCase $this->assertCommandRegistered('bar'); } + + public function testCommandOutputContainsStringsIgnoringLineEndings(): void + { + $this->assertConsoleCommandOutputContainsStrings('multiline', strings: "first line\r\nsecond line"); + } }