function UpdateSemverTestBaselineTrait::testUnsupportedRelease

Same name in other branches
  1. 10 core/modules/update/tests/src/Functional/UpdateSemverTestBaselineTrait.php \Drupal\Tests\update\Functional\UpdateSemverTestBaselineTrait::testUnsupportedRelease()

Tests messages when a project release is marked unsupported.

This test confirms unsupported messages are displayed regardless of whether the installed version is in a supported branch or not. This test relies on 2 test XML fixtures that are identical except for the 'supported_branches' value:

  • [::$updateProject].8.1.0.xml 'supported_branches' is '8.0.,8.1.'.
  • [::$updateProject].8.1.0-supported.xml 'supported_branches' is '8.1.,9.0.,10.0.'
  • [::$updateProject].8.1.0-unsupported.xml 'supported_branches' is '8.0.'.
  • [::$updateProject].8.1.0-unsupported.xml 'supported_branches' is '8.1.'.

They both have an '8.0.3' release that has the 'Release type' value of 'unsupported' and an '8.1.0' release that has the 'Release type' value of 'supported' and is the expected update.

File

core/modules/update/tests/src/Functional/UpdateSemverTestBaselineTrait.php, line 263

Class

UpdateSemverTestBaselineTrait
Provides test methods for semver tests shared between core and contrib.

Namespace

Drupal\Tests\update\Functional

Code

public function testUnsupportedRelease() : void {
    foreach ([
        '8.1.0',
        '8.1.0-unsupported',
    ] as $fixture) {
        $this->setProjectInstalledVersion('8.0.3');
        $this->refreshUpdateStatus([
            $this->updateProject => $fixture,
        ]);
        $this->standardTests();
        $this->confirmUnsupportedStatus('8.0.3', '8.1.0', 'Recommended version:');
    }
    // Test when the newest branch is unsupported and no update is available.
    foreach ([
        '8.1.0',
        '8.1.0-beta1',
    ] as $version) {
        $this->setProjectInstalledVersion($version);
        $this->refreshUpdateStatus([
            $this->updateProject => '1.1-unsupported',
        ]);
        $this->standardTests();
        $this->confirmUnsupportedStatus($version);
    }
    // Test when the newest branch is supported.
    $this->setProjectInstalledVersion('8.0.3');
    $this->refreshUpdateStatus([
        $this->updateProject => '1.0-supported',
    ]);
    $this->standardTests();
    $this->confirmUnsupportedStatus('8.0.3', '8.1.0', 'Recommended version:');
    $this->assertVersionUpdateLinks('Also available', '10.0.0');
    $this->assertVersionUpdateLinks('Also available', '9.0.0', 1);
}

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