diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 4b185a644..d7da384e4 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -293,7 +293,7 @@ EOT $dirs = iterator_to_array($finder); unset($finder); foreach ($dirs as $dir) { - if (!$fs->removeDirectory($dir)) { + if (!$fs->removeDirectory((string) $dir)) { throw new \RuntimeException('Could not remove '.$dir); } } diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index 38390c0c0..f8f49405a 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -510,7 +510,7 @@ TAGSPUBKEY $files = iterator_to_array($finder); if (count($files)) { - return basename(end($files), self::OLD_INSTALL_EXT); + return end($files)->getBasename(self::OLD_INSTALL_EXT); } return false; diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index 76bc5ce7c..02e0ff022 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -147,13 +147,13 @@ class Compiler $unexpectedFiles = array(); foreach ($finder as $file) { - if (in_array(realpath($file), $extraFiles, true)) { - unset($extraFiles[array_search(realpath($file), $extraFiles, true)]); - } elseif (!Preg::isMatch('{([/\\\\]LICENSE|\.php)$}', $file)) { + if (false !== ($index = array_search($file->getRealPath(), $extraFiles, true))) { + unset($extraFiles[$index]); + } elseif (!Preg::isMatch('{(^LICENSE$|\.php$)}', $file->getFilename())) { $unexpectedFiles[] = (string) $file; } - if (Preg::isMatch('{\.php[\d.]*$}', $file)) { + if (Preg::isMatch('{\.php[\d.]*$}', $file->getFilename())) { $this->addFile($phar, $file); } else { $this->addFile($phar, $file, false); @@ -220,10 +220,10 @@ class Compiler private function addFile(\Phar $phar, \SplFileInfo $file, bool $strip = true): void { $path = $this->getRelativeFilePath($file); - $content = file_get_contents($file); + $content = file_get_contents((string) $file); if ($strip) { $content = $this->stripWhitespace($content); - } elseif ('LICENSE' === basename($file)) { + } elseif ('LICENSE' === $file->getFilename()) { $content = "\n".$content."\n"; } diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index f2fac34fc..ccb60e6cf 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -150,7 +150,8 @@ class Application extends BaseApplication } // switch working dir - if ($newWorkDir = $this->getNewWorkingDir($input)) { + $newWorkDir = $this->getNewWorkingDir($input); + if (null !== $newWorkDir) { $oldWorkingDir = Platform::getCwd(true); chdir($newWorkDir); $this->initialWorkingDirectory = $newWorkDir; @@ -171,7 +172,7 @@ class Application extends BaseApplication } // prompt user for dir change if no composer.json is present in current dir - if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'), true) && !file_exists(Factory::getComposerFile()) && ($useParentDirIfNoJsonAvailable = $this->getUseParentDirConfigValue()) !== false) { + if ($io->isInteractive() && null === $newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'), true) && !file_exists(Factory::getComposerFile()) && ($useParentDirIfNoJsonAvailable = $this->getUseParentDirConfigValue()) !== false) { $dir = dirname(Platform::getCwd(true)); $home = realpath(Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE') ?: '/'); @@ -357,12 +358,13 @@ class Application extends BaseApplication /** * @param InputInterface $input * @throws \RuntimeException - * @return string + * @return ?string */ - private function getNewWorkingDir(InputInterface $input): string + private function getNewWorkingDir(InputInterface $input): ?string { - $workingDir = $input->getParameterOption(array('--working-dir', '-d')); - if (false !== $workingDir && !is_dir($workingDir)) { + /** @var string|null $workingDir */ + $workingDir = $input->getParameterOption(array('--working-dir', '-d'), null, true); + if (null !== $workingDir && !is_dir($workingDir)) { throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.'); } diff --git a/src/Composer/Downloader/ArchiveDownloader.php b/src/Composer/Downloader/ArchiveDownloader.php index fc1900414..449593a6b 100644 --- a/src/Composer/Downloader/ArchiveDownloader.php +++ b/src/Composer/Downloader/ArchiveDownloader.php @@ -175,7 +175,7 @@ abstract class ArchiveDownloader extends FileDownloader } $contentDir = $getFolderContent($temporaryDir); - $singleDirAtTopLevel = 1 === count($contentDir) && is_dir(reset($contentDir)); + $singleDirAtTopLevel = 1 === count($contentDir) && is_dir((string) reset($contentDir)); if ($renameAsOne) { // if the target $path is clear, we can rename the whole package in one go instead of looping over the contents diff --git a/src/Composer/Package/Archiver/ArchivableFilesFinder.php b/src/Composer/Package/Archiver/ArchivableFilesFinder.php index fd589d7a2..9a53b719e 100644 --- a/src/Composer/Package/Archiver/ArchivableFilesFinder.php +++ b/src/Composer/Package/Archiver/ArchivableFilesFinder.php @@ -99,7 +99,7 @@ class ArchivableFilesFinder extends \FilterIterator return true; } - $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS); + $iterator = new FilesystemIterator((string) $current, FilesystemIterator::SKIP_DOTS); return !$iterator->valid(); } diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index cd1f9e2ba..5184eb01f 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -408,6 +408,13 @@ class ArrayLoader implements LoaderInterface */ public function getBranchAlias(array $config): ?string { + if (!isset($config['version']) || !is_scalar($config['version'])) { + throw new \UnexpectedValueException('no/invalid version defined'); + } + if (!is_string($config['version'])) { + $config['version'] = (string) $config['version']; + } + if (strpos($config['version'], 'dev-') !== 0 && '-dev' !== substr($config['version'], -4)) { return null; } diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index eb7134eb9..9fb4a19cd 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -286,8 +286,8 @@ class ValidatingArrayLoader implements LoaderInterface // check requires for exact constraints ($this->flags & self::CHECK_STRICT_CONSTRAINTS) && 'require' === $linkType - && strpos($linkConstraint, '=') === 0 - && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=') + && $linkConstraint instanceof Constraint && $linkConstraint->getOperator() === Constraint::STR_OP_EQ + && (new Constraint('>=', '1.0.0.0-dev'))->matches($linkConstraint) ) { $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning'; } diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index 3c9c625fe..6d8afe4a1 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -306,7 +306,7 @@ class PlatformRepository extends ArrayRepository } if (Preg::isMatch('/^libXpm Version => (?\d+)$/im', $info, $libxpmMatches)) { - $this->addLibrary($name.'-libxpm', Version::convertLibxpmVersionId($libxpmMatches['versionId']), 'libxpm version for gd'); + $this->addLibrary($name.'-libxpm', Version::convertLibxpmVersionId((int) $libxpmMatches['versionId']), 'libxpm version for gd'); } break; @@ -363,7 +363,7 @@ class PlatformRepository extends ArrayRepository $info = $this->runtime->getExtensionInfo($name); if (Preg::isMatch('/^Vendor Version => (?\d+)$/im', $info, $matches) && Preg::isMatch('/^Vendor Name => (?.+)$/im', $info, $vendorMatches)) { - $this->addLibrary($name.'-'.strtolower($vendorMatches['vendor']), Version::convertOpenldapVersionId($matches['versionId']), $vendorMatches['vendor'].' version of ldap'); + $this->addLibrary($name.'-'.strtolower($vendorMatches['vendor']), Version::convertOpenldapVersionId((int) $matches['versionId']), $vendorMatches['vendor'].' version of ldap'); } break; diff --git a/src/Composer/Repository/RepositoryFactory.php b/src/Composer/Repository/RepositoryFactory.php index 80e03eff8..25e86aa52 100644 --- a/src/Composer/Repository/RepositoryFactory.php +++ b/src/Composer/Repository/RepositoryFactory.php @@ -164,7 +164,7 @@ class RepositoryFactory if ($repo['type'] === 'filesystem') { $repos[$name] = new FilesystemRepository($repo['json']); } else { - $repos[$name] = $rm->createRepository($repo['type'], $repo, $index); + $repos[$name] = $rm->createRepository($repo['type'], $repo, (string) $index); } } diff --git a/src/Composer/Repository/Vcs/GitLabDriver.php b/src/Composer/Repository/Vcs/GitLabDriver.php index 2397b78d3..a21ca6083 100644 --- a/src/Composer/Repository/Vcs/GitLabDriver.php +++ b/src/Composer/Repository/Vcs/GitLabDriver.php @@ -105,7 +105,11 @@ class GitLabDriver extends VcsDriver ? $match['scheme'] : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https') ; - $this->originUrl = self::determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']); + $origin = self::determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']); + if (false === $origin) { + throw new \LogicException('It should not be possible to create a gitlab driver with an unparseable origin URL ('.$this->url.')'); + } + $this->originUrl = $origin; if ($protocol = $this->config->get('gitlab-protocol')) { // https treated as a synonym for http. diff --git a/tests/Composer/Test/AllFunctionalTest.php b/tests/Composer/Test/AllFunctionalTest.php index 2bebf801c..a46b49859 100644 --- a/tests/Composer/Test/AllFunctionalTest.php +++ b/tests/Composer/Test/AllFunctionalTest.php @@ -184,7 +184,7 @@ class AllFunctionalTest extends TestCase { $tests = array(); foreach (Finder::create()->in(__DIR__.'/Fixtures/functional')->name('*.test')->files() as $file) { - $tests[basename($file)] = array($file->getRealPath()); + $tests[$file->getFilename()] = array((string) $file); } return $tests; diff --git a/tests/Composer/Test/ApplicationTest.php b/tests/Composer/Test/ApplicationTest.php index e0674c4fa..151eca5b4 100644 --- a/tests/Composer/Test/ApplicationTest.php +++ b/tests/Composer/Test/ApplicationTest.php @@ -55,8 +55,8 @@ class ApplicationTest extends TestCase $inputMock->expects($this->once()) ->method('getParameterOption') - ->with($this->equalTo(array('--working-dir', '-d'))) - ->will($this->returnValue(false)); + ->with($this->equalTo(array('--working-dir', '-d')), $this->equalTo(null)) + ->will($this->returnValue(null)); $inputMock->expects($this->any()) ->method('getFirstArgument') @@ -116,8 +116,8 @@ class ApplicationTest extends TestCase $inputMock->expects($this->once()) ->method('getParameterOption') - ->with($this->equalTo(array('--working-dir', '-d'))) - ->will($this->returnValue(false)); + ->with($this->equalTo(array('--working-dir', '-d')), $this->equalTo(null)) + ->will($this->returnValue(null)); $inputMock->expects($this->any()) ->method('getFirstArgument') diff --git a/tests/Composer/Test/CacheTest.php b/tests/Composer/Test/CacheTest.php index 6b83ac961..703650db3 100644 --- a/tests/Composer/Test/CacheTest.php +++ b/tests/Composer/Test/CacheTest.php @@ -17,7 +17,7 @@ use Composer\Util\Filesystem; class CacheTest extends TestCase { - /** @var string[] */ + /** @var array<\SplFileInfo> */ private $files; /** @var string */ private $root; diff --git a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php index 913fa5470..847b374d4 100644 --- a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php +++ b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php @@ -190,6 +190,8 @@ class PoolBuilderTest extends TestCase $fixturesDir = realpath(__DIR__.'/Fixtures/poolbuilder/'); $tests = array(); foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fixturesDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + $file = (string) $file; + if (!Preg::isMatch('/\.test$/', $file)) { continue; } @@ -220,13 +222,11 @@ class PoolBuilderTest extends TestCase } /** - * @param \SplFileInfo $file - * @param string $fixturesDir * @return array */ - protected function readTestFile(\SplFileInfo $file, string $fixturesDir): array + protected function readTestFile(string $file, string $fixturesDir): array { - $tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file->getRealPath()), -1, PREG_SPLIT_DELIM_CAPTURE); + $tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file), -1, PREG_SPLIT_DELIM_CAPTURE); $sectionInfo = array( 'TEST' => true, diff --git a/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php b/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php index a9f87feaa..37e7346fc 100644 --- a/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php +++ b/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php @@ -76,6 +76,8 @@ class PoolOptimizerTest extends TestCase $fixturesDir = realpath(__DIR__.'/Fixtures/pooloptimizer/'); $tests = array(); foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fixturesDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + $file = (string) $file; + if (!Preg::isMatch('/\.test$/', $file)) { continue; } @@ -97,12 +99,11 @@ class PoolOptimizerTest extends TestCase } /** - * @param string $fixturesDir * @return mixed[] */ - protected function readTestFile(\SplFileInfo $file, string $fixturesDir): array + protected function readTestFile(string $file, string $fixturesDir): array { - $tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file->getRealPath()), -1, PREG_SPLIT_DELIM_CAPTURE); + $tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file), -1, PREG_SPLIT_DELIM_CAPTURE); /** @var array $sectionInfo */ $sectionInfo = array( diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php index f63e5167e..f3782f2fb 100644 --- a/tests/Composer/Test/DependencyResolver/SolverTest.php +++ b/tests/Composer/Test/DependencyResolver/SolverTest.php @@ -24,6 +24,7 @@ use Composer\DependencyResolver\Operation\UpdateOperation; use Composer\DependencyResolver\Request; use Composer\DependencyResolver\Solver; use Composer\DependencyResolver\SolverProblemsException; +use Composer\Package\PackageInterface; use Composer\Package\Link; use Composer\Repository\RepositorySet; use Composer\Test\TestCase; @@ -1059,7 +1060,7 @@ class SolverTest extends TestCase } /** - * @param array> $expected + * @param array $expected * @return void */ protected function checkSolverResult(array $expected): void diff --git a/tests/Composer/Test/DependencyResolver/TransactionTest.php b/tests/Composer/Test/DependencyResolver/TransactionTest.php index 703fecf56..0f1182d84 100644 --- a/tests/Composer/Test/DependencyResolver/TransactionTest.php +++ b/tests/Composer/Test/DependencyResolver/TransactionTest.php @@ -19,6 +19,7 @@ use Composer\DependencyResolver\Operation\UninstallOperation; use Composer\DependencyResolver\Operation\UpdateOperation; use Composer\DependencyResolver\Transaction; use Composer\Package\Link; +use Composer\Package\PackageInterface; use Composer\Test\TestCase; class TransactionTest extends TestCase @@ -100,7 +101,7 @@ class TransactionTest extends TestCase /** * @param \Composer\DependencyResolver\Transaction $transaction - * @param array> $expected + * @param array $expected * @return void */ protected function checkTransactionOperations(Transaction $transaction, array $expected): void diff --git a/tests/Composer/Test/Downloader/FossilDownloaderTest.php b/tests/Composer/Test/Downloader/FossilDownloaderTest.php index 932fa5a36..ebe9cf75e 100644 --- a/tests/Composer/Test/Downloader/FossilDownloaderTest.php +++ b/tests/Composer/Test/Downloader/FossilDownloaderTest.php @@ -62,7 +62,7 @@ class FossilDownloaderTest extends TestCase self::expectException('InvalidArgumentException'); $downloader = $this->getDownloaderMock(); - $downloader->install($packageMock, '/path'); + $downloader->install($packageMock, $this->workingDir . '/path'); } public function testInstall(): void @@ -77,13 +77,13 @@ class FossilDownloaderTest extends TestCase $process = $this->getProcessExecutorMock(); $process->expects(array( - $this->getCmd('fossil clone -- \'http://fossil.kd2.org/kd2fw/\' \'repo.fossil\''), - $this->getCmd('fossil open --nested -- \'repo.fossil\''), + $this->getCmd('fossil clone -- \'http://fossil.kd2.org/kd2fw/\' \''.$this->workingDir.'.fossil\''), + $this->getCmd('fossil open --nested -- \''.$this->workingDir.'.fossil\''), $this->getCmd('fossil update -- \'trunk\''), ), true); $downloader = $this->getDownloaderMock(null, null, $process); - $downloader->install($packageMock, 'repo'); + $downloader->install($packageMock, $this->workingDir); } public function testUpdateforPackageWithoutSourceReference(): void diff --git a/tests/Composer/Test/Downloader/HgDownloaderTest.php b/tests/Composer/Test/Downloader/HgDownloaderTest.php index 135194263..3c5712b4c 100644 --- a/tests/Composer/Test/Downloader/HgDownloaderTest.php +++ b/tests/Composer/Test/Downloader/HgDownloaderTest.php @@ -77,12 +77,12 @@ class HgDownloaderTest extends TestCase $process = $this->getProcessExecutorMock(); $process->expects(array( - $this->getCmd('hg clone -- \'https://mercurial.dev/l3l0/composer\' \'composerPath\''), + $this->getCmd('hg clone -- \'https://mercurial.dev/l3l0/composer\' \''.$this->workingDir.'\''), $this->getCmd('hg up -- \'ref\''), ), true); $downloader = $this->getDownloaderMock(null, null, $process); - $downloader->install($packageMock, 'composerPath'); + $downloader->install($packageMock, $this->workingDir); } public function testUpdateforPackageWithoutSourceReference(): void diff --git a/tests/Composer/Test/InstallerTest.php b/tests/Composer/Test/InstallerTest.php index 04e4346c0..e22264338 100644 --- a/tests/Composer/Test/InstallerTest.php +++ b/tests/Composer/Test/InstallerTest.php @@ -521,6 +521,8 @@ class InstallerTest extends TestCase $tests = array(); foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fixturesDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + $file = (string) $file; + if (!Preg::isMatch('/\.test$/', $file)) { continue; } @@ -598,12 +600,11 @@ class InstallerTest extends TestCase } /** - * @param string $fixturesDir * @return mixed[] */ - protected function readTestFile(\SplFileInfo $file, string $fixturesDir): array + protected function readTestFile(string $file, string $fixturesDir): array { - $tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file->getRealPath()), -1, PREG_SPLIT_DELIM_CAPTURE); + $tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file), -1, PREG_SPLIT_DELIM_CAPTURE); $sectionInfo = array( 'TEST' => true, diff --git a/tests/Composer/Test/Mock/ProcessExecutorMock.php b/tests/Composer/Test/Mock/ProcessExecutorMock.php index 897d889ce..b3e7d176e 100644 --- a/tests/Composer/Test/Mock/ProcessExecutorMock.php +++ b/tests/Composer/Test/Mock/ProcessExecutorMock.php @@ -103,7 +103,7 @@ class ProcessExecutorMock extends ProcessExecutor Assert::assertTrue(true); // @phpstan-ignore-line } - public function execute($command, &$output = null, $cwd = null): int + public function execute($command, &$output = null, ?string $cwd = null): int { $cwd = $cwd ?? Platform::getCwd(); if (func_num_args() > 1) { @@ -113,7 +113,7 @@ class ProcessExecutorMock extends ProcessExecutor return $this->doExecute($command, $cwd, false); } - public function executeTty($command, $cwd = null): int + public function executeTty($command, ?string $cwd = null): int { $cwd = $cwd ?? Platform::getCwd(); if (Platform::isTty()) { diff --git a/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php b/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php index 8ef013b27..2fb91a2b2 100644 --- a/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php +++ b/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php @@ -289,7 +289,7 @@ class ArchivableFilesFinderTest extends TestCase $files = array(); foreach ($iterator as $file) { - $files[] = Preg::replace('#^phar://'.preg_quote($this->sources, '#').'/archive\.zip/archive#', '', $this->fs->normalizePath($file)); + $files[] = Preg::replace('#^phar://'.preg_quote($this->sources, '#').'/archive\.zip/archive#', '', $this->fs->normalizePath((string) $file)); } unset($archive, $iterator, $file); diff --git a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php index 812c1bf05..368655ec2 100644 --- a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php @@ -52,18 +52,16 @@ class GitLabDriverTest extends TestCase public function setUp(): void { $this->home = $this->getUniqueTmpDirectory(); - $this->config = new Config(); - $this->config->merge(array( - 'config' => array( - 'home' => $this->home, - 'gitlab-domains' => array( - 'mycompany.com/gitlab', - 'gitlab.mycompany.com', - 'othercompany.com/nested/gitlab', - 'gitlab.com', - ), + $this->config = $this->getConfig([ + 'home' => $this->home, + 'gitlab-domains' => array( + 'mycompany.com/gitlab', + 'gitlab.mycompany.com', + 'othercompany.com/nested/gitlab', + 'gitlab.com', + 'gitlab.mycompany.local', ), - )); + ]); $this->io = $this->getMockBuilder('Composer\IO\IOInterface')->disableOriginalConstructor()->getMock(); $this->process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); @@ -593,7 +591,7 @@ JSON; JSON; $this->httpDownloader->expects( - [['url' => 'https:///api/v4/projects/%2Fmyproject', 'body' => $projectData]], + [['url' => 'https://gitlab.mycompany.local/api/v4/projects/mygroup%2Fmyproject', 'body' => $projectData]], true );