diff -u b/core/modules/update/src/Controller/UpdateController.php b/core/modules/update/src/Controller/UpdateController.php
--- b/core/modules/update/src/Controller/UpdateController.php
+++ b/core/modules/update/src/Controller/UpdateController.php
@@ -32,7 +32,7 @@
*
* @param \Drupal\update\UpdateManagerInterface $update_manager
* Update Manager Service.
- * @param \Drupal\Core\Render\RendererInterface $renderer
+ * @param \Drupal\Core\Render\RendererInterface|null $renderer
* The renderer.
*/
public function __construct(UpdateManagerInterface $update_manager, RendererInterface $renderer = NULL) {
diff -u b/core/modules/update/src/UpdateFetcher.php b/core/modules/update/src/UpdateFetcher.php
--- b/core/modules/update/src/UpdateFetcher.php
+++ b/core/modules/update/src/UpdateFetcher.php
@@ -55,10 +55,10 @@
* The config factory.
* @param \GuzzleHttp\ClientInterface $http_client
* A Guzzle client object.
- * @param \Drupal\Core\Site\Settings $settings
+ * @param \Drupal\Core\Site\Settings|null $settings
* The settings instance.
*/
- public function __construct(ConfigFactoryInterface $config_factory, ClientInterface $http_client, Settings $settings) {
+ public function __construct(ConfigFactoryInterface $config_factory, ClientInterface $http_client, Settings $settings = NULL) {
$this->fetchUrl = $config_factory->get('update.settings')->get('fetch.url');
$this->httpClient = $http_client;
$this->updateSettings = $config_factory->get('update.settings');
diff -u b/core/modules/update/tests/src/Kernel/UpdateReportTest.php b/core/modules/update/tests/src/Kernel/UpdateReportTest.php
--- b/core/modules/update/tests/src/Kernel/UpdateReportTest.php
+++ b/core/modules/update/tests/src/Kernel/UpdateReportTest.php
@@ -2,6 +2,8 @@
namespace Drupal\Tests\update\Kernel;
+use Drupal\Core\Link;
+use Drupal\Core\Url;
use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\user\Traits\UserCreationTrait;
@@ -63,6 +65,12 @@
* @see template_preprocess_update_fetch_error_message()
*/
public function testTemplatePreprocessUpdateFetchErrorMessageNoDblog() {
+ $build = [
+ '#theme' => 'update_fetch_error_message',
+ ];
+ $this->render($build);
+ $this->assertRaw('Failed to fetch available update data:
- See PHP OpenSSL requirements in the Drupal.org handbook for possible reasons this could happen and what you can do to resolve them.
- Check your local system logs for additional error messages.
');
+
\Drupal::moduleHandler()->loadInclude('update', 'inc', 'update.report');
$variables = [];
template_preprocess_update_fetch_error_message($variables);
@@ -87,6 +95,12 @@
// First, try as a normal user that can't access dblog.
$this->setUpCurrentUser();
+ $build = [
+ '#theme' => 'update_fetch_error_message',
+ ];
+ $this->render($build);
+ $this->assertRaw('Failed to fetch available update data:- See PHP OpenSSL requirements in the Drupal.org handbook for possible reasons this could happen and what you can do to resolve them.
- Check your local system logs for additional error messages.
');
+
$variables = [];
template_preprocess_update_fetch_error_message($variables);
$this->assertArrayHasKey('error_message', $variables);
@@ -98,6 +112,12 @@
// Now, try as an admin that can access dblog.
$this->setUpCurrentUser([], ['access content', 'access site reports']);
+ $this->render($build);
+ $this->assertRaw('Failed to fetch available update data:- See PHP OpenSSL requirements in the Drupal.org handbook for possible reasons this could happen and what you can do to resolve them.
- Check');
+ $dblog_url = Url::fromRoute('dblog.overview', [], ['query' => ['type' => ['update']]]);
+ $this->assertRaw(Link::fromTextAndUrl('your local system logs', $dblog_url)->toString());
+ $this->assertRaw(' for additional error messages.
');
+
$variables = [];
template_preprocess_update_fetch_error_message($variables);
$this->assertArrayHasKey('error_message', $variables);
diff -u b/core/modules/update/update.report.inc b/core/modules/update/update.report.inc
--- b/core/modules/update/update.report.inc
+++ b/core/modules/update/update.report.inc
@@ -357,8 +357,8 @@
];
if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) {
$options = ['query' => ['type' => ['update']]];
- $watchdog_url = Url::fromRoute('dblog.overview', [], $options);
- $variables['error_message']['items']['#items']['dblog'] = t('Check your local system logs for additional error messages.', ['@url' => $watchdog_url->toString()]);
+ $dblog_url = Url::fromRoute('dblog.overview', [], $options);
+ $variables['error_message']['items']['#items']['dblog'] = t('Check your local system logs for additional error messages.', ['@url' => $dblog_url->toString()]);
}
else {
$variables['error_message']['items']['#items']['logs'] = t('Check your local system logs for additional error messages.');