Skip to content

Commit

Permalink
Fix for latest Composer release (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Jul 13, 2022
1 parent 3000c3c commit 1c5c484
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:

runs-on: ${{ matrix.os }}

env:
COMPOSER_PROCESS_TIMEOUT: 300

steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
"Tests\\": "./tests"
}
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"kubawerlos/composer-smaller-lock": true,
"phpstan/extension-installer": true
}
},
"extra": {
"class": "ComposerSmallerLock\\Plugin"
},
Expand Down
5 changes: 3 additions & 2 deletions tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function testPackage(string $package): void
$repositories = ['type' => 'path', 'url' => __DIR__ . '/..', 'options' => ['symlink' => false]];
$this->runCommand(\sprintf('composer require %s --no-interaction --no-update', $package), $directory);
$this->runCommand(\sprintf('composer config repositories.self "%s"', \str_replace('"', '\\"', \json_encode($repositories, \JSON_UNESCAPED_SLASHES))), $directory);
$this->runCommand('composer config --no-plugins allow-plugins.kubawerlos/composer-smaller-lock true', $directory, false);
$this->runCommand('composer require kubawerlos/composer-smaller-lock:*@dev --ignore-platform-reqs --no-plugins', $directory);

$originalDependencies = $this->runCommand('composer show', $directory);
Expand Down Expand Up @@ -84,7 +85,7 @@ public static function providePackageCases(): iterable
yield ['symfony/symfony'];
}

protected function runCommand(string $command, string $cwd): string
protected function runCommand(string $command, string $cwd, bool $mustSucceed = true): string
{
if (\method_exists(Process::class, 'fromShellCommandline')) {
$process = Process::fromShellCommandline($command, $cwd);
Expand All @@ -94,7 +95,7 @@ protected function runCommand(string $command, string $cwd): string

$exitCode = $process->run();

if ($exitCode !== 0) {
if ($exitCode !== 0 && $mustSucceed) {
throw new \RuntimeException($process->getErrorOutput());
}

Expand Down

0 comments on commit 1c5c484

Please sign in to comment.