You are here

protected function UpdateTestBase::assertVersionUpdateLinks in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/update/tests/src/Functional/UpdateTestBase.php \Drupal\Tests\update\Functional\UpdateTestBase::assertVersionUpdateLinks()

Asserts that an update version has the correct links.

Parameters

string $label: The label for the update.

string $version: The project version.

string|null $download_version: (optional) The version number as it appears in the download link. If $download_version is not provided then $version will be used.

5 calls to UpdateTestBase::assertVersionUpdateLinks()
UpdateContribTest::testNormalUpdateAvailable in core/modules/update/tests/src/Functional/UpdateContribTest.php
Tests the Update Manager module when one normal update is available.
UpdateContribTest::testUpdateBaseThemeSecurityUpdate in core/modules/update/tests/src/Functional/UpdateContribTest.php
Tests that subthemes are notified about security updates for base themes.
UpdateSemverTestBase::assertVersionUpdateLinks in core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
Asserts that an update version has the correct links.
UpdateTestBase::confirmRevokedStatus in core/modules/update/tests/src/Functional/UpdateTestBase.php
Confirms messages are correct when a release has been unpublished/revoked.
UpdateTestBase::confirmUnsupportedStatus in core/modules/update/tests/src/Functional/UpdateTestBase.php
Confirms messages are correct when a release has been marked unsupported.
1 method overrides UpdateTestBase::assertVersionUpdateLinks()
UpdateSemverTestBase::assertVersionUpdateLinks in core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
Asserts that an update version has the correct links.

File

core/modules/update/tests/src/Functional/UpdateTestBase.php, line 199

Class

UpdateTestBase
Defines some shared functions used by all update tests.

Namespace

Drupal\Tests\update\Functional

Code

protected function assertVersionUpdateLinks($label, $version, $download_version = NULL) {
  $download_version = $download_version ?? $version;
  $update_element = $this
    ->findUpdateElementByLabel($label);

  // In the release notes URL the periods are replaced with dashes.
  $url_version = str_replace('.', '-', $version);
  $this
    ->assertEquals($update_element
    ->findLink($version)
    ->getAttribute('href'), "http://example.com/{$this->updateProject}-{$url_version}-release");
  $this
    ->assertEquals($update_element
    ->findLink('Download')
    ->getAttribute('href'), "http://example.com/{$this->updateProject}-{$download_version}.tar.gz");
  $this
    ->assertEquals($update_element
    ->findLink('Release notes')
    ->getAttribute('href'), "http://example.com/{$this->updateProject}-{$url_version}-release");
}