From a4a2b6da876ca6aca7bd12843ca772c1fa4509e8 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 ee9d48c10..cae7bf299 100644 --- a/tests/Composer/Test/Downloader/XzDownloaderTest.php +++ b/tests/Composer/Test/Downloader/XzDownloaderTest.php @@ -41,6 +41,9 @@ class XzDownloaderTest extends TestCase 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 84e3df046..17f9f3d7f 100644 --- a/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php @@ -17,6 +17,7 @@ use Composer\Config; 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 @@ class SvnDriverTest extends TestCase $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);