You are here

public function UpdateManagerUpdateTest::incompatibleUpdatesTableProvider in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/update/tests/src/Functional/UpdateManagerUpdateTest.php \Drupal\Tests\update\Functional\UpdateManagerUpdateTest::incompatibleUpdatesTableProvider()
  2. 10 core/modules/update/tests/src/Functional/UpdateManagerUpdateTest.php \Drupal\Tests\update\Functional\UpdateManagerUpdateTest::incompatibleUpdatesTableProvider()

Provides data for test scenarios involving incompatible updates.

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

  • aaa_update_test.8.x-1.2.xml

    • 8.x-1.2 Compatible with 8.0.0 core.
  • aaa_update_test.core_compatibility.8.x-1.2_8.x-2.2.xml
    • 8.x-1.2 Requires 8.1.0 and above.
  • bbb_update_test.1_0.xml
    • 8.x-1.0 is the only available release.
  • bbb_update_test.1_1.xml
    • 8.x-1.1 is available and compatible with everything (does not define <core_compatibility> at all).
  • bbb_update_test.1_2.xml
    • 8.x-1.1 is available and compatible with everything (does not define <core_compatibility> at all).
    • 8.x-1.2 is available and requires Drupal 8.1.0 and above.

@todo In https://www.drupal.org/project/drupal/issues/3112962: Change the 'core_fixture' values here to use:

  • '1.1' instead of '1.1-core_compatibility'.
  • '1.1-alpha1' instead of '1.1-alpha1-core_compatibility'.

Delete the files:

  • core/modules/update/tests/modules/update_test/drupal.1.1-alpha1-core_compatibility.xml
  • core/modules/update/tests/modules/update_test/drupal.1.1-core_compatibility.xml

Return value

array[] Test data.

File

core/modules/update/tests/src/Functional/UpdateManagerUpdateTest.php, line 93

Class

UpdateManagerUpdateTest
Tests the Update Manager module's 'Update' form and functionality.

Namespace

Drupal\Tests\update\Functional

Code

public function incompatibleUpdatesTableProvider() {
  return [
    'only one compatible' => [
      'core_fixture' => '1.1-core_compatibility',
      // aaa_update_test.8.x-1.2.xml has core compatibility set and will test
      // the case where $recommended_release['core_compatible'] === TRUE in
      // \Drupal\update\Form\UpdateManagerUpdate.
      'a_fixture' => '8.x-1.2',
      // Use a fixture with only a 8.x-1.0 release so BBB is up to date.
      'b_fixture' => '1_0',
      'compatible' => [
        'AAA' => '8.x-1.2',
      ],
      'incompatible' => [],
    ],
    'only one incompatible' => [
      'core_fixture' => '1.1-core_compatibility',
      'a_fixture' => 'core_compatibility.8.x-1.2_8.x-2.2',
      // Use a fixture with only a 8.x-1.0 release so BBB is up to date.
      'b_fixture' => '1_0',
      'compatible' => [],
      'incompatible' => [
        'AAA' => [
          'recommended' => '8.x-1.2',
          'range' => '8.1.0 to 8.1.1',
        ],
      ],
    ],
    'two compatible, no incompatible' => [
      'core_fixture' => '1.1-core_compatibility',
      'a_fixture' => '8.x-1.2',
      // bbb_update_test.1_1.xml does not have core compatibility set and will
      // test the case where $recommended_release['core_compatible'] === NULL
      // in \Drupal\update\Form\UpdateManagerUpdate.
      'b_fixture' => '1_1',
      'compatible' => [
        'AAA' => '8.x-1.2',
        'BBB' => '8.x-1.1',
      ],
      'incompatible' => [],
    ],
    'two incompatible, no compatible' => [
      'core_fixture' => '1.1-core_compatibility',
      'a_fixture' => 'core_compatibility.8.x-1.2_8.x-2.2',
      // bbb_update_test.1_2.xml has core compatibility set and will test the
      // case where $recommended_release['core_compatible'] === FALSE in
      // \Drupal\update\Form\UpdateManagerUpdate.
      'b_fixture' => '1_2',
      'compatible' => [],
      'incompatible' => [
        'AAA' => [
          'recommended' => '8.x-1.2',
          'range' => '8.1.0 to 8.1.1',
        ],
        'BBB' => [
          'recommended' => '8.x-1.2',
          'range' => '8.1.0 to 8.1.1',
        ],
      ],
    ],
    'one compatible, one incompatible' => [
      'core_fixture' => '1.1-core_compatibility',
      'a_fixture' => 'core_compatibility.8.x-1.2_8.x-2.2',
      'b_fixture' => '1_1',
      'compatible' => [
        'BBB' => '8.x-1.1',
      ],
      'incompatible' => [
        'AAA' => [
          'recommended' => '8.x-1.2',
          'range' => '8.1.0 to 8.1.1',
        ],
      ],
    ],
  ];
}