summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-03-20 03:21:02 -0600
committerGitHub <noreply@github.com>2017-03-20 03:21:02 -0600
commitc969d8005e45ed3996577005a3778e6c88c0f6b8 (patch)
treef5710528b4d983f1600b4862c668d3b04a5aa196 /tests/lib
parentea6b3a95ca29b6ea25c2e79079ea914b424d3f9f (diff)
parent20c80cba6f4d5f0d56de0842eb9f93534845df4d (diff)
downloadnextcloud-server-c969d8005e45ed3996577005a3778e6c88c0f6b8.tar.gz
nextcloud-server-c969d8005e45ed3996577005a3778e6c88c0f6b8.zip
Merge pull request #3949 from nextcloud/downstream-27307
Check if app exists before enabling
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/App/ManagerTest.php25
1 files changed, 21 insertions, 4 deletions
diff --git a/tests/lib/App/ManagerTest.php b/tests/lib/App/ManagerTest.php
index e38f72b3d92..8b23168938c 100644
--- a/tests/lib/App/ManagerTest.php
+++ b/tests/lib/App/ManagerTest.php
@@ -116,16 +116,33 @@ class ManagerTest extends TestCase {
public function testEnableApp() {
$this->expectClearCache();
- $this->manager->enableApp('test');
- $this->assertEquals('yes', $this->appConfig->getValue('test', 'enabled', 'no'));
+ // making sure "files_trashbin" is disabled
+ if ($this->manager->isEnabledForUser('files_trashbin')) {
+ $this->manager->disableApp('files_trashbin');
+ }
+ $this->manager->enableApp('files_trashbin');
+ $this->assertEquals('yes', $this->appConfig->getValue('files_trashbin', 'enabled', 'no'));
}
public function testDisableApp() {
$this->expectClearCache();
- $this->manager->disableApp('test');
- $this->assertEquals('no', $this->appConfig->getValue('test', 'enabled', 'no'));
+ $this->manager->disableApp('files_trashbin');
+ $this->assertEquals('no', $this->appConfig->getValue('files_trashbin', 'enabled', 'no'));
}
+ public function testNotEnableIfNotInstalled() {
+ try {
+ $this->manager->enableApp('some_random_name_which_i_hope_is_not_an_app');
+ $this->assertFalse(true, 'If this line is reached the expected exception is not thrown.');
+ } catch (\Exception $e) {
+ // excpetion is expected
+ $this->assertEquals("some_random_name_which_i_hope_is_not_an_app can't be enabled since it is not installed.", $e->getMessage());
+ }
+ $this->assertEquals('no', $this->appConfig->getValue(
+ 'some_random_name_which_i_hope_is_not_an_app', 'enabled', 'no'
+ ));
+ }
+
public function testEnableAppForGroups() {
$groups = array(
new Group('group1', array(), null),