Skip to content

Commit

Permalink
Merge pull request #5 from Sweetchuck/1.x-cmd-validate-do-not-fail-on…
Browse files Browse the repository at this point in the history
…-missing

Do not fail on "validate" when a *.json suite file is missing
  • Loading branch information
Sweetchuck authored May 3, 2021
2 parents f70d7a2 + 1d45377 commit e95e980
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Composer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,14 @@ protected function onCommandEventValidate(): bool

switch ($whatToDo) {
case 'create':
$this->io->error("<error>{$pluginName} - {$newFileName} is not exists</error>");
$this->io->warning("<warning>{$pluginName} - {$newFileName} is not exists</warning>");
break;

case 'update':
$isUpToDate = false;
$this->io->error("<error>{$pluginName} - {$newFileName} is not up to date</error>");
break;
}

$isUpToDate = false;
}

return $isUpToDate;
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/Composer/Command/ValidateCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,15 @@ public function runComposerValidate(AcceptanceTester $I)
$I->writeToFile("{$this->projectRoot}/composer.one.json", "$threeString\n");
$I->writeToFile("{$this->projectRoot}/composer.two.json", "$threeString\n");
$I->runShellCommand("cd $prSafe && composer validate 2>&1");
$I->canSeeResultCodeIs(0);

$I->deleteFile("{$this->projectRoot}/composer.one.json");
$I->deleteFile("{$this->projectRoot}/composer.two.json");
$I->deleteFile("{$this->projectRoot}/composer.three.json");
$I->runShellCommand("cd $prSafe && composer suite:generate");
$I->runShellCommand("cd $prSafe && composer validate");
// It is valid when a suite *.json file is missing.
$I->canSeeResultCodeIs(0);
}

protected function selfProjectRoot(): string
Expand Down

0 comments on commit e95e980

Please sign in to comment.