function StageBaseTest::providerValidateRequirements

Data provider for testValidateRequirements.

Return value

array[] The test cases.

File

core/modules/package_manager/tests/src/Unit/StageBaseTest.php, line 48

Class

StageBaseTest
@coversDefaultClass \Drupal\package_manager\StageBase @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Unit

Code

public static function providerValidateRequirements() : array {
    return [
        // Valid requirements.
[
            NULL,
            'vendor/package',
        ],
        [
            NULL,
            'vendor/snake_case',
        ],
        [
            NULL,
            'vendor/kebab-case',
        ],
        [
            NULL,
            'vendor/with.dots',
        ],
        [
            NULL,
            '1vendor2/3package4',
        ],
        [
            NULL,
            'vendor/package:1',
        ],
        [
            NULL,
            'vendor/package:1.2',
        ],
        [
            NULL,
            'vendor/package:1.2.3',
        ],
        [
            NULL,
            'vendor/package:1.x',
        ],
        [
            NULL,
            'vendor/package:^1',
        ],
        [
            NULL,
            'vendor/package:~1',
        ],
        [
            NULL,
            'vendor/package:>1',
        ],
        [
            NULL,
            'vendor/package:<1',
        ],
        [
            NULL,
            'vendor/package:>=1',
        ],
        [
            NULL,
            'vendor/package:>1 <2',
        ],
        [
            NULL,
            'vendor/package:1 || 2',
        ],
        [
            NULL,
            'vendor/package:>=1,<1.1.0',
        ],
        [
            NULL,
            'vendor/package:1a',
        ],
        [
            NULL,
            'vendor/package:*',
        ],
        [
            NULL,
            'vendor/package:dev-master',
        ],
        [
            NULL,
            'vendor/package:*@dev',
        ],
        [
            NULL,
            'vendor/package:@dev',
        ],
        [
            NULL,
            'vendor/package:master@dev',
        ],
        [
            NULL,
            'vendor/package:master@beta',
        ],
        [
            NULL,
            'php',
        ],
        [
            NULL,
            'php:8',
        ],
        [
            NULL,
            'php:8.0',
        ],
        [
            NULL,
            'php:^8.1',
        ],
        [
            NULL,
            'php:~8.1',
        ],
        [
            NULL,
            'php-64bit',
        ],
        [
            NULL,
            'composer',
        ],
        [
            NULL,
            'composer-plugin-api',
        ],
        [
            NULL,
            'composer-plugin-api:1',
        ],
        [
            NULL,
            'ext-json',
        ],
        [
            NULL,
            'ext-json:1',
        ],
        [
            NULL,
            'ext-pdo_mysql',
        ],
        [
            NULL,
            'ext-pdo_mysql:1',
        ],
        [
            NULL,
            'lib-curl',
        ],
        [
            NULL,
            'lib-curl:1',
        ],
        [
            NULL,
            'lib-curl-zlib',
        ],
        [
            NULL,
            'lib-curl-zlib:1',
        ],
        // Invalid requirements.
[
            \InvalidArgumentException::class,
            '',
        ],
        [
            \InvalidArgumentException::class,
            ' ',
        ],
        [
            \InvalidArgumentException::class,
            '/',
        ],
        [
            \InvalidArgumentException::class,
            'php8',
        ],
        [
            \InvalidArgumentException::class,
            'package',
        ],
        [
            \InvalidArgumentException::class,
            'vendor\\package',
        ],
        [
            \InvalidArgumentException::class,
            'vendor//package',
        ],
        [
            \InvalidArgumentException::class,
            'vendor/package1 vendor/package2',
        ],
        [
            \InvalidArgumentException::class,
            'vendor/package/extra',
        ],
        [
            \UnexpectedValueException::class,
            'vendor/package:a',
        ],
        [
            \UnexpectedValueException::class,
            'vendor/package:',
        ],
        [
            \UnexpectedValueException::class,
            'vendor/package::',
        ],
        [
            \UnexpectedValueException::class,
            'vendor/package::1',
        ],
        [
            \UnexpectedValueException::class,
            'vendor/package:1:2',
        ],
        [
            \UnexpectedValueException::class,
            'vendor/package:develop@dev@dev',
        ],
        [
            \UnexpectedValueException::class,
            'vendor/package:develop@',
        ],
        [
            \InvalidArgumentException::class,
            'vEnDor/pAcKaGe',
        ],
        [
            \InvalidArgumentException::class,
            '_vendor/package',
        ],
        [
            \InvalidArgumentException::class,
            '_vendor/_package',
        ],
        [
            \InvalidArgumentException::class,
            'vendor_/package',
        ],
        [
            \InvalidArgumentException::class,
            '_vendor/package_',
        ],
        [
            \InvalidArgumentException::class,
            'vendor/package-',
        ],
        [
            \InvalidArgumentException::class,
            'php-',
        ],
        [
            \InvalidArgumentException::class,
            'ext',
        ],
        [
            \InvalidArgumentException::class,
            'lib',
        ],
    ];
}

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