function ComposerPatchesValidatorTest::providerErrorDuringPreApply

Data provider for testErrorDuringPreApply() and testHelpLink().

Return value

mixed[][] The test cases.

File

core/modules/package_manager/tests/src/Kernel/ComposerPatchesValidatorTest.php, line 109

Class

ComposerPatchesValidatorTest
@covers \Drupal\package_manager\Validator\ComposerPatchesValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public static function providerErrorDuringPreApply() : array {
    $summary = t('Problems detected related to the Composer plugin <code>cweagans/composer-patches</code>.');
    return [
        'composer-patches present in stage, but not present in active' => [
            static::ABSENT,
            static::CONFIG_ALLOWED_PLUGIN | static::EXTRA_EXIT_ON_PATCH_FAILURE | static::REQUIRE_PACKAGE_FROM_ROOT,
            [
                ValidationResult::createError([
                    t('It cannot be installed by Package Manager.'),
                ], $summary),
            ],
            [
                'package-manager-faq-composer-patches-installed-or-removed',
            ],
        ],
        'composer-patches partially present (exit missing)  in stage, but not present in active' => [
            static::ABSENT,
            static::CONFIG_ALLOWED_PLUGIN | static::REQUIRE_PACKAGE_FROM_ROOT,
            [
                ValidationResult::createError([
                    t('It cannot be installed by Package Manager.'),
                    t('The <code>composer-exit-on-patch-failure</code> key is not set to <code>true</code> in the <code>extra</code> section of <code>composer.json</code>.'),
                ], $summary),
            ],
            [
                'package-manager-faq-composer-patches-installed-or-removed',
                NULL,
            ],
        ],
        'composer-patches present due to non-root dependency in stage, but not present in active' => [
            static::CONFIG_ALLOWED_PLUGIN | static::EXTRA_EXIT_ON_PATCH_FAILURE,
            static::CONFIG_ALLOWED_PLUGIN | static::EXTRA_EXIT_ON_PATCH_FAILURE | static::REQUIRE_PACKAGE_INDIRECTLY,
            [
                ValidationResult::createError([
                    t('It cannot be installed by Package Manager.'),
                    t('It must be a root dependency.'),
                ], $summary),
            ],
            [
                'package-manager-faq-composer-patches-installed-or-removed',
                'package-manager-faq-composer-patches-not-a-root-dependency',
                NULL,
            ],
        ],
        'composer-patches removed in stage, but present in active' => [
            static::CONFIG_ALLOWED_PLUGIN | static::EXTRA_EXIT_ON_PATCH_FAILURE | static::REQUIRE_PACKAGE_FROM_ROOT,
            static::ABSENT,
            [
                ValidationResult::createError([
                    t('It cannot be removed by Package Manager.'),
                ], $summary),
            ],
            [
                'package-manager-faq-composer-patches-installed-or-removed',
            ],
        ],
        'composer-patches present in stage and active' => [
            static::CONFIG_ALLOWED_PLUGIN | static::EXTRA_EXIT_ON_PATCH_FAILURE | static::REQUIRE_PACKAGE_FROM_ROOT,
            static::CONFIG_ALLOWED_PLUGIN | static::EXTRA_EXIT_ON_PATCH_FAILURE | static::REQUIRE_PACKAGE_FROM_ROOT,
            [],
            [],
        ],
        'composer-patches not present in stage and active' => [
            static::ABSENT,
            static::ABSENT,
            [],
            [],
        ],
    ];
}

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