function PhpTufValidatorTest::testPluginRemovedFromStagePreRequire

Same name and namespace in other branches
  1. main core/modules/package_manager/tests/src/Kernel/PhpTufValidatorTest.php \Drupal\Tests\package_manager\Kernel\PhpTufValidatorTest::testPluginRemovedFromStagePreRequire()

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

File

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

Class

PhpTufValidatorTest
Tests Drupal\package_manager\Validator\PhpTufValidator.

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.