function PhpTufValidatorTest::setUp

Overrides PackageManagerKernelTestBase::setUp

File

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

Class

PhpTufValidatorTest
Tests Drupal\package_manager\Validator\PhpTufValidator.

Namespace

Drupal\Tests\package_manager\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  // PHP-TUF must be enabled for this test to run.
  $this->setSetting('package_manager_bypass_tuf', FALSE);
  // audit.block-insecure is only available in Composer 2.9.2 onwards.
  try {
    (new ActiveFixtureManipulator())->addConfig([
      'audit.block-insecure' => FALSE,
    ])
      ->commitChanges();
  } catch (\RuntimeException $e) {
    $this->assertStringContainsString('Setting audit.block-insecure does not exist', $e->getMessage());
  }
  (new ActiveFixtureManipulator())->addConfig([
    'repositories.drupal' => [
      'type' => 'composer',
      'url' => 'https://packages.drupal.org/8',
      'tuf' => TRUE,
    ],
    'allow-plugins.' . PhpTufValidator::PLUGIN_NAME => TRUE,
  ])
    ->addPackage([
    'name' => PhpTufValidator::PLUGIN_NAME,
    'type' => 'composer-plugin',
    'require' => [
      'composer-plugin-api' => '*',
    ],
    'extra' => [
      'class' => 'PhpTufComposerPlugin',
    ],
  ])
    ->commitChanges()
    ->updateLock();
}

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