Disable packagist.org loading by default in initTempComposer test cases if other repos are provided
parent
7377d1f003
commit
a6d872191c
|
@ -123,17 +123,17 @@ class ConfigCommandTest extends TestCase
|
|||
'vendor',
|
||||
];
|
||||
yield 'read repos by named key' => [
|
||||
['repositories' => ['foo' => ['type' => 'vcs', 'url' => 'https://example.org']]],
|
||||
['repositories' => ['foo' => ['type' => 'vcs', 'url' => 'https://example.org'], 'packagist.org' => ['type' => 'composer', 'url' => 'https://repo.packagist.org']]],
|
||||
['setting-key' => 'repositories.foo'],
|
||||
'{"type":"vcs","url":"https://example.org"}',
|
||||
];
|
||||
yield 'read repos by numeric index' => [
|
||||
['repositories' => [['type' => 'vcs', 'url' => 'https://example.org']]],
|
||||
['repositories' => [['type' => 'vcs', 'url' => 'https://example.org'], 'packagist.org' => ['type' => 'composer', 'url' => 'https://repo.packagist.org']]],
|
||||
['setting-key' => 'repos.0'],
|
||||
'{"type":"vcs","url":"https://example.org"}',
|
||||
];
|
||||
yield 'read all repos includes the default packagist' => [
|
||||
['repositories' => ['foo' => ['type' => 'vcs', 'url' => 'https://example.org']]],
|
||||
['repositories' => ['foo' => ['type' => 'vcs', 'url' => 'https://example.org'], 'packagist.org' => ['type' => 'composer', 'url' => 'https://repo.packagist.org']]],
|
||||
['setting-key' => 'repos'],
|
||||
'{"foo":{"type":"vcs","url":"https://example.org"},"packagist.org":{"type":"composer","url":"https://repo.packagist.org"}}',
|
||||
];
|
||||
|
|
|
@ -137,6 +137,10 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
|
|||
$authJson = new \stdClass;
|
||||
}
|
||||
|
||||
if (is_array($composerJson) && isset($composerJson['repositories']) && !isset($composerJson['repositories']['packagist.org'])) {
|
||||
$composerJson['repositories']['packagist.org'] = false;
|
||||
}
|
||||
|
||||
chdir($dir);
|
||||
file_put_contents($dir.'/composer.json', JsonFile::encode($composerJson, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
file_put_contents($dir.'/auth.json', JsonFile::encode($authJson, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
|
|
Loading…
Reference in New Issue