diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-02-01 15:23:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-01 15:23:01 +0100 |
commit | e5d8645f00b35467002b37eaa0c7fbec715b7c1c (patch) | |
tree | 5ae429ccc8a224144c9460bbac197f1af642982e /tests/lib | |
parent | ba03c1a84cee11d5d0ef9b28d79c5df397869c73 (diff) | |
parent | c09ddf6c78cfd29de739d7b639700dab8b15707e (diff) | |
download | nextcloud-server-e5d8645f00b35467002b37eaa0c7fbec715b7c1c.tar.gz nextcloud-server-e5d8645f00b35467002b37eaa0c7fbec715b7c1c.zip |
Merge pull request #13846 from nextcloud/feature/check-if-app-exist-for-group
Check app path for enableAppForGroups
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/App/AppManagerTest.php | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php index bea39d1bc16..67188fae633 100644 --- a/tests/lib/App/AppManagerTest.php +++ b/tests/lib/App/AppManagerTest.php @@ -149,7 +149,23 @@ class AppManagerTest extends TestCase { new Group('group2', array(), null) ); $this->expectClearCache(); - $this->manager->enableAppForGroups('test', $groups); + + /** @var AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */ + $manager = $this->getMockBuilder(AppManager::class) + ->setConstructorArgs([ + $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher + ]) + ->setMethods([ + 'getAppPath', + ]) + ->getMock(); + + $manager->expects($this->exactly(2)) + ->method('getAppPath') + ->with('test') + ->willReturn('apps/test'); + + $manager->enableAppForGroups('test', $groups); $this->assertEquals('["group1","group2"]', $this->appConfig->getValue('test', 'enabled', 'no')); } @@ -183,11 +199,17 @@ class AppManagerTest extends TestCase { $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher ]) ->setMethods([ - 'getAppInfo' + 'getAppPath', + 'getAppInfo', ]) ->getMock(); $manager->expects($this->once()) + ->method('getAppPath') + ->with('test') + ->willReturn(null); + + $manager->expects($this->once()) ->method('getAppInfo') ->with('test') ->willReturn($appInfo); @@ -226,11 +248,17 @@ class AppManagerTest extends TestCase { $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher ]) ->setMethods([ - 'getAppInfo' + 'getAppPath', + 'getAppInfo', ]) ->getMock(); $manager->expects($this->once()) + ->method('getAppPath') + ->with('test') + ->willReturn(null); + + $manager->expects($this->once()) ->method('getAppInfo') ->with('test') ->willReturn([ |