function SupportedReleaseValidatorTest::providerException

Data provider for testException().

Return value

mixed[][] The test cases.

File

core/modules/package_manager/tests/src/Kernel/SupportedReleaseValidatorTest.php, line 73

Class

SupportedReleaseValidatorTest
@coversDefaultClass \Drupal\package_manager\Validator\SupportedReleaseValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public static function providerException() : array {
    $release_fixture_folder = __DIR__ . '/../../fixtures/release-history';
    $summary = t('Cannot update because the following project version is not in the list of installable releases.');
    return [
        'semver, supported update' => [
            [
                'semver_test' => "{$release_fixture_folder}/semver_test.1.1.xml",
            ],
            TRUE,
            [
                'name' => "drupal/semver_test",
                'version' => '8.1.1',
                'type' => 'drupal-module',
            ],
            [],
        ],
        'semver, update to unsupported branch' => [
            [
                'semver_test' => "{$release_fixture_folder}/semver_test.1.1.xml",
            ],
            TRUE,
            [
                'name' => "drupal/semver_test",
                'version' => '8.2.0',
                'type' => 'drupal-module',
            ],
            [
                ValidationResult::createError([
                    t('semver_test (drupal/semver_test) 8.2.0'),
                ], $summary),
            ],
        ],
        'legacy, supported update' => [
            [
                'aaa_update_test' => "{$release_fixture_folder}/aaa_update_test.1.1.xml",
            ],
            TRUE,
            [
                'name' => "drupal/aaa_update_test",
                'version' => '2.1.0',
                'type' => 'drupal-module',
            ],
            [],
        ],
        'legacy, update to unsupported branch' => [
            [
                'aaa_update_test' => "{$release_fixture_folder}/aaa_update_test.1.1.xml",
            ],
            TRUE,
            [
                'name' => "drupal/aaa_update_test",
                'version' => '3.0.0',
                'type' => 'drupal-module',
            ],
            [
                ValidationResult::createError([
                    t('aaa_update_test (drupal/aaa_update_test) 3.0.0'),
                ], $summary),
            ],
        ],
        'package_manager_test_update(not in active), update to unsupported branch' => [
            [
                'package_manager_test_update' => "{$release_fixture_folder}/package_manager_test_update.7.0.1.xml",
            ],
            FALSE,
            [
                'name' => "drupal/package_manager_test_update",
                'version' => '7.0.1-dev',
                'type' => 'drupal-module',
            ],
            [
                ValidationResult::createError([
                    t('package_manager_test_update (drupal/package_manager_test_update) 7.0.1-dev'),
                ], $summary),
            ],
        ],
        'package_manager_test_update(not in active), update to supported branch' => [
            [
                'package_manager_test_update' => "{$release_fixture_folder}/package_manager_test_update.7.0.1.xml",
            ],
            FALSE,
            [
                'name' => "drupal/package_manager_test_update",
                'version' => '7.0.1',
                'type' => 'drupal-module',
            ],
            [],
        ],
        'package_manager_theme, supported update' => [
            [
                'package_manager_theme' => "{$release_fixture_folder}/package_manager_theme.1.1.xml",
            ],
            TRUE,
            [
                'name' => "drupal/package_manager_theme",
                'version' => '8.1.1',
                'type' => 'drupal-theme',
            ],
            [],
        ],
        'package_manager_theme, update to unsupported branch' => [
            [
                'package_manager_theme' => "{$release_fixture_folder}/package_manager_theme.1.1.xml",
            ],
            TRUE,
            [
                'name' => "drupal/package_manager_theme",
                'version' => '8.2.0',
                'type' => 'drupal-theme',
            ],
            [
                ValidationResult::createError([
                    t('package_manager_theme (drupal/package_manager_theme) 8.2.0'),
                ], $summary),
            ],
        ],
        // For modules that don't start with 'drupal/' will not have update XML
        // from drupal.org and so will not be checked by the validator.
        // @see \Drupal\package_manager\Validator\SupportedReleaseValidator::checkStagedReleases()
'updating a module that does not start with drupal/' => [
            [],
            TRUE,
            [
                'name' => "somewhere/a_drupal_module",
                'version' => '8.1.1',
                'type' => 'drupal-module',
            ],
            [],
        ],
        'updating a module that does not have project info' => [
            [],
            TRUE,
            [
                'name' => "drupal/module_no_project",
                'version' => '1.1.0',
                'type' => 'drupal-module',
            ],
            [
                ValidationResult::createError([
                    t('Cannot update because the following new or updated Drupal package does not have project information: drupal/module_no_project'),
                ]),
            ],
        ],
    ];
}

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