function UpdateSemverTestBaselineTrait::testNoUpdatesAvailable

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

Tests the Update Manager module when no updates are available.

The XML fixture file 'drupal.8.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/UpdateSemverTestBaselineTrait.php, line 28

Class

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

Namespace

Drupal\Tests\update\Functional

Code

public function testNoUpdatesAvailable() : void {
  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 => "8.{$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.