function InfoParserUnitTest::providerCoreIncompatibility

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::providerCoreIncompatibility()
  2. 8.9.x core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::providerCoreIncompatibility()
  3. 10 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::providerCoreIncompatibility()

Data provider for testCoreIncompatibility().

File

core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php, line 272

Class

InfoParserUnitTest
Tests InfoParser class and exception.

Namespace

Drupal\Tests\Core\Extension

Code

public static function providerCoreIncompatibility() {
    // Remove possible stability suffix to properly parse 11.0-dev.
    $version = preg_replace('/-dev$/', '', \Drupal::VERSION);
    [
        $major,
        $minor,
    ] = explode('.', $version, 2);
    $next_minor = $minor + 1;
    $next_major = $major + 1;
    return [
        'next_minor' => [
            'next_minor',
            "^{$major}.{$next_minor}",
            TRUE,
        ],
        'current_major_next_major' => [
            'current_major_next_major',
            "^{$major} || ^{$next_major}",
            FALSE,
        ],
        'previous_major_next_major' => [
            'previous_major_next_major',
            "^1 || ^{$next_major}",
            TRUE,
        ],
        'current_minor' => [
            'current_minor',
            "~{$major}.{$minor}",
            FALSE,
        ],
    ];
}

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