From 3873a58086eba636ce9681659dd5acade96b3279 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:05:38 +0100 Subject: [PATCH] test(deployment): parse heredoc scripts in process fake --- tests/Feature/DeploymentConfigurationSymlinkWriteTest.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/Feature/DeploymentConfigurationSymlinkWriteTest.php b/tests/Feature/DeploymentConfigurationSymlinkWriteTest.php index a08f90fe54..ff654dd00a 100644 --- a/tests/Feature/DeploymentConfigurationSymlinkWriteTest.php +++ b/tests/Feature/DeploymentConfigurationSymlinkWriteTest.php @@ -58,10 +58,8 @@ beforeEach(function () { SH; Process::fake(function (PendingProcess $process) use ($shellPrelude) { $command = $process->command; - $input = $process->input; - if (str_ends_with($command, 'exec sh -se; fi"\'')) { - $script = $input; - $input = null; + if (preg_match('~<< \\\\(\S+)\n(.*)\n\1$~s', $command, $matches)) { + $script = $matches[2]; } elseif (preg_match("~ '((?:[^']|'\\\\'')*)'$~s", $command, $matches)) { $script = str_replace("'\\''", "'", $matches[1]); } else { @@ -69,7 +67,7 @@ beforeEach(function () { } $shell = new SymfonyProcess(['bash', '-c', $shellPrelude."\nset -e\n".$script]); - $shell->setInput($input); + $shell->setInput($process->input); $shell->run(); return Process::result(output: $shell->getOutput(), errorOutput: $shell->getErrorOutput(), exitCode: $shell->getExitCode());