diff --git a/core/modules/update/tests/modules/update_test/aaa_update_test.1_0-supported.xml b/core/modules/update/tests/modules/update_test/aaa_update_test.1_0-supported.xml new file mode 100644 index 0000000000..643630aa38 --- /dev/null +++ b/core/modules/update/tests/modules/update_test/aaa_update_test.1_0-supported.xml @@ -0,0 +1,75 @@ + + +AAA Update test +aaa_update_test +Drupal +8.x-1.,8.x-2. +published +http://example.com/project/aaa_update_test + + ProjectsModules + + + + aaa_update_test 8.x-2.0 + 8.x-2.0 + published + http://example.com/aaa_update_test-8-x-2-0-release + http://example.com/aaa_update_test-8.x-2.0.tar.gz + 1250422521 + + Release typeNew features + Release typeBug fixes + + + + aaa_update_test 8.x-2.0-beta1 + 8.x-2.0-beta1 + published + http://example.com/aaa_update_test-8-x-2-0-beta1-release + http://example.com/aaa_update_test-8.x-2.0-beta1.tar.gz + 1250422521 + + Release typeNew features + Release typeBug fixes + + + + aaa_update_test 8.x-2.0-alpha1 + 8.x-2.0-alpha1 + published + http://example.com/aaa_update_test-8-x-2-0-alpha1-release + http://example.com/aaa_update_test-8.x-2.0-alpha1.tar.gz + 1250422521 + + Release typeNew features + Release typeBug fixes + + + + aaa_update_test 8.x-1.1 + 8.x-1.1 + published + http://example.com/aaa_update_test-8-x-1-1-release + http://example.com/aaa_update_test-8.x-1.1.tar.gz + 1250404525 + + Release typeNew features + Release typeBug fixes + Release typeUnsupported + + + + aaa_update_test 8.x-1.0 + 8.x-1.0 + unpublished + http://example.com/aaa_update_test-8-x-1-0-release + http://example.com/aaa_update_test-8.x-1.0.tar.gz + 1250404521 + + Release typeNew features + Release typeBug fixes + + + + diff --git a/core/modules/update/tests/modules/update_test/aaa_update_test.1_0-unsupported.xml b/core/modules/update/tests/modules/update_test/aaa_update_test.1_0-unsupported.xml new file mode 100644 index 0000000000..a8553a4067 --- /dev/null +++ b/core/modules/update/tests/modules/update_test/aaa_update_test.1_0-unsupported.xml @@ -0,0 +1,75 @@ + + +AAA Update test +aaa_update_test +Drupal +8.x-2. +published +http://example.com/project/aaa_update_test + + ProjectsModules + + + + aaa_update_test 8.x-2.0 + 8.x-2.0 + published + http://example.com/aaa_update_test-8-x-2-0-release + http://example.com/aaa_update_test-8.x-2.0.tar.gz + 1250422521 + + Release typeNew features + Release typeBug fixes + + + + aaa_update_test 8.x-2.0-beta1 + 8.x-2.0-beta1 + published + http://example.com/aaa_update_test-8-x-2-0-beta1-release + http://example.com/aaa_update_test-8.x-2.0-beta1.tar.gz + 1250422521 + + Release typeNew features + Release typeBug fixes + + + + aaa_update_test 8.x-2.0-alpha1 + 8.x-2.0-alpha1 + published + http://example.com/aaa_update_test-8-x-2-0-alpha1-release + http://example.com/aaa_update_test-8.x-2.0-alpha1.tar.gz + 1250422521 + + Release typeNew features + Release typeBug fixes + + + + aaa_update_test 8.x-1.1 + 8.x-1.1 + published + http://example.com/aaa_update_test-8-x-1-1-release + http://example.com/aaa_update_test-8.x-1.1.tar.gz + 1250404525 + + Release typeNew features + Release typeBug fixes + Release typeUnsupported + + + + aaa_update_test 8.x-1.0 + 8.x-1.0 + unpublished + http://example.com/aaa_update_test-8-x-1-0-release + http://example.com/aaa_update_test-8.x-1.0.tar.gz + 1250404521 + + Release typeNew features + Release typeBug fixes + + + + diff --git a/core/modules/update/tests/modules/update_test/drupal.1.0.xml b/core/modules/update/tests/modules/update_test/drupal.1.0-unsupported.xml similarity index 81% copy from core/modules/update/tests/modules/update_test/drupal.1.0.xml copy to core/modules/update/tests/modules/update_test/drupal.1.0-unsupported.xml index bba5cb97e1..63cf66e7f8 100644 --- a/core/modules/update/tests/modules/update_test/drupal.1.0.xml +++ b/core/modules/update/tests/modules/update_test/drupal.1.0-unsupported.xml @@ -3,7 +3,7 @@ Drupal drupal Drupal -8.0.,8.1. +8.1 published http://example.com/project/drupal @@ -13,7 +13,6 @@ Drupal 8.1.0 8.1.0 - DRUPAL-8-1-0 published http://example.com/drupal-8-1-0-release http://example.com/drupal-8-1-0.tar.gz @@ -26,7 +25,6 @@ Drupal 8.1.0-beta1 8.1.0-beta1 - DRUPAL-8-1-0-beta1 published http://example.com/drupal-8-1-0-beta1-release http://example.com/drupal-8-1-0-beta1.tar.gz @@ -39,7 +37,6 @@ Drupal 8.1.0-alpha1 8.1.0-alpha1 - DRUPAL-8-0-1-alpha1 published http://example.com/drupal-8-1-0-alpha1-release http://example.com/drupal-8-1-0-alpha1.tar.gz @@ -49,10 +46,34 @@ Release typeBug fixes + + Drupal 8.0.3 + 8.0.3 + published + http://example.com/drupal-8-0-3-release + http://example.com/drupal-8-0-3.tar.gz + 1250424585 + + Release typeNew features + Release typeBug fixes + Release typeUnsupported + + + + Drupal 8.0.2 + 8.0.2 + unpublished + http://example.com/drupal-8-0-2-release + http://example.com/drupal-8-0-2.tar.gz + 1250424581 + + Release typeNew features + Release typeBug fixes + + Drupal 8.0.1 8.0.1 - DRUPAL-8-0-1 published http://example.com/drupal-8-0-1-release http://example.com/drupal-8-0-1.tar.gz @@ -65,7 +86,6 @@ Drupal 8.0.1-beta1 8.0.1-beta1 - DRUPAL-8-0-1-beta1 published http://example.com/drupal-8-0-1-beta1-release http://example.com/drupal-8-0-1-beta1.tar.gz @@ -78,7 +98,6 @@ Drupal 8.0.1-alpha1 8.0.1-alpha1 - DRUPAL-8-0-1-alpha1 published http://example.com/drupal-8-0-1-alpha1-release http://example.com/drupal-8-0-1-alpha1.tar.gz @@ -91,7 +110,6 @@ Drupal 8.0.0 8.0.0 - DRUPAL-8-0-0 published http://example.com/drupal-8-0-0-release http://example.com/drupal-8-0-0.tar.gz @@ -104,7 +122,6 @@ Drupal 8.0.0-beta1 8.0.0-beta1 - DRUPAL-8-0-0-beta1 published http://example.com/drupal-8-0-0-beta1-release http://example.com/drupal-8-0-0-beta1.tar.gz @@ -117,7 +134,6 @@ Drupal 8.0.0-alpha1 8.0.0-alpha1 - DRUPAL-8-0-0-alpha1 published http://example.com/drupal-8-0-0-alpha1-release http://example.com/drupal-8-0-0-alpha1.tar.gz diff --git a/core/modules/update/tests/modules/update_test/drupal.1.0.xml b/core/modules/update/tests/modules/update_test/drupal.1.0.xml index bba5cb97e1..46bd6ed748 100644 --- a/core/modules/update/tests/modules/update_test/drupal.1.0.xml +++ b/core/modules/update/tests/modules/update_test/drupal.1.0.xml @@ -49,6 +49,31 @@ Release typeBug fixes + + Drupal 8.0.3 + 8.0.3 + published + http://example.com/drupal-8-0-3-release + http://example.com/drupal-8-0-3.tar.gz + 1250424585 + + Release typeNew features + Release typeBug fixes + Release typeUnsupported + + + + Drupal 8.0.2 + 8.0.2 + unpublished + http://example.com/drupal-8-0-2-release + http://example.com/drupal-8-0-2.tar.gz + 1250424581 + + Release typeNew features + Release typeBug fixes + + Drupal 8.0.1 8.0.1 diff --git a/core/modules/update/tests/modules/update_test/drupal.sec.1.2_insecure-unsupported.xml b/core/modules/update/tests/modules/update_test/drupal.sec.1.2_insecure-unsupported.xml new file mode 100644 index 0000000000..065d06775a --- /dev/null +++ b/core/modules/update/tests/modules/update_test/drupal.sec.1.2_insecure-unsupported.xml @@ -0,0 +1,92 @@ + + +Drupal +drupal +Drupal +8.1. +published +http://example.com/project/drupal + + ProjectsDrupal project + + + + Drupal 8.1.2 + 8.1.2 + published + http://example.com/drupal-8-1-2-release + http://example.com/drupal-8-1-2.tar.gz + 1250424641 + + Release typeNew features + Release typeBug fixes + Release typeSecurity update + + + + Drupal 8.1.1 + 8.1.1 + published + http://example.com/drupal-8-1-1-release + http://example.com/drupal-8-1-1.tar.gz + 1250424581 + + Release typeNew features + Release typeBug fixes + Release typeInsecure + + + + Drupal 8.1.0 + 8.1.0 + published + http://example.com/drupal-8-1-0-release + http://example.com/drupal-8-1-0.tar.gz + 1250424521 + + Release typeNew features + Release typeBug fixes + Release typeInsecure + + + + Drupal 8.0.2 + 8.0.2 + published + http://example.com/drupal-8-0-2-release + http://example.com/drupal-8-0-2.tar.gz + 1250424641 + + Release typeNew features + Release typeBug fixes + Release typeInsecure + + + + Drupal 8.0.1 + 8.0.1 + published + http://example.com/drupal-8-0-1-release + http://example.com/drupal-8-0-1.tar.gz + 1250424581 + + Release typeNew features + Release typeBug fixes + Release typeInsecure + + + + Drupal 8.0.0 + 8.0.0 + published + http://example.com/drupal-8-0-0-release + http://example.com/drupal-8-0-0.tar.gz + 1250424521 + + Release typeNew features + Release typeBug fixes + Release typeInsecure + + + + diff --git a/core/modules/update/tests/src/Functional/UpdateContribTest.php b/core/modules/update/tests/src/Functional/UpdateContribTest.php index 839fee472f..f5075ed19d 100644 --- a/core/modules/update/tests/src/Functional/UpdateContribTest.php +++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php @@ -706,6 +706,60 @@ public function securityUpdateAvailabilityProvider() { ]; } + /** + * Tests messages when project releases are unpublished. + */ + public function testRevokedRelease() { + $system_info = [ + 'aaa_update_test' => [ + 'project' => 'aaa_update_test', + 'version' => '8.x-1.0', + 'hidden' => FALSE, + ], + ]; + $this->config('update_test.settings')->set('system_info', $system_info)->save(); + // Confirm that revoked messages are displayed regardless whether the + // installed version is in a supported branch or not. + $this->refreshUpdateStatus([ + 'drupal' => '0.0', + $this->updateProject => '1_0-supported', + ]); + $this->confirmRevokedStatus('8.x-1.0', '8.x-2.0', 'Also available:'); + + $this->refreshUpdateStatus([ + 'drupal' => '0.0', + $this->updateProject => '1_0-unsupported', + ]); + $this->confirmRevokedStatus('8.x-1.0', '8.x-2.0', 'Recommended version:'); + } + + /** + * Tests messages when project releases are marked as unsupported. + */ + public function testUnsupportedRelease() { + $system_info = [ + 'aaa_update_test' => [ + 'project' => 'aaa_update_test', + 'version' => '8.x-1.1', + 'hidden' => FALSE, + ], + ]; + $this->config('update_test.settings')->set('system_info', $system_info)->save(); + // Confirm that unsupported messages are displayed regardless whether the + // installed version is in a supported branch or not. + $this->refreshUpdateStatus([ + 'drupal' => '0.0', + $this->updateProject => '1_0-supported', + ]); + $this->confirmUnsupportedStatus('8.x-1.1', '8.x-2.0', 'Also available:'); + + $this->refreshUpdateStatus([ + 'drupal' => '0.0', + $this->updateProject => '1_0-unsupported', + ]); + $this->confirmUnsupportedStatus('8.x-1.1', '8.x-2.0', 'Recommended version:'); + } + /** * Asserts that a core compatibility message is correct for an update. * diff --git a/core/modules/update/tests/src/Functional/UpdateCoreTest.php b/core/modules/update/tests/src/Functional/UpdateCoreTest.php index 763fe9124a..0a513aea00 100644 --- a/core/modules/update/tests/src/Functional/UpdateCoreTest.php +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php @@ -305,6 +305,15 @@ public function securityUpdateAvailabilityProvider() { 'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED, 'fixture' => 'sec.1.2_insecure', ], + // No security release available for site minor release 0. + // Site minor is not a supported branch. + // Security release available for next minor. + '0.0, 1.2, insecure-unsupported' => [ + 'site_patch_version' => '0.0', + 'expected_security_releases' => ['1.2'], + 'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED, + 'fixture' => 'sec.1.2_insecure-unsupported', + ], // All releases for minor 0 are secure. // Security release available for next minor. '0.0, 1.2, secure' => [ @@ -792,6 +801,34 @@ public function testLocalActions() { } /** + * Tests messages when a project release is unpublished. + */ + public function testRevokedRelease() { + // Confirm that revoked messages are displayed regardless of whether the + // installed version is in a supported branch or not. + foreach (['1.0', '1.0-unsupported'] as $fixture) { + $this->setSystemInfo('8.0.2'); + $this->refreshUpdateStatus([$this->updateProject => $fixture]); + $this->standardTests(); + $this->confirmRevokedStatus('8.0.2', '8.1.0', 'Recommended version:'); + } + } + + /** + * Tests messages when a project release is marked unsupported. + */ + public function testUnsupportedRelease() { + // Confirm that unsupported messages are displayed regardless of whether the + // installed version is in a supported branch or not. + foreach (['1.0', '1.0-unsupported'] as $fixture) { + $this->setSystemInfo('8.0.3'); + $this->refreshUpdateStatus([$this->updateProject => $fixture]); + $this->standardTests(); + $this->confirmUnsupportedStatus('8.0.3', '8.1.0', 'Recommended version:'); + } + } + + /** * {@inheritdoc} */ protected function assertVersionUpdateLinks($label, $version, $download_version = NULL) { diff --git a/core/modules/update/tests/src/Functional/UpdateTestBase.php b/core/modules/update/tests/src/Functional/UpdateTestBase.php index 89cfdf4f6e..445fa82d46 100644 --- a/core/modules/update/tests/src/Functional/UpdateTestBase.php +++ b/core/modules/update/tests/src/Functional/UpdateTestBase.php @@ -204,4 +204,69 @@ protected function assertVersionUpdateLinks($label, $version, $download_version $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:'). + */ + protected function confirmRevokedStatus($revoked_version, $newer_version, $new_version_label) { + $this->drupalGet('admin/reports/updates'); + $this->clickLink(t('Check manually')); + $this->checkForMetaRefresh(); + $this->assertUpdateTableTextContains('Revoked!'); + $this->assertUpdateTableTextContains($revoked_version); + $this->assertUpdateTableContains('error.svg'); + $this->assertUpdateTableTextContains('Release revoked: Your currently installed release has been revoked, and is no longer available for download. Disabling everything included in this release or upgrading is strongly recommended!'); + $this->assertVersionUpdateLinks($new_version_label, $newer_version); + } + + /** + * Confirms messages are correct when a release has been marked unsupported. + * + * @param string $unsupported_version + * The unsupported 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:'). + */ + protected function confirmUnsupportedStatus($unsupported_version, $newer_version, $new_version_label) { + $this->drupalGet('admin/reports/updates'); + $this->clickLink(t('Check manually')); + $this->checkForMetaRefresh(); + $this->assertUpdateTableTextContains('Not supported!'); + $this->assertUpdateTableTextContains($unsupported_version); + $this->assertUpdateTableContains('error.svg'); + $this->assertUpdateTableTextContains('Release not supported: Your currently installed release is now unsupported, and is no longer available for download. Disabling everything included in this release or upgrading is strongly recommended!'); + $this->assertVersionUpdateLinks($new_version_label, $newer_version); + } + + /** + * Asserts that the update table text does contain the specified text. + * + * @param string $text + * The expected text. + */ + protected function assertUpdateTableTextContains($text) { + $this->assertSession()->elementTextContains('css', $this->updateTableLocator, $text); + } + + /** + * Asserts that the update table does contain the specified text. + * + * @param string $text + * The expected text. + */ + protected function assertUpdateTableContains($text) { + $this->assertSession() + ->elementContains('css', $this->updateTableLocator, $text); + } + }