function ComposerPluginsValidatorTest::testInsecureConfigurationFailsValidationPreCreate

Tests `config.allow-plugins: true` fails validation during pre-create.

File

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

Class

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

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testInsecureConfigurationFailsValidationPreCreate() : void {
    $active_manipulator = new ActiveFixtureManipulator();
    $active_manipulator->addConfig([
        'allow-plugins' => TRUE,
    ]);
    $active_manipulator->commitChanges();
    $expected_results = [
        ValidationResult::createError([
            new TranslatableMarkup('All composer plugins are allowed because <code>config.allow-plugins</code> is configured to <code>true</code>. This is an unacceptable security risk.'),
        ]),
    ];
    $this->assertStatusCheckResults($expected_results);
    $this->assertResults($expected_results, PreCreateEvent::class);
}

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