You are here

protected function UpdateTestBase::assertVersionUpdateLinks in Drupal 10

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

File

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

Class

UpdateTestBase
Defines some shared functions used by all update tests.

Namespace

Drupal\Tests\update\Functional

Code

protected function assertVersionUpdateLinks($label, $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
    ->assertStringNotContainsString("http://example.com/{$this->updateProject}-{$version}.tar.gz", $update_element
    ->getOuterHtml());
  $this
    ->assertEquals($update_element
    ->findLink('Release notes')
    ->getAttribute('href'), "http://example.com/{$this->updateProject}-{$url_version}-release");
}