File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
lib/private/Support/Subscription
tests/lib/Support/Subscription Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff 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 );
Original file line number Diff line number Diff line change 2424
2525use OC \Support \Subscription \Registry ;
2626use OCP \IConfig ;
27+ use OCP \IGroup ;
2728use OCP \IGroupManager ;
2829use OCP \IServerContainer ;
2930use 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}
You can’t perform that action at this time.
0 commit comments