diff options
author | Joas Schilling <coding@schilljs.com> | 2018-02-23 09:06:43 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2018-02-23 09:06:43 +0100 |
commit | 69c88ad075c5d4ab32fd54a30d995014790cb7d6 (patch) | |
tree | ca11d4e92dd9c865aedaf9ac19b322acf189c598 /apps/updatenotification/tests | |
parent | 47af421e804fbf9be1d7569e8576aceaaed8f46b (diff) | |
download | nextcloud-server-69c88ad075c5d4ab32fd54a30d995014790cb7d6.tar.gz nextcloud-server-69c88ad075c5d4ab32fd54a30d995014790cb7d6.zip |
Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/updatenotification/tests')
-rw-r--r-- | apps/updatenotification/tests/Settings/AdminTest.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/apps/updatenotification/tests/Settings/AdminTest.php b/apps/updatenotification/tests/Settings/AdminTest.php index c5e969dbe14..440e26cfd33 100644 --- a/apps/updatenotification/tests/Settings/AdminTest.php +++ b/apps/updatenotification/tests/Settings/AdminTest.php @@ -30,6 +30,8 @@ use OCA\UpdateNotification\UpdateChecker; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\IDateTimeFormatter; +use OCP\IGroup; +use OCP\IGroupManager; use OCP\Util; use Test\TestCase; @@ -40,6 +42,8 @@ class AdminTest extends TestCase { private $config; /** @var UpdateChecker|\PHPUnit_Framework_MockObject_MockObject */ private $updateChecker; + /** @var IGroupManager|\PHPUnit_Framework_MockObject_MockObject */ + private $groupManager; /** @var IDateTimeFormatter|\PHPUnit_Framework_MockObject_MockObject */ private $dateTimeFormatter; @@ -48,11 +52,13 @@ class AdminTest extends TestCase { $this->config = $this->createMock(IConfig::class); $this->updateChecker = $this->createMock(UpdateChecker::class); + $this->groupManager = $this->createMock(IGroupManager::class); $this->dateTimeFormatter = $this->createMock(IDateTimeFormatter::class); $this->admin = new Admin( $this->config, $this->updateChecker, + $this->groupManager, $this->dateTimeFormatter ); } @@ -96,6 +102,18 @@ class AdminTest extends TestCase { 'updaterEnabled' => true, ]); + $group = $this->createMock(IGroup::class); + $group->expects($this->any()) + ->method('getDisplayName') + ->willReturn('Administrators'); + $group->expects($this->any()) + ->method('getGID') + ->willReturn('admin'); + $this->groupManager->expects($this->once()) + ->method('get') + ->with('admin') + ->willReturn($group); + $params = [ 'json' => json_encode([ 'isNewVersionAvailable' => true, @@ -108,7 +126,9 @@ class AdminTest extends TestCase { 'updaterEnabled' => true, 'isDefaultUpdateServerURL' => true, 'updateServerURL' => 'https://updates.nextcloud.com/updater_server/', - 'notify_groups' => 'admin', + 'notifyGroups' => [ + ['value' => 'admin', 'label' => 'Administrators'], + ], ]), ]; |