Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-06-06 19:05:04 +0300
committerGitHub <noreply@github.com>2018-06-06 19:05:04 +0300
commitb49f8e43bd9077ec79547a67a09e33981713b697 (patch)
treebdece8f300cb15157ee6c4ca143836aa18517f0b /tests
parent55d0f355766da0896882268db8b291ada2bbd2b9 (diff)
parentbf03d43c2f65feffe96c60000a4d127411080762 (diff)
Merge pull request #9565 from nextcloud/feature/noid/app-settings
Migrate apps management to Vue.js
Diffstat (limited to 'tests')
-rw-r--r--tests/Settings/Controller/AppSettingsControllerTest.php63
1 files changed, 28 insertions, 35 deletions
diff --git a/tests/Settings/Controller/AppSettingsControllerTest.php b/tests/Settings/Controller/AppSettingsControllerTest.php
index 2f916b89707..14f2c8f47bd 100644
--- a/tests/Settings/Controller/AppSettingsControllerTest.php
+++ b/tests/Settings/Controller/AppSettingsControllerTest.php
@@ -30,6 +30,7 @@ use OC\Settings\Controller\AppSettingsController;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
use Test\TestCase;
@@ -69,6 +70,8 @@ class AppSettingsControllerTest extends TestCase {
private $installer;
/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
private $urlGenerator;
+ /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ private $logger;
public function setUp() {
parent::setUp();
@@ -87,6 +90,7 @@ class AppSettingsControllerTest extends TestCase {
$this->bundleFetcher = $this->createMock(BundleFetcher::class);
$this->installer = $this->createMock(Installer::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
+ $this->logger = $this->createMock(ILogger::class);
$this->appSettingsController = new AppSettingsController(
'settings',
@@ -100,7 +104,8 @@ class AppSettingsControllerTest extends TestCase {
$this->l10nFactory,
$this->bundleFetcher,
$this->installer,
- $this->urlGenerator
+ $this->urlGenerator,
+ $this->logger
);
}
@@ -110,32 +115,6 @@ class AppSettingsControllerTest extends TestCase {
->willReturn(false);
$expected = new JSONResponse([
[
- 'id' => 2,
- 'ident' => 'installed',
- 'displayName' => 'Your apps',
- ],
- [
- 'id' => 4,
- 'ident' => 'updates',
- 'displayName' => 'Updates',
- 'counter' => 0,
- ],
- [
- 'id' => 0,
- 'ident' => 'enabled',
- 'displayName' => 'Enabled apps',
- ],
- [
- 'id' => 1,
- 'ident' => 'disabled',
- 'displayName' => 'Disabled apps',
- ],
- [
- 'id' => 3,
- 'ident' => 'app-bundles',
- 'displayName' => 'App bundles',
- ],
- [
'id' => 'auth',
'ident' => 'auth',
'displayName' => 'Authentication & authorization',
@@ -196,6 +175,10 @@ class AppSettingsControllerTest extends TestCase {
}
public function testViewApps() {
+ $this->bundleFetcher->expects($this->once())->method('getBundles')->willReturn([]);
+ $this->installer->expects($this->any())
+ ->method('isUpdateAvailable')
+ ->willReturn(false);
$this->config
->expects($this->once())
->method('getSystemValue')
@@ -210,11 +193,14 @@ class AppSettingsControllerTest extends TestCase {
$policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com');
$expected = new TemplateResponse('settings',
- 'apps',
+ 'settings',
[
- 'category' => 'installed',
- 'appstoreEnabled' => true,
- 'urlGenerator' => $this->urlGenerator,
+ 'serverData' => [
+ 'updateCount' => 0,
+ 'appstoreEnabled' => true,
+ 'bundles' => [],
+ 'developerDocumentation' => ''
+ ]
],
'user');
$expected->setContentSecurityPolicy($policy);
@@ -223,6 +209,10 @@ class AppSettingsControllerTest extends TestCase {
}
public function testViewAppsAppstoreNotEnabled() {
+ $this->installer->expects($this->any())
+ ->method('isUpdateAvailable')
+ ->willReturn(false);
+ $this->bundleFetcher->expects($this->once())->method('getBundles')->willReturn([]);
$this->config
->expects($this->once())
->method('getSystemValue')
@@ -237,11 +227,14 @@ class AppSettingsControllerTest extends TestCase {
$policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com');
$expected = new TemplateResponse('settings',
- 'apps',
+ 'settings',
[
- 'category' => 'installed',
- 'appstoreEnabled' => false,
- 'urlGenerator' => $this->urlGenerator,
+ 'serverData' => [
+ 'updateCount' => 0,
+ 'appstoreEnabled' => false,
+ 'bundles' => [],
+ 'developerDocumentation' => ''
+ ]
],
'user');
$expected->setContentSecurityPolicy($policy);