You are here

public function UpdateSemverTestBase::testMajorUpdateAvailable in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/update/tests/src/Functional/UpdateSemverTestBase.php \Drupal\Tests\update\Functional\UpdateSemverTestBase::testMajorUpdateAvailable()

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

File

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

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');
      }
    }
  }
}