function ComposerPluginsValidatorTestBase::doTestValidationAfterTrustingDuringPreCreate

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

2 calls to ComposerPluginsValidatorTestBase::doTestValidationAfterTrustingDuringPreCreate()
ComposerPluginsValidatorComplexInvalidTest::testValidationAfterTrustingDuringPreCreate in core/modules/package_manager/tests/src/Kernel/ComposerPluginsValidatorComplexInvalidTest.php
Tests additional composer plugins can be trusted during pre-create.
ComposerPluginsValidatorSimpleInvalidTest::testValidationAfterTrustingDuringPreCreate in core/modules/package_manager/tests/src/Kernel/ComposerPluginsValidatorSimpleInvalidTest.php
Tests additional composer plugins can be trusted during pre-create.

File

core/modules/package_manager/tests/src/Kernel/ComposerPluginsValidatorTestBase.php, line 62

Class

ComposerPluginsValidatorTestBase
@group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

protected function doTestValidationAfterTrustingDuringPreCreate(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->doTestValidationDuringPreCreate($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.