function PhpTufValidatorTest::testPluginNotInstalledInProjectRoot

Tests there is an error if the plugin is not installed in the project root.

File

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

Class

PhpTufValidatorTest
@coversDefaultClass \Drupal\package_manager\Validator\PhpTufValidator[[api-linebreak]] @group package_manager @group #slow @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testPluginNotInstalledInProjectRoot() : void {
  (new ActiveFixtureManipulator())->removePackage(PhpTufValidator::PLUGIN_NAME)
    ->commitChanges()
    ->updateLock();
  $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 active directory is not protected by PHP-TUF, which is required to use Package Manager securely.'));
  $this->assertStatusCheckResults([
    $result,
  ]);
  $this->assertResults([
    $result,
  ], PreCreateEvent::class);
}

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