|
31 | 31 | namespace OCA\Files_Sharing\Tests\External; |
32 | 32 |
|
33 | 33 | use OC\Federation\CloudIdManager; |
| 34 | +use OC\Files\SetupManager; |
34 | 35 | use OC\Files\Storage\StorageFactory; |
35 | 36 | use OCA\Files_Sharing\External\Manager; |
36 | 37 | use OCA\Files_Sharing\External\MountProvider; |
37 | 38 | use OCA\Files_Sharing\Tests\TestCase; |
38 | 39 | use OCP\Contacts\IManager; |
| 40 | +use OCP\Diagnostics\IEventLogger; |
39 | 41 | use OCP\EventDispatcher\IEventDispatcher; |
40 | 42 | use OCP\Federation\ICloudFederationFactory; |
41 | 43 | use OCP\Federation\ICloudFederationProviderManager; |
| 44 | +use OCP\Files\Config\IMountProviderCollection; |
| 45 | +use OCP\Files\NotFoundException; |
42 | 46 | use OCP\Http\Client\IClientService; |
43 | 47 | use OCP\Http\Client\IResponse; |
44 | 48 | use OCP\IGroup; |
@@ -102,9 +106,13 @@ protected function setUp(): void { |
102 | 106 | parent::setUp(); |
103 | 107 |
|
104 | 108 | $this->uid = $this->getUniqueID('user'); |
105 | | - $this->createUser($this->uid, ''); |
106 | | - $this->user = \OC::$server->getUserManager()->get($this->uid); |
107 | | - $this->mountManager = new \OC\Files\Mount\Manager(); |
| 109 | + $this->user = $this->createUser($this->uid, ''); |
| 110 | + $this->mountManager = new \OC\Files\Mount\Manager( |
| 111 | + $this->createMock(IEventLogger::class), |
| 112 | + $this->createMock(IMountProviderCollection::class), |
| 113 | + $this->createMock(IUserSession::class), |
| 114 | + $this->createMock(IEventDispatcher::class) |
| 115 | + ); |
108 | 116 | $this->clientService = $this->getMockBuilder(IClientService::class) |
109 | 117 | ->disableOriginalConstructor()->getMock(); |
110 | 118 | $this->cloudFederationProviderManager = $this->createMock(ICloudFederationProviderManager::class); |
@@ -740,12 +748,12 @@ private function assertMount($mountPoint) { |
740 | 748 |
|
741 | 749 | private function assertNotMount($mountPoint) { |
742 | 750 | $mountPoint = rtrim($mountPoint, '/'); |
743 | | - $mount = $this->mountManager->find($this->getFullPath($mountPoint)); |
744 | | - if ($mount) { |
| 751 | + try { |
| 752 | + $mount = $this->mountManager->find($this->getFullPath($mountPoint)); |
745 | 753 | $this->assertInstanceOf('\OCP\Files\Mount\IMountPoint', $mount); |
746 | 754 | $this->assertNotEquals($this->getFullPath($mountPoint), rtrim($mount->getMountPoint(), '/')); |
747 | | - } else { |
748 | | - $this->assertNull($mount); |
| 755 | + } catch (NotFoundException $e) { |
| 756 | + |
749 | 757 | } |
750 | 758 | } |
751 | 759 |
|
|
0 commit comments