diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-12-02 10:07:34 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-12-02 15:20:03 +0100 |
commit | c0a05c0412e11fd80adc2059b28c8963ba4252dc (patch) | |
tree | a2d9542e302c7bae3e6c148de96e101cb7e69749 /tests/lib/Support | |
parent | d87705a8941511a4e3bf8f6c97d6e0f36a42799e (diff) | |
download | nextcloud-server-c0a05c0412e11fd80adc2059b28c8963ba4252dc.tar.gz nextcloud-server-c0a05c0412e11fd80adc2059b28c8963ba4252dc.zip |
Add notification for user limit
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests/lib/Support')
-rw-r--r-- | tests/lib/Support/Subscription/RegistryTest.php | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/lib/Support/Subscription/RegistryTest.php b/tests/lib/Support/Subscription/RegistryTest.php index 58995afcab8..95759e09547 100644 --- a/tests/lib/Support/Subscription/RegistryTest.php +++ b/tests/lib/Support/Subscription/RegistryTest.php @@ -24,8 +24,11 @@ namespace Test\Support\Subscription; use OC\Support\Subscription\Registry; use OCP\IConfig; +use OCP\IGroup; +use OCP\IGroupManager; use OCP\IServerContainer; use OCP\IUserManager; +use OCP\Notification\IManager; use OCP\Support\Subscription\ISubscription; use OCP\Support\Subscription\ISupportedApps; use PHPUnit\Framework\MockObject\MockObject; @@ -46,21 +49,31 @@ class RegistryTest extends TestCase { /** @var MockObject|IUserManager */ private $userManager; + /** @var MockObject|IGroupManager */ + private $groupManager; + /** @var MockObject|LoggerInterface */ private $logger; + /** @var MockObject|IManager */ + private $notificationManager; + protected function setUp(): void { parent::setUp(); $this->config = $this->createMock(IConfig::class); $this->serverContainer = $this->createMock(IServerContainer::class); $this->userManager = $this->createMock(IUserManager::class); + $this->groupManager = $this->createMock(IGroupManager::class); $this->logger = $this->createMock(LoggerInterface::class); + $this->notificationManager = $this->createMock(IManager::class); $this->registry = new Registry( $this->config, $this->serverContainer, $this->userManager, - $this->logger + $this->groupManager, + $this->logger, + $this->notificationManager ); } @@ -153,6 +166,13 @@ class RegistryTest extends TestCase { ->method('isHardUserLimitReached') ->willReturn(true); $this->registry->register($subscription); + $dummyGroup = $this->createMock(IGroup::class); + $dummyGroup->expects($this->once()) + ->method('getUsers') + ->willReturn([]); + $this->groupManager->expects($this->once()) + ->method('get') + ->willReturn($dummyGroup); $this->assertSame(true, $this->registry->delegateIsHardUserLimitReached()); } @@ -204,6 +224,16 @@ class RegistryTest extends TestCase { ->method('getBackends') ->willReturn([$dummyBackend]); + if ($expectedResult) { + $dummyGroup = $this->createMock(IGroup::class); + $dummyGroup->expects($this->once()) + ->method('getUsers') + ->willReturn([]); + $this->groupManager->expects($this->once()) + ->method('get') + ->willReturn($dummyGroup); + } + $this->assertSame($expectedResult, $this->registry->delegateIsHardUserLimitReached()); } } |