function ComposerPluginsValidatorTest::providerSimpleValidCases

Generates simple test cases.

Return value

\Generator

1 call to ComposerPluginsValidatorTest::providerSimpleValidCases()
ComposerPluginsValidatorTest::providerComplexInvalidCases in core/modules/package_manager/tests/src/Kernel/ComposerPluginsValidatorTest.php
Generates complex invalid test cases based on the simple test cases.

File

core/modules/package_manager/tests/src/Kernel/ComposerPluginsValidatorTest.php, line 194

Class

ComposerPluginsValidatorTest
@covers \Drupal\package_manager\Validator\ComposerPluginsValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public static function providerSimpleValidCases() : \Generator {
    (yield 'no composer plugins' => [
        [],
        [
            [
                'name' => "drupal/semver_test",
                'version' => '8.1.0',
                'type' => 'drupal-module',
            ],
        ],
        [],
    ]);
    (yield 'another supported composer plugin' => [
        [
            'allow-plugins.drupal/core-vendor-hardening' => TRUE,
        ],
        [
            [
                'name' => 'drupal/core-vendor-hardening',
                'version' => '9.8.0',
                'type' => 'composer-plugin',
                'require' => [
                    'composer-plugin-api' => '*',
                ],
                'extra' => [
                    'class' => 'AnyClass',
                ],
            ],
        ],
        [],
    ]);
    (yield 'a supported composer plugin for which any version is supported: party like it is Drupal 99!' => [
        [
            'allow-plugins.drupal/core-composer-scaffold' => TRUE,
        ],
        [
            [
                'name' => 'drupal/core-composer-scaffold',
                'version' => '99.0.0',
                'type' => 'composer-plugin',
                'require' => [
                    'composer-plugin-api' => '*',
                ],
                'extra' => [
                    'class' => 'AnyClass',
                ],
            ],
        ],
        [],
    ]);
    (yield 'one UNsupported but disallowed plugin — pretty package name' => [
        [
            'allow-plugins.composer/plugin-a' => FALSE,
        ],
        [
            [
                'name' => 'composer/plugin-a',
                'version' => '6.1',
                'type' => 'composer-plugin',
                'require' => [
                    'composer-plugin-api' => '*',
                ],
                'extra' => [
                    'class' => 'AnyClass',
                ],
            ],
        ],
        [],
    ]);
    (yield 'one UNsupported but disallowed plugin — normalized package name' => [
        [
            'allow-plugins.composer/plugin-b' => FALSE,
        ],
        [
            [
                'name' => 'composer/plugin-b',
                'version' => '20.1',
                'type' => 'composer-plugin',
                'require' => [
                    'composer-plugin-api' => '*',
                ],
                'extra' => [
                    'class' => 'AnyClass',
                ],
            ],
        ],
        [],
    ]);
}

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