diff --git a/core/drupalci.yml b/core/drupalci.yml index 8cc5f1d488..4a4a5e0ed3 100644 --- a/core/drupalci.yml +++ b/core/drupalci.yml @@ -2,56 +2,9 @@ # Learn to make one for your own drupal.org project: # https://www.drupal.org/drupalorg/docs/drupal-ci/customizing-drupalci-testing build: - assessment: - validate_codebase: - phplint: - csslint: - halt-on-fail: false - eslint: - # A test must pass eslinting standards check in order to continue processing. - halt-on-fail: false - phpcs: - # phpcs will use core's specified version of Coder. - sniff-all-files: false - halt-on-fail: false testing: - # run_tests task is executed several times in order of performance speeds. - # halt-on-fail can be set on the run_tests tasks in order to fail fast. - # suppress-deprecations is false in order to be alerted to usages of - # deprecated code. - run_tests.phpunit: - types: 'PHPUnit-Unit' - testgroups: '--all' - suppress-deprecations: false - halt-on-fail: false - run_tests.kernel: - types: 'PHPUnit-Kernel' - testgroups: '--all' - suppress-deprecations: false - halt-on-fail: false - run_tests.simpletest: - types: 'Simpletest' - testgroups: '--all' - suppress-deprecations: false - halt-on-fail: false - run_tests.build: - # Limit concurrency due to disk space concerns. - concurrency: 15 - types: 'PHPUnit-Build' - testgroups: '--all' - suppress-deprecations: false - halt-on-fail: false run_tests.functional: types: 'PHPUnit-Functional' - testgroups: '--all' - suppress-deprecations: false - halt-on-fail: false - run_tests.javascript: - concurrency: 15 - types: 'PHPUnit-FunctionalJavascript' - testgroups: '--all' + testgroups: '--module update' suppress-deprecations: false halt-on-fail: false - # Run nightwatch testing. - # @see https://www.drupal.org/project/drupal/issues/2869825 - nightwatchjs: 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..f40a46b3be --- /dev/null +++ b/core/modules/update/tests/modules/update_test/aaa_update_test.1_0-supported.xml @@ -0,0 +1,66 @@ + + +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 + DRUPAL-8--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 + DRUPAL-8--2-0 + 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 + DRUPAL-8--2-0 + 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.0 + 8.x-1.0 + DRUPAL-8--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..d09d5d6d6a --- /dev/null +++ b/core/modules/update/tests/modules/update_test/aaa_update_test.1_0-unsupported.xml @@ -0,0 +1,66 @@ + + +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 + DRUPAL-8--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 + DRUPAL-8--2-0 + 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 + DRUPAL-8--2-0 + 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.0 + 8.x-1.0 + DRUPAL-8--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 90% 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..087b0fdac0 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 @@ -49,6 +49,19 @@ Release typeBug fixes + + Drupal 8.0.2 + 8.0.2 + DRUPAL-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.1.0.xml b/core/modules/update/tests/modules/update_test/drupal.1.0.xml index bba5cb97e1..4937334dff 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,19 @@ Release typeBug fixes + + Drupal 8.0.2 + 8.0.2 + DRUPAL-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..f4a14cae05 --- /dev/null +++ b/core/modules/update/tests/modules/update_test/drupal.sec.1.2_insecure-unsupported.xml @@ -0,0 +1,98 @@ + + +Drupal +drupal +Drupal +8.1. +published +http://example.com/project/drupal + + ProjectsDrupal project + + + + Drupal 8.1.2 + 8.1.2 + DRUPAL-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 + DRUPAL-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 + DRUPAL-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 + DRUPAL-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 + DRUPAL-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 + DRUPAL-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..fdc203d714 100644 --- a/core/modules/update/tests/src/Functional/UpdateContribTest.php +++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php @@ -706,6 +706,33 @@ public function securityUpdateAvailabilityProvider() { ]; } + /** + * Tests messages when a project is 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:'); + } + /** * 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..c2fda41d04 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' => [ @@ -791,6 +800,20 @@ public function testLocalActions() { $this->assertUrl('admin/reports/updates/install'); } + /** + * Tests messages when a project is unpublished. + */ + public function testRevokedRelease() { + // Confirm that revoked messages are displayed regardless 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:'); + } + } + /** * {@inheritdoc} */ diff --git a/core/modules/update/tests/src/Functional/UpdateTestBase.php b/core/modules/update/tests/src/Functional/UpdateTestBase.php index 89cfdf4f6e..63d8bbe591 100644 --- a/core/modules/update/tests/src/Functional/UpdateTestBase.php +++ b/core/modules/update/tests/src/Functional/UpdateTestBase.php @@ -204,4 +204,46 @@ 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 messages are correct. + * + * @param string $revoked_version + * The revoked version that is currently installed. + * @param string $newer_version + * The expected new_version version. + * @param $new_version_label + * The ex + */ + 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); + } + + /** + * 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); + } + } diff --git a/core/modules/update/update.compare.inc b/core/modules/update/update.compare.inc index 7560142548..6da89f8f5e 100644 --- a/core/modules/update/update.compare.inc +++ b/core/modules/update/update.compare.inc @@ -343,6 +343,12 @@ function update_calculate_project_update_status(&$project_data, $available) { $recommended_release = NULL; foreach ($available['releases'] as $version => $release) { + if (!$is_in_supported_branch($release['version'])) { + // In all cases we only want to show the user releases in supported + // branches. If this version is not in a supported branch, do not evaluate + // the release. + continue; + } try { $release_module_version = ModuleVersion::createFromVersionString($release['version']); } @@ -392,14 +398,12 @@ function update_calculate_project_update_status(&$project_data, $available) { // See if this is a higher major version than our target and yet still // supported. If so, record it as an "Also available" release. if ($release_major_version > $target_major) { - if ($is_in_supported_branch($release['version'])) { - if (!isset($project_data['also'])) { - $project_data['also'] = []; - } - if (!isset($project_data['also'][$release_major_version])) { - $project_data['also'][$release_major_version] = $version; - $project_data['releases'][$version] = $release; - } + if (!isset($project_data['also'])) { + $project_data['also'] = []; + } + if (!isset($project_data['also'][$release_major_version])) { + $project_data['also'][$release_major_version] = $version; + $project_data['releases'][$version] = $release; } // Otherwise, this release can't matter to us, since it's neither // from the release series we're currently using nor the recommended