aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Share
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-11-02 23:26:49 +0100
committerLukas Reschke <lukas@statuscode.ch>2016-11-02 23:26:49 +0100
commit6920e609c02814d03a5dc83792de12d05f1da854 (patch)
tree03b2e78c3f5ccd670cd22cd5f4c6390dc867fe73 /tests/lib/Share
parent68cebef64ca38ea93bc1006d667726f42d7f9805 (diff)
downloadnextcloud-server-6920e609c02814d03a5dc83792de12d05f1da854.tar.gz
nextcloud-server-6920e609c02814d03a5dc83792de12d05f1da854.zip
Adjust tests and DI for Share.php
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'tests/lib/Share')
-rw-r--r--tests/lib/Share/ShareTest.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php
index 63289529843..d550ba158a9 100644
--- a/tests/lib/Share/ShareTest.php
+++ b/tests/lib/Share/ShareTest.php
@@ -20,6 +20,9 @@
*/
namespace Test\Share;
+use OC\Share\Share;
+use OCP\ILogger;
+use OCP\IUserManager;
/**
* Class Test_Share
@@ -1631,6 +1634,31 @@ class ShareTest extends \Test\TestCase {
$this->assertEquals('Sharing failed, because the user ' . $this->user1 . ' is the original sharer', $e->getMessage());
}
}
+
+ /**
+ * @expectedException \OC\User\NoUserException
+ * @expectedExceptionMessage Backends provided no user object
+ */
+ public function testGetUsersSharingFileWithException() {
+ $userManager = $this->createMock(IUserManager::class);
+ $logger = $this->createMock(ILogger::class);
+ $userManager
+ ->expects($this->once())
+ ->method('get')
+ ->with('test')
+ ->willReturn(null);
+ $logger
+ ->expects($this->once())
+ ->method('error')
+ ->with(
+ 'Backends provided no user object for test',
+ [
+ 'app' => 'files',
+ ]
+ );
+
+ Share::getUsersSharingFile('/my/file/path', 'test', $userManager, $logger);
+ }
}
class DummyShareClass extends \OC\Share\Share {