function ComposerPluginsValidatorTest::testValidationAfterTrustingDuringPreApply

Tests additional composer plugins can be trusted during pre-apply.

@dataProvider providerSimpleInvalidCases @dataProvider providerComplexInvalidCases

File

core/modules/package_manager/tests/src/Kernel/ComposerPluginsValidatorTest.php, line 173

Class

ComposerPluginsValidatorTest
@covers \Drupal\package_manager\Validator\ComposerPluginsValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testValidationAfterTrustingDuringPreApply(array $composer_config_to_add, array $packages_to_add, array $expected_results) : void {
    $expected_results_without_composer_plugin_violations = array_filter($expected_results, fn(ValidationResult $v) => !$v->summary || !str_contains(strtolower($v->summary
        ->getUntranslatedString()), 'unsupported composer plugin'));
    // Trust all added packages.
    $this->config('package_manager.settings')
        ->set('additional_trusted_composer_plugins', array_map(fn(array $package) => $package['name'], $packages_to_add))
        ->save();
    // Reuse the test logic that does not trust additional packages, but with
    // updated expected results.
    $this->testValidationDuringPreApply($composer_config_to_add, $packages_to_add, $expected_results_without_composer_plugin_violations);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.