|
29 | 29 | use OC\Files\View; |
30 | 30 | use OCP\Constants; |
31 | 31 | use OCP\Files\Cache\ICacheEntry; |
| 32 | +use OCP\Files\Config\ICachedMountInfo; |
32 | 33 | use OCP\Files\InvalidPathException; |
33 | 34 | use OCP\Files\IRootFolder; |
34 | 35 | use OCP\Files\Mount\IMountPoint; |
@@ -538,8 +539,8 @@ public function testGetById(): void { |
538 | 539 | ->with('/bar/foo') |
539 | 540 | ->willReturn([]); |
540 | 541 |
|
541 | | - $manager->method('getMountsByMountProvider') |
542 | | - ->willReturn([$mount]); |
| 542 | + $manager->method('getMountFromMountInfo') |
| 543 | + ->willReturn($mount); |
543 | 544 |
|
544 | 545 | $node = new Folder($root, $view, '/bar/foo'); |
545 | 546 | $result = $node->getById(1); |
@@ -583,8 +584,8 @@ public function testGetByIdMountRoot(): void { |
583 | 584 | ->with(1) |
584 | 585 | ->willReturn($fileInfo); |
585 | 586 |
|
586 | | - $manager->method('getMountsByMountProvider') |
587 | | - ->willReturn([$mount]); |
| 587 | + $manager->method('getMountFromMountInfo') |
| 588 | + ->willReturn($mount); |
588 | 589 |
|
589 | 590 | $node = new Folder($root, $view, '/bar'); |
590 | 591 | $result = $node->getById(1); |
@@ -628,8 +629,8 @@ public function testGetByIdOutsideFolder(): void { |
628 | 629 | ->with(1) |
629 | 630 | ->willReturn($fileInfo); |
630 | 631 |
|
631 | | - $manager->method('getMountsByMountProvider') |
632 | | - ->willReturn([$mount]); |
| 632 | + $manager->method('getMountFromMountInfo') |
| 633 | + ->willReturn($mount); |
633 | 634 |
|
634 | 635 | $node = new Folder($root, $view, '/bar/foo'); |
635 | 636 | $result = $node->getById(1); |
@@ -668,14 +669,31 @@ public function testGetByIdMultipleStorages(): void { |
668 | 669 | 1, |
669 | 670 | '' |
670 | 671 | ), |
| 672 | + new CachedMountInfo( |
| 673 | + $this->user, |
| 674 | + 1, |
| 675 | + 0, |
| 676 | + '/bar/foo/asd/', |
| 677 | + 'test', |
| 678 | + 1, |
| 679 | + '' |
| 680 | + ), |
671 | 681 | ]); |
672 | 682 |
|
673 | 683 | $cache->method('get') |
674 | 684 | ->with(1) |
675 | 685 | ->willReturn($fileInfo); |
676 | 686 |
|
677 | | - $manager->method('getMountsByMountProvider') |
678 | | - ->willReturn([$mount1, $mount2]); |
| 687 | + $manager->method('getMountFromMountInfo') |
| 688 | + ->willReturnCallback(function (ICachedMountInfo $mountInfo) use ($mount1, $mount2) { |
| 689 | + if ($mountInfo->getMountPoint() === $mount1->getMountPoint()) { |
| 690 | + return $mount1; |
| 691 | + } |
| 692 | + if ($mountInfo->getMountPoint() === $mount2->getMountPoint()) { |
| 693 | + return $mount2; |
| 694 | + } |
| 695 | + return null; |
| 696 | + }); |
679 | 697 |
|
680 | 698 | $node = new Folder($root, $view, '/bar/foo'); |
681 | 699 | $result = $node->getById(1); |
|
0 commit comments