function UpdateTestBase::assertVersionUpdateLinks

Same name in other branches
  1. 9 core/modules/update/tests/src/Functional/UpdateTestBase.php \Drupal\Tests\update\Functional\UpdateTestBase::assertVersionUpdateLinks()
  2. 10 core/modules/update/tests/src/Functional/UpdateTestBase.php \Drupal\Tests\update\Functional\UpdateTestBase::assertVersionUpdateLinks()
  3. 11.x 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.

4 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.
UpdateCoreTest::assertVersionUpdateLinks in core/modules/update/tests/src/Functional/UpdateCoreTest.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()
UpdateCoreTest::assertVersionUpdateLinks in core/modules/update/tests/src/Functional/UpdateCoreTest.php
Asserts that an update version has the correct links.

File

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

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

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