diff --git a/core/modules/update/src/Tests/UpdateCoreTest.php b/core/modules/update/src/Tests/UpdateCoreTest.php index d76cfed..693a751 100644 --- a/core/modules/update/src/Tests/UpdateCoreTest.php +++ b/core/modules/update/src/Tests/UpdateCoreTest.php @@ -70,11 +70,17 @@ function testNoUpdatesAvailable() { */ function testNormalUpdateAvailable() { $this->setSystemInfo('8.0.0'); + + // Ensure that the update check requires a token. + $this->drupalGet('admin/reports/updates/check'); + $this->assertResponse(403, 'Accessing admin/reports/updates/check without a CSRF token results in access denied.'); + foreach (array(0, 1) as $minor_version) { foreach (array('-alpha1', '-beta1', '') as $extra_version) { $this->refreshUpdateStatus(array('drupal' => "$minor_version.1" . $extra_version)); $this->standardTests(); - $this->drupalGet('admin/reports/updates/check'); + $this->drupalGet('admin/reports/updates'); + $this->clickLink(t('Check manually')); $this->assertNoText(t('Security update required!')); $this->assertRaw(\Drupal::l("8.$minor_version.1" . $extra_version, Url::fromUri("http://example.com/drupal-8-$minor_version-1$extra_version-release")), 'Link to release appears.'); $this->assertRaw(\Drupal::l(t('Download'), Url::fromUri("http://example.com/drupal-8-$minor_version-1$extra_version.tar.gz")), 'Link to download appears.'); @@ -136,7 +142,8 @@ function testMajorUpdateAvailable() { $this->setSystemInfo("8.$minor_version.$patch_version" . $extra_version); $this->refreshUpdateStatus(array('drupal' => '9')); $this->standardTests(); - $this->drupalGet('admin/reports/updates/check'); + $this->drupalGet('admin/reports/updates'); + $this->clickLink(t('Check manually')); $this->assertNoText(t('Security update required!')); $this->assertRaw(\Drupal::l('9.0.0', Url::fromUri("http://example.com/drupal-9-0-0-release")), 'Link to release appears.'); $this->assertRaw(\Drupal::l(t('Download'), Url::fromUri("http://example.com/drupal-9-0-0.tar.gz")), 'Link to download appears.'); diff --git a/core/modules/update/src/Tests/UpdateTestBase.php b/core/modules/update/src/Tests/UpdateTestBase.php index faec496..1ebdc28 100644 --- a/core/modules/update/src/Tests/UpdateTestBase.php +++ b/core/modules/update/src/Tests/UpdateTestBase.php @@ -72,7 +72,8 @@ protected function refreshUpdateStatus($xml_map, $url = 'update-test') { // Save the map for UpdateTestController::updateTest() to use. $this->config('update_test.settings')->set('xml_map', $xml_map)->save(); // Manually check the update status. - $this->drupalGet('admin/reports/updates/check'); + $this->drupalGet('admin/reports/updates'); + $this->clickLink(t('Check manually')); } /** diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 98f7569..bf0b2e0 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -567,7 +567,12 @@ function _update_project_status_sort($a, $b) { */ function template_preprocess_update_last_check(&$variables) { $variables['time'] = \Drupal::service('date.formatter')->formatTimeDiffSince($variables['last']); - $variables['link'] = \Drupal::l(t('Check manually'), new Url('update.manual_status', array(), array('query' => \Drupal::destination()->getAsArray()))); + $variables['link'] = [ + '#type' => 'link', + '#title' => t('Check manually'), + '#url' => Url::fromRoute('update.manual_status', [], ['query' => \Drupal::destination()->getAsArray()]), + ]; + } /**