function UpdateTestBase::assertVersionUpdateLinks

Same name and namespace in other branches
  1. 11.x 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()

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

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