summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-11-17 20:41:58 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2017-11-17 20:41:58 +0100
commit6bbda28881223a39e548b9fde0e4d62f5fcbec82 (patch)
tree5086b08309e9b9b9ea19f98a9b4643cf501d6a30 /tests
parent2eb2b6e437446023004d81a0be0ea5c827a6359a (diff)
downloadnextcloud-server-6bbda28881223a39e548b9fde0e4d62f5fcbec82.tar.gz
nextcloud-server-6bbda28881223a39e548b9fde0e4d62f5fcbec82.zip
Fix tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/App/AppStore/Fetcher/AppFetcherTest.php26
-rw-r--r--tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php24
-rw-r--r--tests/lib/App/AppStore/Fetcher/FetcherBase.php26
3 files changed, 67 insertions, 9 deletions
diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
index 2efecef4dc7..4549b05935c 100644
--- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
@@ -1945,10 +1945,30 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
public function testAppstoreDisabled() {
$this->config
- ->expects($this->once())
->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->willReturn(false);
+ ->will($this->returnCallback(function($var, $default) {
+ if ($var === 'appstoreenabled') {
+ return false;
+ }
+ return $default;
+ }));
+ $this->appData
+ ->expects($this->never())
+ ->method('getFolder');
+
+ $this->assertEquals([], $this->fetcher->get());
+ }
+
+
+ public function testNoInternet() {
+ $this->config
+ ->method('getSystemValue')
+ ->will($this->returnCallback(function($var, $default) {
+ if ($var === 'has_internet_connection') {
+ return false;
+ }
+ return $default;
+ }));
$this->appData
->expects($this->never())
->method('getFolder');
diff --git a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
index a1ce718520f..f4b8c320c51 100644
--- a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
@@ -40,15 +40,33 @@ class CategoryFetcherTest extends FetcherBase {
public function testAppstoreDisabled() {
$this->config
- ->expects($this->once())
->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->willReturn(false);
+ ->will($this->returnCallback(function($var, $default) {
+ if ($var === 'appstoreenabled') {
+ return false;
+ }
+ return $default;
+ }));
$this->appData
->expects($this->never())
->method('getFolder');
$this->assertEquals([], $this->fetcher->get());
+ }
+
+ public function testNoInternet() {
+ $this->config
+ ->method('getSystemValue')
+ ->will($this->returnCallback(function($var, $default) {
+ if ($var === 'has_internet_connection') {
+ return false;
+ }
+ return $default;
+ }));
+ $this->appData
+ ->expects($this->never())
+ ->method('getFolder');
+ $this->assertEquals([], $this->fetcher->get());
}
}
diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
index 2cfb34a0965..90b7523d850 100644
--- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php
+++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
@@ -78,6 +78,11 @@ abstract class FetcherBase extends TestCase {
$this->config
->expects($this->at(1))
->method('getSystemValue')
+ ->with('has_internet_connection', true)
+ ->willReturn(true);
+ $this->config
+ ->expects($this->at(2))
+ ->method('getSystemValue')
->with(
$this->equalTo('version'),
$this->anything()
@@ -121,11 +126,16 @@ abstract class FetcherBase extends TestCase {
$this->config
->expects($this->at(1))
->method('getSystemValue')
- ->with('appstoreenabled', true)
+ ->with('has_internet_connection', true)
->willReturn(true);
$this->config
->expects($this->at(2))
->method('getSystemValue')
+ ->with('appstoreenabled', true)
+ ->willReturn(true);
+ $this->config
+ ->expects($this->at(3))
+ ->method('getSystemValue')
->with(
$this->equalTo('version'),
$this->anything()
@@ -277,11 +287,16 @@ abstract class FetcherBase extends TestCase {
$this->config
->expects($this->at(1))
->method('getSystemValue')
- ->with('appstoreenabled', true)
+ ->with('has_internet_connection', true)
->willReturn(true);
$this->config
->expects($this->at(2))
->method('getSystemValue')
+ ->with('appstoreenabled', true)
+ ->willReturn(true);
+ $this->config
+ ->expects($this->at(3))
+ ->method('getSystemValue')
->with(
$this->equalTo('version'),
$this->anything()
@@ -356,11 +371,16 @@ abstract class FetcherBase extends TestCase {
$this->config
->expects($this->at(1))
->method('getSystemValue')
- ->with('appstoreenabled', true)
+ ->with('has_internet_connection', true)
->willReturn(true);
$this->config
->expects($this->at(2))
->method('getSystemValue')
+ ->with('appstoreenabled', true)
+ ->willReturn(true);
+ $this->config
+ ->expects($this->at(3))
+ ->method('getSystemValue')
->with(
$this->equalTo('version'),
$this->anything()