function ComposerIntegrationTest::testVendorCleanup

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/ComposerIntegrationTest.php \Drupal\Tests\ComposerIntegrationTest::testVendorCleanup()
  2. 11.x 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 257

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');
  $config = $reflection->getValue();
  foreach (array_keys($config) as $package) {
    $this->assertContains(strtolower($package), $packages);
  }
}

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