Merge pull request #9920 from nextcloud/fix/9867/fix_setup_check

If cronErros is empty json_decode will return NULL
pull/9926/head
Morris Jobke 7 years ago committed by GitHub
commit 0cf0ef024f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      settings/Controller/CheckSetupController.php
  2. 10
      tests/Settings/Controller/CheckSetupControllerTest.php

@ -513,6 +513,16 @@ Raw output
];
}
protected function getCronErrors() {
$errors = json_decode($this->config->getAppValue('core', 'cronErrors', ''), true);
if (is_array($errors)) {
return $errors;
}
return [];
}
/**
* @return DataResponse
*/
@ -527,7 +537,7 @@ Raw output
'hasWorkingFileLocking' => $this->hasWorkingFileLocking(),
'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(),
'cronInfo' => $this->getLastCronInfo(),
'cronErrors' => json_decode($this->config->getAppValue('core', 'cronErrors', ''), true),
'cronErrors' => $this->getCronErrors(),
'serverHasInternetConnection' => $this->isInternetConnectionWorking(),
'isMemcacheConfigured' => $this->isMemcacheConfigured(),
'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'),

@ -63,7 +63,7 @@ class CheckSetupControllerTest extends TestCase {
private $l10n;
/** @var ILogger */
private $logger;
/** @var Checker | \PHPUnit_Framework_MockObject_MockObject */
/** @var Checker|\PHPUnit_Framework_MockObject_MockObject */
private $checker;
/** @var EventDispatcher|\PHPUnit_Framework_MockObject_MockObject */
private $dispatcher;
@ -392,6 +392,10 @@ class CheckSetupControllerTest extends TestCase {
'relativeTime' => '2 hours ago',
'backgroundJobsUrl' => 'https://example.org',
]);
$this->checker
->expects($this->once())
->method('hasPassedCheck')
->willReturn(true);
$expected = new DataResponse(
[
@ -407,7 +411,7 @@ class CheckSetupControllerTest extends TestCase {
'relativeTime' => '2 hours ago',
'backgroundJobsUrl' => 'https://example.org',
],
'cronErrors' => '',
'cronErrors' => [],
'serverHasInternetConnection' => false,
'isMemcacheConfigured' => true,
'memcacheDocs' => 'http://docs.example.org/server/go.php?to=admin-performance',
@ -421,7 +425,7 @@ class CheckSetupControllerTest extends TestCase {
'forwardedForHeadersWorking' => true,
'reverseProxyDocs' => 'reverse-proxy-doc-link',
'isCorrectMemcachedPHPModuleInstalled' => true,
'hasPassedCodeIntegrityCheck' => null,
'hasPassedCodeIntegrityCheck' => true,
'codeIntegrityCheckerDocumentation' => 'http://docs.example.org/server/go.php?to=admin-code-integrity',
'isOpcacheProperlySetup' => false,
'phpOpcacheDocumentation' => 'http://docs.example.org/server/go.php?to=admin-php-opcache',

Loading…
Cancel
Save