function PhpTufValidatorTest::testPluginRemovedFromStagePreRequire

Tests removing the plugin from the stage on pre-require.

File

core/modules/package_manager/tests/src/Kernel/PhpTufValidatorTest.php, line 91

Class

PhpTufValidatorTest
@coversDefaultClass \Drupal\package_manager\Validator\PhpTufValidator @group package_manager @group #slow @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testPluginRemovedFromStagePreRequire() : void {
    $this->getStageFixtureManipulator()
        ->removePackage(PhpTufValidator::PLUGIN_NAME);
    $messages = [
        $this->t('The <code>php-tuf/composer-integration</code> plugin is not installed.'),
        // Composer automatically removes the plugin from the `allow-plugins`
        // list when the plugin package is removed.
$this->t('The <code>php-tuf/composer-integration</code> plugin is not listed as an allowed plugin.'),
    ];
    $result = ValidationResult::createError($messages, $this->t('The stage directory is not protected by PHP-TUF, which is required to use Package Manager securely.'));
    $this->assertResults([
        $result,
    ], PreRequireEvent::class);
}

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