function UpdateContribTest::testCoreCompatibilityMessage

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

Tests that core compatibility messages are displayed.

File

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

Class

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

Namespace

Drupal\Tests\update\Functional

Code

public function testCoreCompatibilityMessage() : void {
    $this->mockInstalledExtensionsInfo([
        'aaa_update_test' => [
            'project' => 'aaa_update_test',
            'version' => '8.x-1.0',
            'hidden' => FALSE,
        ],
    ]);
    $this->mockDefaultExtensionsInfo([
        'version' => '8.0.0',
    ]);
    $this->refreshUpdateStatus([
        'drupal' => '8.1.1',
        'aaa_update_test' => '8.x-1.2',
    ]);
    $this->assertCoreCompatibilityMessage('8.x-1.2', '8.0.0 to 8.1.1', 'Recommended version:');
    $this->assertCoreCompatibilityMessage('8.x-1.3-beta1', '8.0.0, 8.1.1', 'Latest version:');
    // Run the same check as above but with a Drupal core XML test fixture
    // without '8.1.' in 'supported_branches'. Confirm that messages do not
    // include releases from the '8.1.' branch.
    $this->refreshUpdateStatus([
        'drupal' => '8.1.1-core_compatibility',
        'aaa_update_test' => '8.x-1.2',
    ]);
    $this->assertCoreCompatibilityMessage('8.x-1.2', '8.0.0 to 8.0.1', 'Recommended version:');
    $this->assertCoreCompatibilityMessage('8.x-1.3-beta1', '8.0.0', 'Latest version:');
    // Change the available core releases and confirm that the messages change.
    $this->refreshUpdateStatus([
        'drupal' => '8.1.1-alpha1',
        'aaa_update_test' => '8.x-1.2',
    ]);
    $this->assertCoreCompatibilityMessage('8.x-1.2', '8.0.0 to 8.1.0', 'Recommended version:');
    $this->assertCoreCompatibilityMessage('8.x-1.3-beta1', '8.0.0', 'Latest version:');
    // Confirm that messages are displayed for security and 'Also available'
    // updates.
    $this->refreshUpdateStatus([
        'drupal' => '8.1.1',
        'aaa_update_test' => 'core_compatibility.8.x-1.2_8.x-2.2',
    ]);
    $this->assertCoreCompatibilityMessage('8.x-1.2', '8.1.0 to 8.1.1', 'Security update:', FALSE);
    $this->assertCoreCompatibilityMessage('8.x-2.2', '8.1.1', 'Also available:', FALSE);
}

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