Skip to content

Commit

Permalink
Merge pull request #886 from AegirLeet/fix-composer-task
Browse files Browse the repository at this point in the history
Fix composer task when packagist.org is disabled
  • Loading branch information
veewee authored Apr 28, 2021
2 parents 5820a5a + 06aa399 commit f476085
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Task/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private function hasLocalRepository(SplFileInfo $composerFile): bool
}

foreach ($package['repositories'] as $repository) {
if ('path' === $repository['type']) {
if ('path' === ($repository['type'] ?? null)) {
return true;
}
}
Expand Down
16 changes: 16 additions & 0 deletions test/Unit/Task/ComposerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,22 @@ function () {
);
}
];
yield 'packagistDotOrgDisabled' => [
[
'no_local_repository' => true,
],
$this->mockContext(RunContext::class, ['composer.json']),
function () {
$this->mockProcessBuilder('composer', $this->mockProcess(0));
$this->filesystem->readFromFileInfo(Argument::which('getBasename', 'composer.json'))->willReturn(
json_encode([
'repositories' => [
['packagist.org' => false],
],
])
);
}
];
}

public function provideSkipsOnStuff(): iterable
Expand Down

0 comments on commit f476085

Please sign in to comment.