summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-12-19 10:12:33 +0100
committerGitHub <noreply@github.com>2017-12-19 10:12:33 +0100
commite550a3ddd8a391a25581302dc87d4877f6c53f0d (patch)
treed8791750680ed42e0dbd5413e2fe08e72a2d3585 /tests
parentb01d20c0d7b76dc04fcbfa027c51b14d740dc67e (diff)
parent1beffa058a493a0c9f36a0280fb9e5e354e0d066 (diff)
downloadnextcloud-server-e550a3ddd8a391a25581302dc87d4877f6c53f0d.tar.gz
nextcloud-server-e550a3ddd8a391a25581302dc87d4877f6c53f0d.zip
Merge pull request #7562 from nextcloud/fix-wrongly-cached-result
Cache final result of update check
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Updater/VersionCheckTest.php53
1 files changed, 52 insertions, 1 deletions
diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php
index ff04aa17681..89a335722d7 100644
--- a/tests/lib/Updater/VersionCheckTest.php
+++ b/tests/lib/Updater/VersionCheckTest.php
@@ -161,7 +161,7 @@ class VersionCheckTest extends \Test\TestCase {
$this->config
->expects($this->at(6))
->method('setAppValue')
- ->with('core', 'lastupdateResult', 'false');
+ ->with('core', 'lastupdateResult', '[]');
$updateXml = 'Invalid XML Response!';
$this->updater
@@ -265,4 +265,55 @@ class VersionCheckTest extends \Test\TestCase {
$this->assertSame($expectedResult, $this->updater->check());
}
+
+ public function testCheckWithMissingAttributeXmlResponse() {
+ $expectedResult = [
+ 'version' => '',
+ 'versionstring' => '',
+ 'url' => '',
+ 'web' => '',
+ 'autoupdater' => '',
+ ];
+
+ $this->config
+ ->expects($this->at(0))
+ ->method('getAppValue')
+ ->with('core', 'lastupdatedat')
+ ->will($this->returnValue(0));
+ $this->config
+ ->expects($this->at(1))
+ ->method('getSystemValue')
+ ->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
+ ->willReturnArgument(1);
+ $this->config
+ ->expects($this->at(2))
+ ->method('setAppValue')
+ ->with('core', 'lastupdatedat', $this->isType('integer'));
+ $this->config
+ ->expects($this->at(4))
+ ->method('getAppValue')
+ ->with('core', 'installedat')
+ ->will($this->returnValue('installedat'));
+ $this->config
+ ->expects($this->at(5))
+ ->method('getAppValue')
+ ->with('core', 'lastupdatedat')
+ ->will($this->returnValue('lastupdatedat'));
+
+ // missing autoupdater element should still not fail
+ $updateXml = '<?xml version="1.0"?>
+<owncloud>
+ <version></version>
+ <versionstring></versionstring>
+ <url></url>
+ <web></web>
+</owncloud>';
+ $this->updater
+ ->expects($this->once())
+ ->method('getUrlContent')
+ ->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/'))
+ ->will($this->returnValue($updateXml));
+
+ $this->assertSame($expectedResult, $this->updater->check());
+ }
}