From 965a427625e41ad6f8a75951a12a6755bb96cacd Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 31 Dec 2021 17:08:31 +0100 Subject: [PATCH] Make SvnDriverTest and XzDownloaderTest more portable on Windows --- .../Test/Downloader/XzDownloaderTest.php | 3 +++ .../Test/Repository/Vcs/SvnDriverTest.php | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/Composer/Test/Downloader/XzDownloaderTest.php b/tests/Composer/Test/Downloader/XzDownloaderTest.php index ee9d48c10b2a..cae7bf299311 100644 --- a/tests/Composer/Test/Downloader/XzDownloaderTest.php +++ b/tests/Composer/Test/Downloader/XzDownloaderTest.php @@ -41,6 +41,9 @@ public function setUp(): void protected function tearDown(): void { + if (Platform::isWindows()) { + return; + } parent::tearDown(); $this->fs = new Filesystem; $this->fs->removeDirectory($this->testDir); diff --git a/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php b/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php index 84e3df046565..17f9f3d7fb3e 100644 --- a/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php @@ -17,6 +17,7 @@ use Composer\Test\TestCase; use Composer\Util\Filesystem; use Composer\Test\Mock\ProcessExecutorMock; +use Composer\Util\ProcessExecutor; class SvnDriverTest extends TestCase { @@ -60,13 +61,19 @@ public function testWrongCredentialsInUrl() $output .= " rejected Basic challenge (https://corp.svn.local/)"; $process = $this->getProcessExecutorMock(); + $authedCommand = sprintf( + 'svn ls --verbose --non-interactive --username %s --password %s -- %s', + ProcessExecutor::escape('till'), + ProcessExecutor::escape('secret'), + ProcessExecutor::escape('https://till:secret@corp.svn.local/repo/trunk') + ); $process->expects(array( - array('cmd' => "svn ls --verbose --non-interactive --username 'till' --password 'secret' -- 'https://till:secret@corp.svn.local/repo/trunk'", 'return' => 1, 'stderr' => $output), - array('cmd' => "svn ls --verbose --non-interactive --username 'till' --password 'secret' -- 'https://till:secret@corp.svn.local/repo/trunk'", 'return' => 1, 'stderr' => $output), - array('cmd' => "svn ls --verbose --non-interactive --username 'till' --password 'secret' -- 'https://till:secret@corp.svn.local/repo/trunk'", 'return' => 1, 'stderr' => $output), - array('cmd' => "svn ls --verbose --non-interactive --username 'till' --password 'secret' -- 'https://till:secret@corp.svn.local/repo/trunk'", 'return' => 1, 'stderr' => $output), - array('cmd' => "svn ls --verbose --non-interactive --username 'till' --password 'secret' -- 'https://till:secret@corp.svn.local/repo/trunk'", 'return' => 1, 'stderr' => $output), - array('cmd' => "svn ls --verbose --non-interactive --username 'till' --password 'secret' -- 'https://till:secret@corp.svn.local/repo/trunk'", 'return' => 1, 'stderr' => $output), + array('cmd' => $authedCommand, 'return' => 1, 'stderr' => $output), + array('cmd' => $authedCommand, 'return' => 1, 'stderr' => $output), + array('cmd' => $authedCommand, 'return' => 1, 'stderr' => $output), + array('cmd' => $authedCommand, 'return' => 1, 'stderr' => $output), + array('cmd' => $authedCommand, 'return' => 1, 'stderr' => $output), + array('cmd' => $authedCommand, 'return' => 1, 'stderr' => $output), array('cmd' => 'svn --version', 'return' => 0, 'stdout' => '1.2.3'), ), true);