blob: b7dbf6eccd89541febfd04f6e1172466b1b6ca8f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Test\App\AppStore\Fetcher;
use OC\App\AppStore\Fetcher\CategoryFetcher;
class CategoryFetcherTest extends FetcherBase {
protected function setUp(): void {
parent::setUp();
$this->fileName = 'categories.json';
$this->endpoint = 'https://apps.nextcloud.com/api/v1/categories.json';
$this->fetcher = new CategoryFetcher(
$this->appDataFactory,
$this->clientService,
$this->timeFactory,
$this->config,
$this->logger,
$this->registry
);
}
public function testAppstoreDisabled() {
$this->config
->method('getSystemValueBool')
->willReturnCallback(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('getSystemValueBool')
->willReturnCallback(function ($var, $default) {
if ($var === 'has_internet_connection') {
return false;
}
return $default;
});
$this->config
->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
return $default;
});
$this->appData
->expects($this->never())
->method('getFolder');
$this->assertEquals([], $this->fetcher->get());
}
}
|