Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-12-02 12:07:34 +0300
committerMorris Jobke <hey@morrisjobke.de>2020-12-02 17:20:03 +0300
commitc0a05c0412e11fd80adc2059b28c8963ba4252dc (patch)
treea2d9542e302c7bae3e6c148de96e101cb7e69749 /tests/lib/Support
parentd87705a8941511a4e3bf8f6c97d6e0f36a42799e (diff)
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.php32
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());
}
}