Issue #3344127: Composer validate all fixture manipulation changes
Merge request reports
Activity
added 2 commits
added 2 commits
added 1 commit
- 33e2afe2 - fix examples in ComposerPluginsValidatorTest
added 1 commit
- ac010423 - forgot to add new file existing_correct_fixture
added 1 commit
- fb324920 - resolved test failures in ComposerPluginsValidatorTest
225 231 'name' => 'composer/plugin-b', 226 232 'version' => '20.1', 227 233 'type' => 'composer-plugin', 228 ], 229 ], 230 [], 231 ]; 232 233 yield 'one UNsupported but disallowed plugin' => [ I removed it because I think we don't need this test case anymore. This case handles the situation where we have a unsupported plugin but it's not disallowed or allowed in 'allow-plugins' and now we validate composer in FixtureManipulator this case gives a error
composer/plugin-c contains a Composer plugin which is blocked by your allow -plugins config. You may add it to the list if you consider it safe. You can run "composer config --no-plugins allow-plugins.composer/plugin-c [ true|false]" to enable it (true) or disable it explicitly and suppress this exception (false)
and if I fix it by adding it in 'allow-plugins' i.e. doing
'allow-plugins' => [ // Definitely NOT `composer/plugin-c`! 'drupal/core-project-message' => TRUE, 'composer/plugin-c' => FALSE, ],
in our test case, then it's mostly testing the same thing as the preceding case.
Edited by Kunal Sachdevchanged this line in version 13 of the diff
I have created The Composer project must pass validation in order to use Package Manager which would mean we would not have to deal with invalid Composer setup in individual validators.
So I think it ok to remove this case if there is a
@todo
pointing to this issue ensure that we handle invalid projects in generalEdited by Ted Bowman
163 182 if ($should_exist && isset($is_dev_requirement)) { 164 183 throw new \LogicException('Changing an existing project to a dev requirement is not supported'); 165 184 } 185 // To pass Composer validation all packages must have a version specified. 186 if (!$should_exist && $package && !isset($package['version'])) { 187 $package['version'] = '1.2.3'; 188 } - Comment on lines +185 to +188
Should we not instead require that allsetPackage()
calls specify a version?This is fine to get this MR going, but once this is green I think we should remove it and replace it with:
185 // To pass Composer validation all packages must have a version specified. 186 if (!$should_exist && $package && !isset($package['version'])) { 187 $package['version'] = '1.2.3'; 188 } 185 // To pass Composer validation all packages must have a version specified. 186 if (!$should_exist && $package && !isset($package['version'])) { 187 throw new \LogicException('Composer requires each package to have a version.'); 188 } changed this line in version 12 of the diff
added 1 commit
- 073719ea - resolved failure in ComposerPatchesValidatorTest
357 380 * @param string $dir 358 381 * The directory to commit the changes to. 359 382 */ 360 protected function doCommitChanges(string $dir): void { 383 final protected function doCommitChanges(string $dir): void { Final is great! Methods, classes, and class constants (as of 8.1) can all be final. https://www.php.net/manual/en/language.oop5.final.php
Edited by Adam G-H
added 2 commits
added 2 commits
- Resolved by Wim Leers
40 40 */ 41 41 private string $dir; 42 42 43 /** 44 * Validate the fixtures still passes `composer validate`. 45 */ 46 private function validateComposer(): void { 47 /** @var \PhpTuf\ComposerStager\Domain\Service\ProcessRunner\ComposerRunnerInterface $runner */ 48 $runner = \Drupal::service('PhpTuf\ComposerStager\Domain\Service\ProcessRunner\ComposerRunnerInterface'); 49 $runner->run([ 50 'validate', 51 // @todo Check the lock file in https://drupal.org/i/3343827. 52 '--no-check-lock',