Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/private/App/AppStore/Fetcher/Fetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ protected function fetch($ETag, $content) {
*/
public function get() {
$appstoreenabled = $this->config->getSystemValue('appstoreenabled', true);
$internetavailable = $this->config->getSystemValue('has_internet_connection', true);

if (!$appstoreenabled) {
if (!$appstoreenabled || !$internetavailable) {
return [];
}

Expand Down
26 changes: 23 additions & 3 deletions tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1945,10 +1945,30 @@ public function testGetWithFilter() {

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');
Expand Down
24 changes: 21 additions & 3 deletions tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,33 @@ public function setUp() {

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());
}
}
26 changes: 23 additions & 3 deletions tests/lib/App/AppStore/Fetcher/FetcherBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion() {
$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()
Expand Down Expand Up @@ -121,11 +126,16 @@ public function testGetWithNotExistingFileAndUpToDateTimestampAndVersion() {
$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()
Expand Down Expand Up @@ -277,11 +287,16 @@ public function testGetWithAlreadyExistingFileAndNoVersion() {
$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()
Expand Down Expand Up @@ -356,11 +371,16 @@ public function testGetWithAlreadyExistingFileAndOutdatedVersion() {
$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()
Expand Down