function UpdateContribTest::securityUpdateAvailabilityProvider

Same name in other branches
  1. 9 core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::securityUpdateAvailabilityProvider()
  2. 8.9.x core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::securityUpdateAvailabilityProvider()
  3. 10 core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::securityUpdateAvailabilityProvider()

Data provider method for testSecurityUpdateAvailability().

These test cases rely on the following fixtures containing the following releases:

  • aaa_update_test.sec.8.x-1.2.xml

    • 8.x-1.2 Security update
    • 8.x-1.1 Insecure
    • 8.x-1.0 Insecure
  • aaa_update_test.sec.8.x-1.1_8.x-1.2.xml
    • 8.x-1.2 Security update
    • 8.x-1.1 Security update, Insecure
    • 8.x-1.0 Insecure
  • aaa_update_test.sec.8.x-1.2_8.x-2.2.xml
    • 8.x-3.0-beta2
    • 8.x-3.0-beta1 Insecure
    • 8.x-2.2 Security update
    • 8.x-2.1 Security update, Insecure
    • 8.x-2.0 Insecure
    • 8.x-1.2 Security update
    • 8.x-1.1 Insecure
    • 8.x-1.0 Insecure
  • aaa_update_test.sec.8.x-2.2_1.x_secure.xml
    • 8.x-2.2 Security update
    • 8.x-2.1 Security update, Insecure
    • 8.x-2.0 Insecure
    • 8.x-1.2
    • 8.x-1.1
    • 8.x-1.0
1 call to UpdateContribTest::securityUpdateAvailabilityProvider()
UpdateContribTest::testSecurityUpdateAvailability in core/modules/update/tests/src/Functional/UpdateContribTest.php
Tests update status of security releases.

File

core/modules/update/tests/src/Functional/UpdateContribTest.php, line 650

Class

UpdateContribTest
Tests how the Update Manager handles contributed modules and themes.

Namespace

Drupal\Tests\update\Functional

Code

public static function securityUpdateAvailabilityProvider() {
    return [
        // Security releases available for module major release 1.
        // No releases for next major.
'8.x-1.0, 8.x-1.2' => [
            'module_version' => '8.x-1.0',
            'expected_security_releases' => [
                '8.x-1.2',
            ],
            'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
            'fixture' => 'sec.8.x-1.2',
        ],
        // Two security releases available for module major release 1.
        // 8.x-1.1 security release marked as insecure.
        // No releases for next major.
'8.x-1.0, 8.x-1.1 8.x-1.2' => [
            'module_version' => '8.x-1.0',
            'expected_security_releases' => [
                '8.x-1.2',
            ],
            'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
            'fixture' => 'sec.8.x-1.1_8.x-1.2',
        ],
        // Security release available for module major release 2.
        // No releases for next major.
'8.x-2.0, 8.x-2.2' => [
            'module_version' => '8.x-2.0',
            'expected_security_releases' => [
                '8.x-2.2',
            ],
            'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
            'fixture' => 'sec.8.x-2.2_1.x_secure',
        ],
        '8.x-2.2, 8.x-1.2 8.x-2.2' => [
            'module_version' => '8.x-2.2',
            'expected_security_releases' => [],
            'expected_update_message_type' => static::UPDATE_NONE,
            'fixture' => 'sec.8.x-1.2_8.x-2.2',
        ],
        // Security release available for module major release 1.
        // Security release also available for next major.
'8.x-1.0, 8.x-1.2 8.x-2.2' => [
            'module_version' => '8.x-1.0',
            'expected_security_releases' => [
                '8.x-1.2',
            ],
            'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
            'fixture' => 'sec.8.x-1.2_8.x-2.2',
        ],
        // No security release available for module major release 1 but 1.x
        // releases are not marked as insecure.
        // Security release available for next major.
'8.x-1.0, 8.x-2.2, not insecure' => [
            'module_version' => '8.x-1.0',
            'expected_security_releases' => [],
            'expected_update_message_type' => static::UPDATE_AVAILABLE,
            'fixture' => 'sec.8.x-2.2_1.x_secure',
        ],
        // On latest security release for module major release 1.
        // Security release also available for next major.
'8.x-1.2, 8.x-1.2 8.x-2.2' => [
            'module_version' => '8.x-1.2',
            'expected_security_releases' => [],
            'expected_update_message_type' => static::UPDATE_NONE,
            'fixture' => 'sec.8.x-1.2_8.x-2.2',
        ],
        '8.x-2.0, 8.x-1.2 8.x-2.2' => [
            'module_version' => '8.x-2.0',
            'expected_security_releases' => [
                '8.x-2.2',
            ],
            'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
            'fixture' => 'sec.8.x-1.2_8.x-2.2',
        ],
    ];
}

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