function ComposerPluginsValidatorTestBase::doTestValidationAfterTrustingDuringPreApply

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

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

File

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

Class

ComposerPluginsValidatorTestBase
@internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

protected function doTestValidationAfterTrustingDuringPreApply(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->doTestValidationDuringPreApply($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.