diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-03-23 15:26:43 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-23 15:26:43 -0600 |
commit | a5a29ee27a8e93d83f8916f4f0a7857c880e1156 (patch) | |
tree | 6c03bda82649bf14e63b61a80dc44e1b1cf340a0 /apps/files_sharing/tests | |
parent | b59f6dcca4f50de1091ff169135e025ba7f0b49e (diff) | |
parent | a12ec5ec77e0025157af8d9e1401f0f2a43a5c3a (diff) | |
download | nextcloud-server-a5a29ee27a8e93d83f8916f4f0a7857c880e1156.tar.gz nextcloud-server-a5a29ee27a8e93d83f8916f4f0a7857c880e1156.zip |
Merge pull request #3953 from nextcloud/downstream-27027
Ignore NoUserException for shares from ghosts
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r-- | apps/files_sharing/tests/SharedStorageTest.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index eaa138b0f70..7d007cb6414 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -28,6 +28,11 @@ namespace OCA\Files_Sharing\Tests; +use OCA\Files_Sharing\SharedStorage; +use OCP\Share\IShare; +use OC\Files\View; +use OCP\Files\NotFoundException; + /** * Class SharedStorageTest * @@ -559,4 +564,37 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } + + public function testInitWithNonExistingUser() { + $share = $this->createMock(IShare::class); + $share->method('getShareOwner')->willReturn('unexist'); + $ownerView = $this->createMock(View::class); + $storage = new SharedStorage([ + 'ownerView' => $ownerView, + 'superShare' => $share, + 'groupedShares' => [$share], + 'user' => 'user1', + ]); + + // trigger init + $this->assertInstanceOf(\OC\Files\Storage\FailedStorage::class, $storage->getSourceStorage()); + $this->assertInstanceOf(\OC\Files\Cache\FailedCache::class, $storage->getCache()); + } + + public function testInitWithNotFoundSource() { + $share = $this->createMock(IShare::class); + $share->method('getShareOwner')->willReturn(self::TEST_FILES_SHARING_API_USER1); + $ownerView = $this->createMock(View::class); + $ownerView->method('getPath')->will($this->throwException(new NotFoundException())); + $storage = new SharedStorage([ + 'ownerView' => $ownerView, + 'superShare' => $share, + 'groupedShares' => [$share], + 'user' => 'user1', + ]); + + // trigger init + $this->assertInstanceOf(\OC\Files\Storage\FailedStorage::class, $storage->getSourceStorage()); + $this->assertInstanceOf(\OC\Files\Cache\FailedCache::class, $storage->getCache()); + } } |