From c432769ddb6518a07a586688628754b756ce3588 Mon Sep 17 00:00:00 2001 From: Sander Muller Date: Wed, 2 Sep 2026 19:44:15 +0200 Subject: [PATCH] Include the exit code and stderr when a bin/rector output assertion fails testConsoleOutput asserts on getOutput() alone, so when the spawned bin/rector writes nothing to stdout the failure is a diff against an empty string with no reason attached - the exit code and whatever went to stderr are both dropped. That is what a failing run looks like in PHPStan's integration job, where all three cases report '' including the --version one, and the log gives nothing to work from. assertSame() takes a message, so both are now in the failure. --- tests/Bin/RectorTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/Bin/RectorTest.php b/tests/Bin/RectorTest.php index fcb3d619a3a..44658f11723 100644 --- a/tests/Bin/RectorTest.php +++ b/tests/Bin/RectorTest.php @@ -35,6 +35,10 @@ public function testConsoleOutput(string $command, string $expectedOutput): void { $process = Process::fromShellCommandline($command); $process->run(); - $this->assertSame($expectedOutput, preg_replace('/ +/', ' ', $process->getOutput())); + $this->assertSame($expectedOutput, preg_replace('/ +/', ' ', $process->getOutput()), sprintf( + 'exit code %s, stderr: %s', + $process->getExitCode() ?? 'not started', + $process->getErrorOutput() + )); } }