function ComposerInspectorTest::testAllowedPlugins

Tests ComposerInspector's parsing of the allowed plugins list.

@covers ::getAllowPluginsConfig

@dataProvider providerAllowedPlugins

Parameters

array $config: The Composer configuration to set.

array|bool $expected_value: The expected return value from getAllowPluginsConfig().

File

core/modules/package_manager/tests/src/Kernel/ComposerInspectorTest.php, line 507

Class

ComposerInspectorTest
@coversDefaultClass \Drupal\package_manager\ComposerInspector

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testAllowedPlugins(array $config, bool|array $expected_value) : void {
    (new ActiveFixtureManipulator())->addConfig($config)
        ->commitChanges();
    $project_root = $this->container
        ->get(PathLocator::class)
        ->getProjectRoot();
    $actual_value = $this->container
        ->get(ComposerInspector::class)
        ->getAllowPluginsConfig($project_root);
    if (is_array($expected_value)) {
        ksort($expected_value);
    }
    if (is_array($actual_value)) {
        ksort($actual_value);
    }
    $this->assertSame($expected_value, $actual_value);
}

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