Skip to content

Commit e0e032f

Browse files
committed
fixup! Add notification for user limit
1 parent 2260c02 commit e0e032f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/private/Support/Subscription/Registry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private function notifyAboutReachedUserLimit() {
224224

225225
$notification->setApp('core')
226226
->setUser($admin->getUID())
227-
->setDateTime(new DateTime())
227+
->setDateTime(new \DateTime())
228228
->setObject('user_limit_reached', '1')
229229
->setSubject('user_limit_reached');
230230
$this->notificationManager->notify($notification);

tests/lib/Support/Subscription/RegistryTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
use OC\Support\Subscription\Registry;
2626
use OCP\IConfig;
27+
use OCP\IGroup;
2728
use OCP\IGroupManager;
2829
use OCP\IServerContainer;
2930
use OCP\IUserManager;
@@ -165,6 +166,13 @@ public function testDelegateIsHardUserLimitReached() {
165166
->method('isHardUserLimitReached')
166167
->willReturn(true);
167168
$this->registry->register($subscription);
169+
$dummyGroup = $this->createMock(IGroup::class);
170+
$dummyGroup->expects($this->once())
171+
->method('getUsers')
172+
->willReturn([]);
173+
$this->groupManager->expects($this->once())
174+
->method('get')
175+
->willReturn($dummyGroup);
168176

169177
$this->assertSame(true, $this->registry->delegateIsHardUserLimitReached());
170178
}
@@ -216,6 +224,16 @@ public function testDelegateIsHardUserLimitReachedWithoutSupportAppAndUserCount(
216224
->method('getBackends')
217225
->willReturn([$dummyBackend]);
218226

227+
if ($expectedResult) {
228+
$dummyGroup = $this->createMock(IGroup::class);
229+
$dummyGroup->expects($this->once())
230+
->method('getUsers')
231+
->willReturn([]);
232+
$this->groupManager->expects($this->once())
233+
->method('get')
234+
->willReturn($dummyGroup);
235+
}
236+
219237
$this->assertSame($expectedResult, $this->registry->delegateIsHardUserLimitReached());
220238
}
221239
}

0 commit comments

Comments
 (0)