Skip to content

Commit c64cf9e

Browse files
committed
Fix
1 parent 6d47fe9 commit c64cf9e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/classes/SshExecutorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ public function testRunRawCommandSuccess(): void
259259
{
260260
$rawCommand = 'php artisan migrate --force > /dev/null 2>&1';
261261

262-
// Use double quotes around the path to match the executor's actual command construction
263-
$expectedFullCommand = "cd \"{$this->config['path']}\" && {$rawCommand}";
262+
// Build expected full command using escapeshellarg to be OS-agnostic (Windows uses double quotes, Linux uses single quotes)
263+
$expectedFullCommand = 'cd ' . escapeshellarg($this->config['path']) . " && {$rawCommand}";
264264

265265
$output = "Migration successful\n";
266266

@@ -283,8 +283,8 @@ public function testRunRawCommandFailureThrowsException(): void
283283
$rawCommand = 'bad-command-string';
284284
$errorOutput = 'bash: bad-command-string: not found';
285285

286-
// Use double quotes for the path here as well
287-
$expectedFullCommand = "cd \"{$this->config['path']}\" && {$rawCommand}";
286+
// Build expected full command using escapeshellarg to be OS-agnostic
287+
$expectedFullCommand = 'cd ' . escapeshellarg($this->config['path']) . " && {$rawCommand}";
288288

289289
$sshMock = Mockery::mock(SSH2::class);
290290
$sshMock->shouldReceive('exec')->once()->with($expectedFullCommand)->andReturn('');

0 commit comments

Comments
 (0)