3434use OCA \DAV \Connector \Sabre \Directory ;
3535use OCP \Files \ForbiddenException ;
3636use OCP \Files \Mount \IMountPoint ;
37+ use Test \Traits \UserTrait ;
3738
3839class TestViewDirectory extends \OC \Files \View {
3940 private $ updatables ;
@@ -73,6 +74,8 @@ public function getRelativePath($path) {
7374 */
7475class DirectoryTest extends \Test \TestCase {
7576
77+ use UserTrait;
78+
7679 /** @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject */
7780 private $ view ;
7881 /** @var \OC\Files\FileInfo | \PHPUnit\Framework\MockObject\MockObject */
@@ -274,6 +277,8 @@ public function testGetChildThrowInvalidPath() {
274277 }
275278
276279 public function testGetQuotaInfoUnlimited () {
280+ self ::createUser ('user ' , 'password ' );
281+ self ::loginAsUser ('user ' );
277282 $ mountPoint = $ this ->createMock (IMountPoint::class);
278283 $ storage = $ this ->getMockBuilder (Quota::class)
279284 ->disableOriginalConstructor ()
@@ -288,6 +293,10 @@ public function testGetQuotaInfoUnlimited() {
288293 '\OC\Files\Storage\Wrapper\Quota ' => false ,
289294 ]);
290295
296+ $ storage ->expects ($ this ->once ())
297+ ->method ('getOwner ' )
298+ ->willReturn ('user ' );
299+
291300 $ storage ->expects ($ this ->never ())
292301 ->method ('getQuota ' );
293302
@@ -311,6 +320,8 @@ public function testGetQuotaInfoUnlimited() {
311320 }
312321
313322 public function testGetQuotaInfoSpecific () {
323+ self ::createUser ('user ' , 'password ' );
324+ self ::loginAsUser ('user ' );
314325 $ mountPoint = $ this ->createMock (IMountPoint::class);
315326 $ storage = $ this ->getMockBuilder (Quota::class)
316327 ->disableOriginalConstructor ()
@@ -325,6 +336,10 @@ public function testGetQuotaInfoSpecific() {
325336 ['\OC\Files\Storage\Wrapper\Quota ' , true ],
326337 ]);
327338
339+ $ storage ->expects ($ this ->once ())
340+ ->method ('getOwner ' )
341+ ->willReturn ('user ' );
342+
328343 $ storage ->expects ($ this ->once ())
329344 ->method ('getQuota ' )
330345 ->willReturn (1000 );
0 commit comments