From b080a73840ee619ff67b473333a040a53eaa9ecc Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 1 Mar 2016 13:25:39 +0000 Subject: [PATCH] Fix broken test on windows, fixes #4973 --- src/Composer/Downloader/VcsDownloader.php | 4 ++++ tests/Composer/Test/Downloader/GitDownloaderTest.php | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index 242abb938..30323856f 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -127,6 +127,10 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa $exception = null; break; } catch (\Exception $exception) { + // rethrow phpunit exceptions to avoid hard to debug bug failures + if ($exception instanceof \PHPUnit_Framework_Exception) { + throw $exception; + } if ($this->io->isDebug()) { $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage()); } elseif (count($urls)) { diff --git a/tests/Composer/Test/Downloader/GitDownloaderTest.php b/tests/Composer/Test/Downloader/GitDownloaderTest.php index 90ddeda32..db8c814fb 100644 --- a/tests/Composer/Test/Downloader/GitDownloaderTest.php +++ b/tests/Composer/Test/Downloader/GitDownloaderTest.php @@ -356,8 +356,6 @@ class GitDownloaderTest extends TestCase public function testUpdateDoesntThrowsRuntimeExceptionIfGitCommandFailsAtFirstButIsAbleToRecover() { - $this->markTestIncomplete('This test is disabled until https://github.com/composer/composer/issues/4973 is resolved'); - $expectedFirstGitUpdateCommand = $this->winCompat("git remote set-url composer '' && git fetch composer && git fetch --tags composer"); $expectedSecondGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git fetch composer && git fetch --tags composer"); @@ -448,7 +446,7 @@ class GitDownloaderTest extends TestCase $cmd = str_replace('cd ', 'cd /D ', $cmd); $cmd = str_replace('composerPath', getcwd().'/composerPath', $cmd); - return strtr($cmd, "'", '"'); + return str_replace('""', '', strtr($cmd, "'", '"')); } return $cmd;