8000 On Windows, don't rely on the OS to find executables by nicolas-grekas · Pull Request #12180 · composer/composer · GitHub
[go: up one dir, main page]

Skip to content

On Windows, don't rely on the OS to find executables #12180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Nov 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix windows test expectations
  • Loading branch information
Seldaek committed Nov 1, 2024
commit e503ea560dd6e3ec167288684a629ba96e614dc3
14 changes: 9 additions & 5 deletions tests/Composer/Test/Downloader/GitDownloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ public function testDownload(): void
->will($this->returnValue('dev-master'));

$process = $this->getProcessExecutorMock();
$expectedPath = Platform::isWindows() ? Platform::getCwd().'/composerPath' : 'composerPath';
$process->expects([
['git', 'clone', '--no-checkout', '--', 'https://example.com/composer/composer', 'composerPath'],
['git', 'clone', '--no-checkout', '--', 'https://example.com/composer/composer', $expectedPath],
['git', 'remote', 'add', 'composer', '--', 'https://example.com/composer/composer'],
['git', 'fetch', 'composer'],
['git', 'remote', 'set-url', 'origin', '--', 'https://example.com/composer/composer'],
Expand Down Expand Up @@ -209,10 +210,11 @@ public function testDownloadUsesVariousProtocolsAndSetsPushUrlForGithub(): void
->will($this->returnValue('1.0.0'));

$process = $this->getProcessExecutorMock();
$expectedPath = Platform::isWindows() ? Platform::getCwd().'/composerPath' : 'composerPath';
$process->expects([
['cmd' => ['git', 'clone', '--no-checkout', '--', 'https://github.com/mirrors/composer', 'composerPath'], 'return' => 1, 'stderr' => 'Error1'],
['cmd' => ['git', 'clone', '--no-checkout', '--', 'https://github.com/mirrors/composer', $expectedPath], 'return' => 1, 'stderr' => 'Error1'],

['git', 'clone', '--no-checkout', '--', 'git@github.com:mirrors/composer', 'composerPath'],
['git', 'clone', '--no-checkout', '--', 'git@github.com:mirrors/composer', $expectedPath],
['git', 'remote', 'add', 'composer', '--', 'git@github.com:mirrors/composer'],
['git', 'fetch', 'composer'],
['git', 'remote', 'set-url', 'origin', '--', 'git@github.com:mirrors/composer'],
94D4 Expand Down Expand Up @@ -265,8 +267,9 @@ public function testDownloadAndSetPushUrlUseCustomVariousProtocolsForGithub(arra
->will($this->returnValue('1.0.0'));

$process = $this->getProcessExecutorMock();
$expectedPath = Platform::isWindows() ? Platform::getCwd().'/composerPath' : 'composerPath';
$process->expects([
['git', 'clone', '--no-checkout', '--', $url, 'composerPath'],
['git', 'clone', '--no-checkout', '--', $url, $expectedPath],
['git', 'remote', 'add', 'composer', '--', $url],
['git', 'fetch', 'composer'],
['git', 'remote', 'set-url', 'origin', '--', $url],
Expand Down Expand Up @@ -305,9 +308,10 @@ public function testDownloadThrowsRuntimeExceptionIfGitCommandFails(): void
->will($this->returnValue('1.0.0'));

$process = $this->getProcessExecutorMock();
$expectedPath = Platform::isWindows() ? Platform::getCwd().'/composerPath' : 'composerPath';
$process->expects([
[
'cmd' => ['git', 'clone', '--no-checkout', '--', 'https://example.com/composer/composer', 'composerPath'],
'cmd' => ['git', 'clone', '--no-checkout', '--', 'https://example.com/composer/composer', $expectedPath],
'return' => 1,
],
]);
Expand Down
0