function UpdateSemverTestBaselineTrait::testMajorExtraUpdateAvailable

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

Tests when the major+1 is supported but not stable.

This tests when the next major has stable supported releases and the the major after that has just an alpha and beta release.

This tests when the latest major has an alpha and beta release.

  • drupal-10.0.0-11.0.0 and semver_test.9.0.0-10.0.0: This declares two major releases supported and the latest major only has unstable releases.

File

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

Class

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

Namespace

Drupal\Tests\update\Functional

Code

public function testMajorExtraUpdateAvailable() : void {
    foreach ([
        '9.0.0-10.0.0',
    ] as $release_history) {
        foreach ([
            0,
            1,
        ] as $minor_version) {
            foreach ([
                0,
                1,
            ] as $patch_version) {
                foreach ([
                    '-alpha1',
                    '-beta1',
                    '',
                ] as $extra_version) {
                    $installed_version = "8.{$minor_version}.{$patch_version}{$extra_version}";
                    $this->setProjectInstalledVersion($installed_version);
                    $this->refreshUpdateStatus([
                        $this->updateProject => $release_history,
                    ]);
                    $this->standardTests();
                    $this->drupalGet('admin/reports/updates');
                    $this->clickLink('Check manually');
                    $this->checkForMetaRefresh();
                    $this->assertUpdateTableTextNotContains('Security update required!');
                    $this->assertUpdateTableElementContains((string) Link::fromTextAndUrl('9.2.2', Url::fromUri("http://example.com/{$this->updateProject}-9-2-2-release"))
                        ->toString());
                    $this->assertUpdateTableElementContains((string) Link::fromTextAndUrl('Release notes', Url::fromUri("http://example.com/{$this->updateProject}-9-2-2-release"))
                        ->toString());
                    $this->assertUpdateTableElementContains((string) Link::fromTextAndUrl('10.0.0-beta1', Url::fromUri("http://example.com/{$this->updateProject}-10-0-0-beta1-release"))
                        ->toString());
                    $this->assertUpdateTableElementContains((string) Link::fromTextAndUrl('Release notes', Url::fromUri("http://example.com/{$this->updateProject}-10-0-0-beta1-release"))
                        ->toString());
                    $this->assertUpdateTableTextNotContains('Latest version:');
                    $this->assertUpdateTableTextNotContains('Up to date');
                    $this->assertUpdateTableTextContains('Not supported!');
                    $this->assertVersionUpdateLinks('Recommended version:', '9.2.2');
                    $this->assertUpdateTableElementContains('error.svg');
                }
            }
        }
    }
}

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