diff --git a/core/modules/update/templates/update-version.html.twig b/core/modules/update/templates/update-version.html.twig index b9fba5eaab..5ca4ce46dd 100644 --- a/core/modules/update/templates/update-version.html.twig +++ b/core/modules/update/templates/update-version.html.twig @@ -36,7 +36,10 @@ {% if version.core_compatibility_message %}
  • -
    +
    + + {% if version.core_compatible %}{{ 'Compatible'|t }}{% else %}{{ 'Incompatible'|t }}{% endif %} + {{ version.core_compatibility_message }}
  • diff --git a/core/modules/update/tests/modules/update_test/aaa_update_test.sec.8.x-1.2_8.x-2.2.xml b/core/modules/update/tests/modules/update_test/aaa_update_test.core_compatibility.8.x-1.2_8.x-2.2.xml similarity index 96% copy from core/modules/update/tests/modules/update_test/aaa_update_test.sec.8.x-1.2_8.x-2.2.xml copy to core/modules/update/tests/modules/update_test/aaa_update_test.core_compatibility.8.x-1.2_8.x-2.2.xml index 038e55e455..1d4fd3a07a 100644 --- a/core/modules/update/tests/modules/update_test/aaa_update_test.sec.8.x-1.2_8.x-2.2.xml +++ b/core/modules/update/tests/modules/update_test/aaa_update_test.core_compatibility.8.x-1.2_8.x-2.2.xml @@ -47,7 +47,7 @@ aaa_update_test 8.x-2.2 8.x-2.2 - DRUPAL-8--2-2 + 8.x-2.2 ^8.1.1 published http://example.com/aaa_update_test-8-x-2-2-release @@ -62,7 +62,7 @@ aaa_update_test 8.x-2.1 8.x-2.1 - DRUPAL-8--2-1 + 8.x-2.2 published http://example.com/aaa_update_test-8-x-2-1-release http://example.com/aaa_update_test-8-x-2-1.tar.gz @@ -77,7 +77,7 @@ aaa_update_test 8.x-2.0 8.x-2.0 - DRUPAL-8--2-0 + 8.x-2.2 published http://example.com/aaa_update_test-8-x-2-0-release http://example.com/aaa_update_test-8-x-2-0.tar.gz @@ -91,7 +91,7 @@ aaa_update_test 8.x-1.2 8.x-1.2 - DRUPAL-8--1-2 + 8.x-2.2 ^8.1.0 published http://example.com/aaa_update_test-8-x-1-2-release @@ -106,7 +106,7 @@ aaa_update_test 8.x-1.1 8.x-1.1 - DRUPAL-8--1-1 + 8.x-2.2 published http://example.com/aaa_update_test-8-x-1-1-release http://example.com/aaa_update_test-8-x-1-1.tar.gz @@ -120,7 +120,7 @@ aaa_update_test 8.x-1.0 8.x-1.0 - DRUPAL-8--1-0 + 8.x-2.2 published http://example.com/aaa_update_test-8-x-1-0-release http://example.com/aaa_update_test-8-x-1-0.tar.gz diff --git a/core/modules/update/tests/modules/update_test/aaa_update_test.sec.8.x-1.2_8.x-2.2.xml b/core/modules/update/tests/modules/update_test/aaa_update_test.sec.8.x-1.2_8.x-2.2.xml index 038e55e455..a820b29ac7 100644 --- a/core/modules/update/tests/modules/update_test/aaa_update_test.sec.8.x-1.2_8.x-2.2.xml +++ b/core/modules/update/tests/modules/update_test/aaa_update_test.sec.8.x-1.2_8.x-2.2.xml @@ -30,7 +30,6 @@ aaa_update_test 8.x-3.0-beta1 8.x-3.0-beta1 8.x-3.0-beta1 - ^8.1.1 published http://example.com/aaa_update_test-8-x-3-0-beta1 http://example.com/aaa_update_test--8-x-3-0-beta1.tar.gz @@ -48,7 +47,6 @@ aaa_update_test 8.x-2.2 8.x-2.2 DRUPAL-8--2-2 - ^8.1.1 published http://example.com/aaa_update_test-8-x-2-2-release http://example.com/aaa_update_test-8-x-2-2.tar.gz @@ -92,7 +90,6 @@ aaa_update_test 8.x-1.2 8.x-1.2 DRUPAL-8--1-2 - ^8.1.0 published http://example.com/aaa_update_test-8-x-1-2-release http://example.com/aaa_update_test-8-x-1-2.tar.gz diff --git a/core/modules/update/tests/src/Functional/UpdateContribTest.php b/core/modules/update/tests/src/Functional/UpdateContribTest.php index 5e1a1025d6..7e47fa165f 100644 --- a/core/modules/update/tests/src/Functional/UpdateContribTest.php +++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php @@ -578,9 +578,9 @@ public function testCoreCompatibilityMessage() { // Confirm that messages are displayed for security and 'Also available' // updates. - $this->refreshUpdateStatus(['drupal' => '1.1', 'aaa_update_test' => 'sec.8.x-1.2_8.x-2.2']); - $this->assertCoreCompatibilityMessage('8.x-1.2', '8.1.0 to 8.1.1', 'Security update:'); - $this->assertCoreCompatibilityMessage('8.x-2.2', '8.1.1', 'Also available:'); + $this->refreshUpdateStatus(['drupal' => '1.1', 'aaa_update_test' => 'core_compatibility.8.x-1.2_8.x-2.2']); + $this->assertCoreCompatibilityMessage('8.x-1.2', '8.1.0 to 8.1.1', 'Security update:', FALSE); + $this->assertCoreCompatibilityMessage('8.x-2.2', '8.1.1', 'Also available:', FALSE); } /** @@ -718,14 +718,34 @@ public function securityUpdateAvailabilityProvider() { * The expected core compatibility range. * @param string $expected_release_title * The expected release title. + * @param bool $is_compatible + * If the update is compatible with the installed version of Drupal. */ - protected function assertCoreCompatibilityMessage($version, $expected_compatibility_range, $expected_release_title) { + protected function assertCoreCompatibilityMessage($version, $expected_compatibility_range, $expected_release_title, $is_compatible = TRUE) { $link = $this->getSession()->getPage()->findLink($version); $update_info_element = $link->getParent(); - $update_compatibility_details_element = $update_info_element->getParent()->find('css', '.project-update__compatibility-details'); + $update_compatibility_details_element = $update_info_element->getParent()->find('css', '.project-update__compatibility-details details'); $this->assertContains("Requires Drupal core: $expected_compatibility_range", $update_compatibility_details_element->getText()); $update_title_element = $update_info_element->getParent()->find('css', '.project-update__version-title'); $this->assertSame($expected_release_title, $update_title_element->getText()); + $details_summary_element = $update_compatibility_details_element->find('css', 'summary'); + if ($is_compatible) { + $download_version = str_replace('.', '-', $version); + // If an update is compatible with the installed version of Drupal + // core it should have a download link and the details element + // should not be open by default. + $this->assertFalse($update_compatibility_details_element->hasAttribute('open')); + $this->assertSame('Compatible', $details_summary_element->getText()); + $this->assertEquals($update_info_element->getParent()->findLink('Download')->getAttribute('href'), "http://example.com/{$this->updateProject}-$download_version.tar.gz"); + } + else { + // 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 be open by default. + $this->assertTrue($update_compatibility_details_element->hasAttribute('open')); + $this->assertSame('Incompatible', $details_summary_element->getText()); + $this->assertFalse($update_info_element->getParent()->hasLink('Download')); + } } } diff --git a/core/themes/claro/templates/admin/update-version.html.twig b/core/themes/claro/templates/admin/update-version.html.twig index 250c7b110d..250305e310 100644 --- a/core/themes/claro/templates/admin/update-version.html.twig +++ b/core/themes/claro/templates/admin/update-version.html.twig @@ -34,7 +34,10 @@ {% if version.core_compatibility_message %}
  • -
    +
    + + {% if version.core_compatible %}{{ 'Compatible'|t }}{% else %}{{ 'Incompatible'|t }}{% endif %} + {{ version.core_compatibility_message }}
  • diff --git a/core/themes/stable/templates/admin/update-version.html.twig b/core/themes/stable/templates/admin/update-version.html.twig index 38c386e1cc..f9f1ff8811 100644 --- a/core/themes/stable/templates/admin/update-version.html.twig +++ b/core/themes/stable/templates/admin/update-version.html.twig @@ -34,7 +34,10 @@ {% if version.core_compatibility_message %}
  • -
    +
    + + {% if version.core_compatible %}{{ 'Compatible'|t }}{% else %}{{ 'Incompatible'|t }}{% endif %} + {{ version.core_compatibility_message }}