Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

test(deployment): parse heredoc scripts in process fake

Andras Bacsai3873a58086eb
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());