File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ('' );
You can’t perform that action at this time.
0 commit comments