diff --git a/core/modules/update/tests/modules/update_test/drupal.0.1.2-sec.xml b/core/modules/update/tests/modules/update_test/drupal.0.1.2-sec.xml new file mode 100644 index 0000000000..8b6a9b86cd --- /dev/null +++ b/core/modules/update/tests/modules/update_test/drupal.0.1.2-sec.xml @@ -0,0 +1,110 @@ + + +Drupal +drupal +Drupal +8.x +8 +8 +8 +published +http://example.com/project/drupal + + ProjectsDrupal project + + + + Drupal 8.1.2 + 8.1.2 + 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 + b966255555d9c9b86d480ca08cfaa98e + 4294967296 + + Release typeNew features + Release typeBug fixes + Release typeSecurity update + + + + Drupal 8.1.1 + 8.1.1 + 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 + b966255555d9c9b86d480ca08cfaa98e + 2147483648 + + Release typeNew features + Release typeBug fixes + Release typeInsecure + + + + Drupal 8.1.0 + 8.1.0 + 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 + b966255555d9c9b86d480ca08cfaa98e + 1073741824 + + Release typeNew features + Release typeBug fixes + Release typeInsecure + + + + Drupal 8.0.1 + 8.0.1 + 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 + b966255555d9c9b86d480ca08cfaa98e + 2147483648 + + Release typeNew features + Release typeBug fixes + + + + Drupal 8.0.0 + 8.0.0 + 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 + b966255555d9c9b86d480ca08cfaa98e + 1073741824 + + Release typeNew features + Release typeBug fixes + + + + diff --git a/core/modules/update/tests/modules/update_test/drupal.0.2_1.2-sec.xml b/core/modules/update/tests/modules/update_test/drupal.0.2_1.2-sec.xml new file mode 100644 index 0000000000..796c6df63e --- /dev/null +++ b/core/modules/update/tests/modules/update_test/drupal.0.2_1.2-sec.xml @@ -0,0 +1,127 @@ + + +Drupal +drupal +Drupal +8.x +8 +8 +8 +published +http://example.com/project/drupal + + ProjectsDrupal project + + + + Drupal 8.1.2 + 8.1.2 + 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 + b966255555d9c9b86d480ca08cfaa98e + 4294967296 + + Release typeNew features + Release typeBug fixes + Release typeSecurity update + + + + Drupal 8.1.1 + 8.1.1 + 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 + b966255555d9c9b86d480ca08cfaa98e + 2147483648 + + Release typeNew features + Release typeBug fixes + + + + Drupal 8.1.0 + 8.1.0 + 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 + b966255555d9c9b86d480ca08cfaa98e + 1073741824 + + Release typeNew features + Release typeBug fixes + + + + Drupal 8.0.2 + 8.0.2 + 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 + b966255555d9c9b86d480ca08cfaa98e + 4294967296 + + Release typeNew features + Release typeBug fixes + Release typeSecurity update + + + + Drupal 8.0.1 + 8.0.1 + 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 + b966255555d9c9b86d480ca08cfaa98e + 2147483648 + + Release typeNew features + Release typeBug fixes + + + + Drupal 8.0.0 + 8.0.0 + 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 + b966255555d9c9b86d480ca08cfaa98e + 1073741824 + + Release typeNew features + Release typeBug fixes + + + + diff --git a/core/modules/update/tests/src/Functional/UpdateCoreTest.php b/core/modules/update/tests/src/Functional/UpdateCoreTest.php index 222d568580..9eefd0928c 100644 --- a/core/modules/update/tests/src/Functional/UpdateCoreTest.php +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php @@ -160,20 +160,70 @@ public function testMajorUpdateAvailable() { /** * Tests the Update Manager module when a security update is available. + * + * @dataProvider securityUpdateAvailabilityProvider */ - public function testSecurityUpdateAvailable() { - foreach ([0, 1] as $minor_version) { - $this->setSystemInfo("8.$minor_version.0"); - $this->refreshUpdateStatus(['drupal' => "$minor_version.2-sec"]); - $this->standardTests(); + public function testSecurityUpdateAvailability($current_minor_version, $security_releases, $expected_security_release) { + $assert_session = $this->assertSession(); + $this->setSystemInfo("8.$current_minor_version.0"); + $this->refreshUpdateStatus(['drupal' => implode('_', $security_releases) . '-sec']); + $this->standardTests(); + if ($expected_security_release) { $this->assertNoText(t('Up to date')); $this->assertNoText(t('Update available')); $this->assertText(t('Security update required!')); - $this->assertRaw(\Drupal::l("8.$minor_version.2", Url::fromUri("http://example.com/drupal-8-$minor_version-2-release")), 'Link to release appears.'); - $this->assertRaw(\Drupal::l(t('Download'), Url::fromUri("http://example.com/drupal-8-$minor_version-2.tar.gz")), 'Link to download appears.'); - $this->assertRaw(\Drupal::l(t('Release notes'), Url::fromUri("http://example.com/drupal-8-$minor_version-2-release")), 'Link to release notes appears.'); + $expected_url_version = str_replace('.', '-', $expected_security_release); + $this->assertRaw(\Drupal::l("8.$expected_security_release", Url::fromUri("http://example.com/drupal-8-$expected_url_version-release")), 'Link to release appears.'); + $this->assertRaw(\Drupal::l(t('Download'), Url::fromUri("http://example.com/drupal-8-$expected_url_version.tar.gz")), 'Link to download appears.'); + $this->assertRaw(\Drupal::l(t('Release notes'), Url::fromUri("http://example.com/drupal-8-$expected_url_version-release")), 'Link to release notes appears.'); $this->assertRaw('error.svg', 'Error icon was found.'); + foreach ($security_releases as $security_release) { + if ($security_release !== $expected_security_release) { + // All security releases besides the current should show up on the + // page. + $assert_session->pageTextNotContains("8.$security_release"); + } + } } + else { + $assert_session->pageTextNotContains('Up to date'); + $assert_session->pageTextNotContains('Security update required!'); + $assert_session->pageTextContains('Update available'); + } + } + + /** + * Data provider method for testSecurityUpdateAvailability(). + */ + public function securityUpdateAvailabilityProvider() { + return [ + '0, 0.2' => [ + 'current_minor' => 0, + 'security_releases' => ['0.2'], + 'expected_security_release' => '0.2', + ], + '1, 1.2' => [ + 'current_minor' => 1, + 'security_releases' => ['1.2'], + 'expected_security_release' => '1.2', + ], + '0, 0.2 1.2' => [ + 'current_minor' => 0, + 'security_releases' => ['0.2', '1.2'], + 'expected_security_release' => '0.2', + + ], + '1, 0.2 1.2' => [ + 'current_minor' => 1, + 'security_releases' => ['0.2', '1.2'], + 'expected_security_release' => '1.2', + ], + '0, 1.2' => [ + 'current_minor' => 0, + 'security_releases' => ['1.2'], + 'expected_security_release' => NULL, + ], + ]; } /**