summaryrefslogtreecommitdiffstats
path: root/tests
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
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')
-rw-r--r--tests/lib/Files/FilesystemTest.php2
-rw-r--r--tests/lib/Share/ShareTest.php28
-rw-r--r--tests/lib/TestCase.php3
3 files changed, 28 insertions, 5 deletions
diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php
index 04eafc99f36..dd4785ecf09 100644
--- a/tests/lib/Files/FilesystemTest.php
+++ b/tests/lib/Files/FilesystemTest.php
@@ -79,7 +79,6 @@ class FilesystemTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- \OC_User::clearBackends();
$userBackend = new \Test\Util\User\Dummy();
$userBackend->createUser(self::TEST_FILESYSTEM_USER1, self::TEST_FILESYSTEM_USER1);
$userBackend->createUser(self::TEST_FILESYSTEM_USER2, self::TEST_FILESYSTEM_USER2);
@@ -94,7 +93,6 @@ class FilesystemTest extends \Test\TestCase {
$this->logout();
$this->invokePrivate('\OC\Files\Filesystem', 'normalizedPathCache', [null]);
- \OC_User::clearBackends();
parent::tearDown();
}
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 {
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index 1ca896e0914..61372d4ae90 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -273,9 +273,6 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
self::tearDownAfterClassCleanStrayHooks();
self::tearDownAfterClassCleanStrayLocks();
- \OC_User::clearBackends();
- \OC_User::useBackend('dummy');
-
parent::tearDownAfterClass();
}