Skip to content

Commit

Permalink
Fix composer task when packagist.org is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
AegirLeet committed Mar 27, 2021
1 parent aca8611 commit 06aa399
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 06aa399

Please sign in to comment.