findUpdateElementByLabel example


  protected function assertCoreCompatibilityMessage(string $version, string $expected_range, string $expected_release_title, bool $is_compatible = TRUE): void {
    $update_element = $this->findUpdateElementByLabel($expected_release_title);
    $this->assertTrue($update_element->hasLink($version));
    $compatibility_details = $update_element->find('css', '.project-update__compatibility-details details');
    $this->assertStringContainsString("Requires Drupal core: $expected_range", $compatibility_details->getText());
    $details_summary_element = $compatibility_details->find('css', 'summary');
    if ($is_compatible) {
      // If an update is compatible with the installed version of Drupal core,       // the details element should be closed by default.       $this->assertFalse($compatibility_details->hasAttribute('open'));
      $this->assertSame('Compatible', $details_summary_element->getText());
    }
    else {
      


  /** * Asserts that an update version has the correct links. * * @param string $label * The label for the update. * @param string $version * The project version. */
  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");
  }

  /** * Confirms messages are correct when a release has been unpublished/revoked. * * @param string $revoked_version * The revoked version that is currently installed. * @param string $newer_version * The expected newer version to recommend. * @param string $new_version_label * The expected label for the newer version (for example 'Recommended * version:' or 'Also available:'). */
Home | Imprint | This part of the site doesn't use cookies.