You are here

public function ComposerIntegrationTest::testVendorCleanup in Drupal 10

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/ComposerIntegrationTest.php \Drupal\Tests\ComposerIntegrationTest::testVendorCleanup()

Tests the vendor cleanup utilities do not have obsolete packages listed.

File

core/tests/Drupal/Tests/ComposerIntegrationTest.php, line 255

Class

ComposerIntegrationTest
Tests Composer integration.

Namespace

Drupal\Tests

Code

public function testVendorCleanup() : void {
  $lock = json_decode(file_get_contents($this->root . '/composer.lock'), TRUE);
  $packages = [];
  foreach (array_merge($lock['packages'], $lock['packages-dev']) as $package) {
    $packages[] = $package['name'];
  }
  $reflection = new \ReflectionProperty(Config::class, 'defaultConfig');
  $reflection
    ->setAccessible(TRUE);
  $config = $reflection
    ->getValue();
  foreach (array_keys($config) as $package) {
    $this
      ->assertContains(strtolower($package), $packages);
  }
}