aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-10-21 09:27:12 +0200
committerJoas Schilling <coding@schilljs.com>2021-10-21 09:27:12 +0200
commitf24e8212c383e74261a42d1fcf88a81bde2ed5e8 (patch)
treea267fed57d0e672f4f1a9c3c34f83e8087766ed5 /tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
parentfacb50ebcc1f4a9fef8be746717272ef24103007 (diff)
downloadnextcloud-server-f24e8212c383e74261a42d1fcf88a81bde2ed5e8.tar.gz
nextcloud-server-f24e8212c383e74261a42d1fcf88a81bde2ed5e8.zip
Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/App/AppStore/Fetcher/AppFetcherTest.php')
-rw-r--r--tests/lib/App/AppStore/Fetcher/AppFetcherTest.php40
1 files changed, 26 insertions, 14 deletions
diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
index f8f00ef73b8..14a7569a64e 100644
--- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
@@ -1868,9 +1868,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
public function testGetWithFilter() {
$this->config->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
- if ($key === 'appstoreenabled') {
- return true;
- } elseif ($key === 'version') {
+ if ($key === 'version') {
return '11.0.0.2';
} elseif ($key === 'appstoreurl' && $default === 'https://apps.nextcloud.com/api/v1') {
return 'https://custom.appsstore.endpoint/api/v1';
@@ -1878,6 +1876,10 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
return $default;
}
});
+ $this->config
+ ->method('getSystemValueBool')
+ ->with('appstoreenabled', true)
+ ->willReturn(true);
$file = $this->createMock(ISimpleFile::class);
$folder = $this->createMock(ISimpleFolder::class);
@@ -1951,13 +1953,15 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
$this->config
->method('getSystemValue')
->willReturnCallback(function ($var, $default) {
- if ($var === 'appstoreenabled') {
- return false;
- } elseif ($var === 'version') {
+ if ($var === 'version') {
return '11.0.0.2';
}
return $default;
});
+ $this->config
+ ->method('getSystemValueBool')
+ ->with('appstoreenabled', true)
+ ->willReturn(false);
$this->appData
->expects($this->never())
->method('getFolder');
@@ -1977,6 +1981,10 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
}
return $default;
});
+ $this->config
+ ->method('getSystemValueBool')
+ ->with('appstoreenabled', true)
+ ->willReturn(true);
$this->appData
->expects($this->never())
->method('getFolder');
@@ -1987,9 +1995,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
public function testSetVersion() {
$this->config->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
- if ($key === 'appstoreenabled') {
- return true;
- } elseif ($key === 'version') {
+ if ($key === 'version') {
return '10.0.7.2';
} elseif ($key === 'appstoreurl' && $default === 'https://apps.nextcloud.com/api/v1') {
return 'https://custom.appsstore.endpoint/api/v1';
@@ -1997,6 +2003,10 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
return $default;
}
});
+ $this->config
+ ->method('getSystemValueBool')
+ ->with('appstoreenabled', true)
+ ->willReturn(true);
$file = $this->createMock(ISimpleFile::class);
$folder = $this->createMock(ISimpleFolder::class);
@@ -2070,9 +2080,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
public function testGetAppsAllowlist() {
$this->config->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
- if ($key === 'appstoreenabled') {
- return true;
- } elseif ($key === 'version') {
+ if ($key === 'version') {
return '11.0.0.2';
} elseif ($key === 'appstoreurl' && $default === 'https://apps.nextcloud.com/api/v1') {
return 'https://custom.appsstore.endpoint/api/v1';
@@ -2082,7 +2090,11 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
return $default;
}
});
-
+ $this->config
+ ->method('getSystemValueBool')
+ ->with('appstoreenabled', true)
+ ->willReturn(true);
+
$file = $this->createMock(ISimpleFile::class);
$folder = $this->createMock(ISimpleFolder::class);
$folder
@@ -2122,7 +2134,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
->expects($this->once())
->method('getTime')
->willReturn(1234);
-
+
$this->registry
->expects($this->exactly(2))
->method('delegateHasValidSubscription')