function UpdateSemverTestBase::testNoUpdatesAvailable

Tests the Update Manager module when no updates are available.

The XML fixture file 'drupal.1.0.xml' which is one of the XML files this test uses also contains 2 extra releases that are newer than '8.0.1'. These releases will not show as available updates because of the following reasons:

  • '8.0.2' is an unpublished release.
  • '8.0.3' is marked as 'Release type' 'Unsupported'.

File

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

Class

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

Namespace

Drupal\Tests\update\Functional

Code

public function testNoUpdatesAvailable() {
    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 => "{$minor_version}.{$patch_version}" . $extra_version,
                ]);
                $this->standardTests();
                // The XML test fixtures for this method all contain the '8.2.0'
                // release but because '8.2.0' is not in a supported branch it will
                // not be in the available updates.
                $this->assertUpdateTableElementNotContains('8.2.0');
                $this->assertUpdateTableTextContains('Up to date');
                $this->assertUpdateTableTextNotContains('Update available');
                $this->assertUpdateTableTextNotContains('Security update required!');
                $this->assertUpdateTableElementContains('check.svg');
            }
        }
    }
}

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