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 66

Class

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

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testPluginNotInstalledInProjectRoot() : void {
    (new ActiveFixtureManipulator())->removePackage(PhpTufValidator::PLUGIN_NAME)
        ->commitChanges();
    $messages = [
        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.
t('The <code>php-tuf/composer-integration</code> plugin is not listed as an allowed plugin.'),
    ];
    $result = ValidationResult::createError($messages, 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.