summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-12-02 14:35:38 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-12-02 14:35:38 +0100
commit0a6db3ada6b35b59db86d1950681724fdc627b5c (patch)
tree035e936bebd53a4cce4a7879545d150b6da06826 /tests
parent8d218bf3ef842d76c2b97a175b28e13054497952 (diff)
downloadnextcloud-server-0a6db3ada6b35b59db86d1950681724fdc627b5c.tar.gz
nextcloud-server-0a6db3ada6b35b59db86d1950681724fdc627b5c.zip
Remove OC_Config from app management template
* add unit test for this case
Diffstat (limited to 'tests')
-rw-r--r--tests/settings/controller/AppSettingsControllerTest.php42
1 files changed, 38 insertions, 4 deletions
diff --git a/tests/settings/controller/AppSettingsControllerTest.php b/tests/settings/controller/AppSettingsControllerTest.php
index 09595d05661..dba5728ca4b 100644
--- a/tests/settings/controller/AppSettingsControllerTest.php
+++ b/tests/settings/controller/AppSettingsControllerTest.php
@@ -220,9 +220,14 @@ class AppSettingsControllerTest extends TestCase {
public function testViewApps() {
$this->config
- ->expects($this->once())
+ ->expects($this->at(0))
->method('getSystemValue')
->with('appstore.experimental.enabled', false);
+ $this->config
+ ->expects($this->at(1))
+ ->method('getSystemValue')
+ ->with('appstoreenabled', true)
+ ->will($this->returnValue(true));
$this->navigationManager
->expects($this->once())
->method('setActiveEntry')
@@ -231,7 +236,7 @@ class AppSettingsControllerTest extends TestCase {
$policy = new ContentSecurityPolicy();
$policy->addAllowedImageDomain('https://apps.owncloud.com');
- $expected = new TemplateResponse('settings', 'apps', ['experimentalEnabled' => false, 'category' => 'enabled'], 'user');
+ $expected = new TemplateResponse('settings', 'apps', ['experimentalEnabled' => false, 'category' => 'enabled', 'appstoreEnabled' => true], 'user');
$expected->setContentSecurityPolicy($policy);
$this->assertEquals($expected, $this->appSettingsController->viewApps());
@@ -239,9 +244,14 @@ class AppSettingsControllerTest extends TestCase {
public function testViewAppsNotEnabled() {
$this->config
- ->expects($this->once())
+ ->expects($this->at(0))
->method('getSystemValue')
->with('appstore.experimental.enabled', false);
+ $this->config
+ ->expects($this->at(1))
+ ->method('getSystemValue')
+ ->with('appstoreenabled', true)
+ ->will($this->returnValue(true));
$this->navigationManager
->expects($this->once())
->method('setActiveEntry')
@@ -250,9 +260,33 @@ class AppSettingsControllerTest extends TestCase {
$policy = new ContentSecurityPolicy();
$policy->addAllowedImageDomain('https://apps.owncloud.com');
- $expected = new TemplateResponse('settings', 'apps', ['experimentalEnabled' => false, 'category' => 'disabled'], 'user');
+ $expected = new TemplateResponse('settings', 'apps', ['experimentalEnabled' => false, 'category' => 'disabled', 'appstoreEnabled' => true], 'user');
$expected->setContentSecurityPolicy($policy);
$this->assertEquals($expected, $this->appSettingsController->viewApps('disabled'));
}
+
+ public function testViewAppsAppstoreNotEnabled() {
+ $this->config
+ ->expects($this->at(0))
+ ->method('getSystemValue')
+ ->with('appstore.experimental.enabled', false);
+ $this->config
+ ->expects($this->at(1))
+ ->method('getSystemValue')
+ ->with('appstoreenabled', true)
+ ->will($this->returnValue(false));
+ $this->navigationManager
+ ->expects($this->once())
+ ->method('setActiveEntry')
+ ->with('core_apps');
+
+ $policy = new ContentSecurityPolicy();
+ $policy->addAllowedImageDomain('https://apps.owncloud.com');
+
+ $expected = new TemplateResponse('settings', 'apps', ['experimentalEnabled' => false, 'category' => 'enabled', 'appstoreEnabled' => false], 'user');
+ $expected->setContentSecurityPolicy($policy);
+
+ $this->assertEquals($expected, $this->appSettingsController->viewApps());
+ }
}