function UpdateSemverTestBase::testMajorUpdateAvailable

Tests the Update Manager module when a major update is available.

File

core/modules/update/tests/src/Functional/UpdateSemverTestBase.php, line 153

Class

UpdateSemverTestBase
Common test methods for projects that use semver version releases.

Namespace

Drupal\Tests\update\Functional

Code

public function testMajorUpdateAvailable() {
    foreach ([
        0,
        1,
    ] as $minor_version) {
        foreach ([
            0,
            1,
        ] as $patch_version) {
            foreach ([
                '-alpha1',
                '-beta1',
                '',
            ] as $extra_version) {
                $this->setProjectInstalledVersion("8.{$minor_version}.{$patch_version}" . $extra_version);
                $this->refreshUpdateStatus([
                    $this->updateProject => '9',
                ]);
                $this->standardTests();
                $this->assertUpdateTableTextNotContains('Security update required!');
                $this->assertUpdateTableElementContains(Link::fromTextAndUrl('9.0.0', Url::fromUri("http://example.com/{$this->updateProject}-9-0-0-release"))
                    ->toString());
                $this->assertUpdateTableElementContains(Link::fromTextAndUrl('Release notes', Url::fromUri("http://example.com/{$this->updateProject}-9-0-0-release"))
                    ->toString());
                $this->assertUpdateTableTextNotContains('Up to date');
                $this->assertUpdateTableTextContains('Not supported!');
                $this->assertUpdateTableTextContains('Recommended version:');
                $this->assertUpdateTableTextNotContains('Latest version:');
                $this->assertUpdateTableElementContains('error.svg');
            }
        }
    }
}

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