File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
apps/dav/tests/unit/CalDAV/Security Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -163,4 +163,42 @@ public function testCalendarLimitReached(): void {
163163 $ this ->plugin ->beforeBind ('calendars/foo/cal ' );
164164 }
165165
166+ public function testNoCalendarsSubscriptsLimit (): void {
167+ $ user = $ this ->createMock (IUser::class);
168+ $ this ->userManager ->expects (self ::once ())
169+ ->method ('get ' )
170+ ->with ($ this ->userId )
171+ ->willReturn ($ user );
172+ $ user ->method ('getUID ' )->willReturn ('user123 ' );
173+ $ this ->config
174+ ->method ('getAppValue ' )
175+ ->with ('dav ' )
176+ ->willReturnCallback (function ($ app , $ key , $ default ) {
177+ switch ($ key ) {
178+ case 'maximumCalendarsSubscriptions ' :
179+ return -1 ;
180+ default :
181+ return $ default ;
182+ }
183+ });
184+ $ this ->limiter ->expects (self ::once ())
185+ ->method ('registerUserRequest ' )
186+ ->with (
187+ 'caldav-create-calendar ' ,
188+ 10 ,
189+ 3600 ,
190+ $ user ,
191+ );
192+ $ this ->caldavBackend ->expects (self ::never ())
193+ ->method ('getCalendarsForUserCount ' )
194+ ->with ('principals/users/user123 ' )
195+ ->willReturn (27 );
196+ $ this ->caldavBackend ->expects (self ::never ())
197+ ->method ('getSubscriptionsForUserCount ' )
198+ ->with ('principals/users/user123 ' )
199+ ->willReturn (3 );
200+
201+ $ this ->plugin ->beforeBind ('calendars/foo/cal ' );
202+ }
203+
166204}
You can’t perform that action at this time.
0 commit comments