Commit 572e554a authored by xjm's avatar xjm

Issue #3032686 by longwave, jibran, xjm, alexpott, Berdir, amateescu: Remove...

Issue #3032686 by longwave, jibran, xjm, alexpott, Berdir, amateescu: Remove references to unused packages in Drupal 9's vendor hardening
parent 0e9339a6
......@@ -24,7 +24,6 @@ class Config {
'behat/mink-browserkit-driver' => ['tests'],
'behat/mink-goutte-driver' => ['tests'],
'behat/mink-selenium2-driver' => ['tests'],
'brumann/polyfill-unserialize' => ['tests'],
'composer/composer' => ['bin'],
'drupal/coder' => [
'coder_sniffer/Drupal/Test',
......@@ -37,13 +36,10 @@ class Config {
'guzzlehttp/promises' => ['tests'],
'guzzlehttp/psr7' => ['tests'],
'instaclick/php-webdriver' => ['doc', 'test'],
'jcalderonzumba/gastonjs' => ['docs', 'examples', 'tests'],
'jcalderonzumba/mink-phantomjs-driver' => ['tests'],
'justinrainbow/json-schema' => ['demo'],
'masterminds/html5' => ['bin', 'test'],
'mikey179/vfsstream' => ['src/test'],
'myclabs/deep-copy' => ['doc'],
'paragonie/random_compat' => ['tests'],
'pear/archive_tar' => ['docs', 'tests'],
'pear/console_getopt' => ['tests'],
'pear/pear-core-minimal' => ['tests'],
......@@ -56,7 +52,6 @@ class Config {
'phpunit/php-timer' => ['tests'],
'phpunit/php-token-stream' => ['tests'],
'phpunit/phpunit' => ['tests'],
'phpunit/phpunit-mock-objects' => ['tests'],
'sebastian/code-unit-reverse-lookup' => ['tests'],
'sebastian/comparator' => ['tests'],
'sebastian/diff' => ['tests'],
......
......@@ -20,13 +20,8 @@ class Composer {
'behat/mink-browserkit-driver' => ['tests'],
'behat/mink-goutte-driver' => ['tests'],
'behat/mink-selenium2-driver' => ['tests'],
'brumann/polyfill-unserialize' => ['tests'],
'composer/composer' => ['bin'],
'drupal/coder' => ['coder_sniffer/Drupal/Test', 'coder_sniffer/DrupalPractice/Test'],
'doctrine/cache' => ['tests'],
'doctrine/collections' => ['tests'],
'doctrine/common' => ['tests'],
'doctrine/inflector' => ['tests'],
'doctrine/instantiator' => ['tests'],
'easyrdf/easyrdf' => ['scripts'],
'egulias/email-validator' => ['documentation', 'tests'],
......@@ -41,7 +36,6 @@ class Composer {
'masterminds/html5' => ['bin', 'test'],
'mikey179/vfsStream' => ['src/test'],
'myclabs/deep-copy' => ['doc'],
'paragonie/random_compat' => ['tests'],
'pear/archive_tar' => ['docs', 'tests'],
'pear/console_getopt' => ['tests'],
'pear/pear-core-minimal' => ['tests'],
......@@ -54,7 +48,6 @@ class Composer {
'phpunit/php-timer' => ['tests'],
'phpunit/php-token-stream' => ['tests'],
'phpunit/phpunit' => ['tests'],
'phpunit/phpunit-mock-objects' => ['tests'],
'sebastian/code-unit-reverse-lookup' => ['tests'],
'sebastian/comparator' => ['tests'],
'sebastian/diff' => ['tests'],
......
......@@ -2,6 +2,8 @@
namespace Drupal\Tests;
use Drupal\Composer\Plugin\VendorHardening\Config;
use Drupal\Core\Composer\Composer;
use Drupal\Tests\Composer\ComposerIntegrationTrait;
use Symfony\Component\Yaml\Yaml;
......@@ -241,4 +243,36 @@ protected static function getContentHash($composerFileContents)
}
// @codingStandardsIgnoreEnd
/**
* Tests the vendor cleanup utilities do not have obsolete packages listed.
*
* @dataProvider providerTestVendorCleanup
*/
public function testVendorCleanup($class, $property) {
$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($class, $property);
$reflection->setAccessible(TRUE);
$config = $reflection->getValue();
foreach (array_keys($config) as $package) {
$this->assertContains(strtolower($package), $packages);
}
}
/**
* Data provider for the vendor cleanup utility classes.
*
* @return array[]
*/
public function providerTestVendorCleanup() {
return [
[Composer::class, 'packageToCleanup'],
[Config::class, 'defaultConfig'],
];
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment