function UpdateCoreTest::testMajorUpdateAvailable

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

File

core/modules/update/tests/src/Functional/UpdateCoreTest.php, line 170

Class

UpdateCoreTest
Tests the Update Manager module through a series of functional tests using mock XML data.

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->setSystemInfo("8.{$minor_version}.{$patch_version}" . $extra_version);
                $this->refreshUpdateStatus([
                    'drupal' => '9',
                ]);
                $this->standardTests();
                $this->drupalGet('admin/reports/updates');
                $this->clickLink(t('Check manually'));
                $this->checkForMetaRefresh();
                $this->assertNoText(t('Security update required!'));
                $this->assertRaw(Link::fromTextAndUrl('9.0.0', Url::fromUri("http://example.com/drupal-9-0-0-release"))->toString(), 'Link to release appears.');
                $this->assertRaw(Link::fromTextAndUrl(t('Download'), Url::fromUri("http://example.com/drupal-9-0-0.tar.gz"))->toString(), 'Link to download appears.');
                $this->assertRaw(Link::fromTextAndUrl(t('Release notes'), Url::fromUri("http://example.com/drupal-9-0-0-release"))->toString(), 'Link to release notes appears.');
                $this->assertNoText(t('Up to date'));
                $this->assertText(t('Not supported!'));
                $this->assertText(t('Recommended version:'));
                $this->assertNoText(t('Latest version:'));
                $this->assertRaw('error.svg', 'Error icon was found.');
            }
        }
    }
}

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