Skip to content
Snippets Groups Projects
Verified Commit 71f0e1de authored by Jess's avatar Jess
Browse files

Issue #3279279 by phenaproxima, dww, tedbow: Remove "Download" link from Available Updates report

parent bd43f4ae
No related branches found
No related tags found
No related merge requests found
...@@ -34,11 +34,6 @@ ...@@ -34,11 +34,6 @@
</div> </div>
<div class="layout-column layout-column--half"> <div class="layout-column layout-column--half">
<ul class="project-update__version-links"> <ul class="project-update__version-links">
{% if version.core_compatible is not defined or version.core_compatible %}
<li class="project-update__download-link">
<a href="{{ version.download_link }}">{{ 'Download'|t }}</a>
</li>
{% endif %}
<li class="project-update__release-notes-link"> <li class="project-update__release-notes-link">
<a href="{{ version.release_link }}">{{ 'Release notes'|t }}</a> <a href="{{ version.release_link }}">{{ 'Release notes'|t }}</a>
</li> </li>
......
...@@ -876,25 +876,18 @@ protected function assertCoreCompatibilityMessage(string $version, string $expec ...@@ -876,25 +876,18 @@ protected function assertCoreCompatibilityMessage(string $version, string $expec
$this->assertStringContainsString("Requires Drupal core: $expected_range", $compatibility_details->getText()); $this->assertStringContainsString("Requires Drupal core: $expected_range", $compatibility_details->getText());
$details_summary_element = $compatibility_details->find('css', 'summary'); $details_summary_element = $compatibility_details->find('css', 'summary');
if ($is_compatible) { if ($is_compatible) {
$download_version = str_replace('.', '-', $version);
// If an update is compatible with the installed version of Drupal core, // If an update is compatible with the installed version of Drupal core,
// it should have a download link and the details element should be closed // the details element should be closed by default.
// by default.
$this->assertFalse($compatibility_details->hasAttribute('open')); $this->assertFalse($compatibility_details->hasAttribute('open'));
$this->assertSame('Compatible', $details_summary_element->getText()); $this->assertSame('Compatible', $details_summary_element->getText());
$this->assertEquals(
"http://example.com/{$this->updateProject}-$download_version.tar.gz",
$update_element->findLink('Download')->getAttribute('href')
);
} }
else { else {
// If an update is not compatible with the installed version of Drupal // If an update is not compatible with the installed version of Drupal
// core, it should not have a download link and the details element should // core, the details element should be open by default.
// be open by default.
$this->assertTrue($compatibility_details->hasAttribute('open')); $this->assertTrue($compatibility_details->hasAttribute('open'));
$this->assertSame('Not compatible', $details_summary_element->getText()); $this->assertSame('Not compatible', $details_summary_element->getText());
$this->assertFalse($update_element->hasLink('Download'));
} }
$this->assertFalse($update_element->hasLink('Download'));
} }
} }
...@@ -156,7 +156,6 @@ public function testMajorUpdateAvailable() { ...@@ -156,7 +156,6 @@ public function testMajorUpdateAvailable() {
$this->standardTests(); $this->standardTests();
$this->assertUpdateTableTextNotContains('Security update required!'); $this->assertUpdateTableTextNotContains('Security update required!');
$this->assertUpdateTableElementContains(Link::fromTextAndUrl('9.0.0', Url::fromUri("http://example.com/{$this->updateProject}-9-0-0-release"))->toString()); $this->assertUpdateTableElementContains(Link::fromTextAndUrl('9.0.0', Url::fromUri("http://example.com/{$this->updateProject}-9-0-0-release"))->toString());
$this->assertUpdateTableElementContains(Link::fromTextAndUrl('Download', Url::fromUri("http://example.com/{$this->updateProject}-9-0-0.tar.gz"))->toString());
$this->assertUpdateTableElementContains(Link::fromTextAndUrl('Release notes', Url::fromUri("http://example.com/{$this->updateProject}-9-0-0-release"))->toString()); $this->assertUpdateTableElementContains(Link::fromTextAndUrl('Release notes', Url::fromUri("http://example.com/{$this->updateProject}-9-0-0-release"))->toString());
$this->assertUpdateTableTextNotContains('Up to date'); $this->assertUpdateTableTextNotContains('Up to date');
$this->assertUpdateTableTextContains('Not supported!'); $this->assertUpdateTableTextContains('Not supported!');
...@@ -425,16 +424,6 @@ public function testUnsupportedRelease() { ...@@ -425,16 +424,6 @@ public function testUnsupportedRelease() {
} }
} }
/**
* {@inheritdoc}
*/
protected function assertVersionUpdateLinks($label, $version, $download_version = NULL) {
// Test XML files for Drupal core use '-' in the version number for the
// download link.
$download_version = str_replace('.', '-', $version);
parent::assertVersionUpdateLinks($label, $version, $download_version);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -87,13 +87,15 @@ protected function standardTests() { ...@@ -87,13 +87,15 @@ protected function standardTests() {
$this->assertSession()->linkByHrefExists('http://example.com/project/drupal'); $this->assertSession()->linkByHrefExists('http://example.com/project/drupal');
$this->assertSession()->pageTextNotContains('No available releases found'); $this->assertSession()->pageTextNotContains('No available releases found');
$this->assertSession()->pageTextContains('Last checked:'); $this->assertSession()->pageTextContains('Last checked:');
// No download URLs should be present.
$this->assertSession()->responseNotContains('.tar.gz');
} }
/** /**
* Asserts the expected security updates are displayed correctly on the page. * Asserts the expected security updates are displayed correctly on the page.
* *
* @param string $project_path_part * @param string $project_path_part
* The project path part needed for the download and release links. * The project path part needed for the release link.
* @param string[] $expected_security_releases * @param string[] $expected_security_releases
* The security releases, if any, that the status report should recommend. * The security releases, if any, that the status report should recommend.
* @param string $expected_update_message_type * @param string $expected_update_message_type
...@@ -109,11 +111,7 @@ protected function assertSecurityUpdates($project_path_part, array $expected_sec ...@@ -109,11 +111,7 @@ protected function assertSecurityUpdates($project_path_part, array $expected_sec
$all_security_release_urls = array_map(function ($link) { $all_security_release_urls = array_map(function ($link) {
return $link->getAttribute('href'); return $link->getAttribute('href');
}, $page->findAll('css', "$update_element_css_locator .version-security a[href$='-release']")); }, $page->findAll('css', "$update_element_css_locator .version-security a[href$='-release']"));
$all_security_download_urls = array_map(function ($link) {
return $link->getAttribute('href');
}, $page->findAll('css', "$update_element_css_locator .version-security a[href$='.tar.gz']"));
if ($expected_security_releases) { if ($expected_security_releases) {
$expected_download_urls = [];
$expected_release_urls = []; $expected_release_urls = [];
if ($expected_update_message_type === static::SECURITY_UPDATE_REQUIRED) { if ($expected_update_message_type === static::SECURITY_UPDATE_REQUIRED) {
$assert_session->elementTextNotContains('css', $update_element_css_locator, 'Update available'); $assert_session->elementTextNotContains('css', $update_element_css_locator, 'Update available');
...@@ -129,23 +127,18 @@ protected function assertSecurityUpdates($project_path_part, array $expected_sec ...@@ -129,23 +127,18 @@ protected function assertSecurityUpdates($project_path_part, array $expected_sec
foreach ($expected_security_releases as $expected_security_release) { foreach ($expected_security_releases as $expected_security_release) {
$expected_url_version = str_replace('.', '-', $expected_security_release); $expected_url_version = str_replace('.', '-', $expected_security_release);
$release_url = "http://example.com/$project_path_part-$expected_url_version-release"; $release_url = "http://example.com/$project_path_part-$expected_url_version-release";
$download_url = "http://example.com/$project_path_part-$expected_url_version.tar.gz"; $assert_session->responseNotContains("http://example.com/$project_path_part-$expected_url_version.tar.gz");
$expected_release_urls[] = $release_url; $expected_release_urls[] = $release_url;
$expected_download_urls[] = $download_url;
// Ensure the expected links are security links. // Ensure the expected links are security links.
$this->assertContains($release_url, $all_security_release_urls, "Release $release_url is a security release link."); $this->assertContains($release_url, $all_security_release_urls, "Release $release_url is a security release link.");
$this->assertContains($download_url, $all_security_download_urls, "Release $download_url is a security download link.");
$assert_session->linkByHrefExists($release_url); $assert_session->linkByHrefExists($release_url);
$assert_session->linkByHrefExists($download_url);
} }
// Ensure no other links are shown as security releases. // Ensure no other links are shown as security releases.
$this->assertEquals([], array_diff($all_security_release_urls, $expected_release_urls)); $this->assertEquals([], array_diff($all_security_release_urls, $expected_release_urls));
$this->assertEquals([], array_diff($all_security_download_urls, $expected_download_urls));
} }
else { else {
// Ensure there were no security links. // Ensure there were no security links.
$this->assertEquals([], $all_security_release_urls); $this->assertEquals([], $all_security_release_urls);
$this->assertEquals([], $all_security_download_urls);
$assert_session->pageTextNotContains('Security update required!'); $assert_session->pageTextNotContains('Security update required!');
if ($expected_update_message_type === static::UPDATE_AVAILABLE) { if ($expected_update_message_type === static::UPDATE_AVAILABLE) {
$assert_session->elementTextContains('css', $update_element_css_locator, 'Update available'); $assert_session->elementTextContains('css', $update_element_css_locator, 'Update available');
...@@ -168,18 +161,14 @@ protected function assertSecurityUpdates($project_path_part, array $expected_sec ...@@ -168,18 +161,14 @@ protected function assertSecurityUpdates($project_path_part, array $expected_sec
* The label for the update. * The label for the update.
* @param string $version * @param string $version
* The project version. * The project version.
* @param 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.
*/ */
protected function assertVersionUpdateLinks($label, $version, $download_version = NULL) { protected function assertVersionUpdateLinks($label, $version) {
$download_version = $download_version ?? $version;
$update_element = $this->findUpdateElementByLabel($label); $update_element = $this->findUpdateElementByLabel($label);
// In the release notes URL the periods are replaced with dashes. // In the release notes URL the periods are replaced with dashes.
$url_version = str_replace('.', '-', $version); $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($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->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"); $this->assertEquals($update_element->findLink('Release notes')->getAttribute('href'), "http://example.com/{$this->updateProject}-$url_version-release");
} }
......
...@@ -32,11 +32,6 @@ ...@@ -32,11 +32,6 @@
</div> </div>
<div class="layout-column layout-column--half"> <div class="layout-column layout-column--half">
<ul class="project-update__version-links"> <ul class="project-update__version-links">
{% if version.core_compatible is not defined or version.core_compatible %}
<li class="project-update__download-link">
<a href="{{ version.download_link }}">{{ 'Download'|t }}</a>
</li>
{% endif %}
<li class="project-update__release-notes-link"> <li class="project-update__release-notes-link">
<a href="{{ version.release_link }}">{{ 'Release notes'|t }}</a> <a href="{{ version.release_link }}">{{ 'Release notes'|t }}</a>
</li> </li>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment