summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-08-15 18:21:04 +0200
committerRobin Appelman <robin@icewind.nl>2023-09-04 14:13:57 +0200
commitfc21ecbd2afb6c0097bcd9a3ce896912e1229ac6 (patch)
tree59e49a6cce54b12b38d04b517255d4acddc01782 /tests
parent8511fb91caa8bd1dcf753fd67141ff4188ae8f64 (diff)
downloadnextcloud-server-fc21ecbd2afb6c0097bcd9a3ce896912e1229ac6.tar.gz
nextcloud-server-fc21ecbd2afb6c0097bcd9a3ce896912e1229ac6.zip
cleanup di for share permissions wrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/ViewTest.php5
-rw-r--r--tests/lib/Share20/ManagerTest.php35
2 files changed, 28 insertions, 12 deletions
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 18a6fca05b0..d8c9331fa45 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -7,6 +7,7 @@
namespace Test\Files;
+use OC\Share20\ShareDisableChecker;
use OCP\Cache\CappedMemoryCache;
use OC\Files\Cache\Watcher;
use OC\Files\Filesystem;
@@ -295,7 +296,7 @@ class ViewTest extends \Test\TestCase {
*/
public function testRemoveSharePermissionWhenSharingDisabledForUser($excludeGroups, $excludeGroupsList, $expectedShareable) {
// Reset sharing disabled for users cache
- self::invokePrivate(\OC::$server->getShareManager(), 'sharingDisabledForUsersCache', [new CappedMemoryCache()]);
+ self::invokePrivate(\OC::$server->get(ShareDisableChecker::class), 'sharingDisabledForUsersCache', [new CappedMemoryCache()]);
$config = \OC::$server->getConfig();
$oldExcludeGroupsFlag = $config->getAppValue('core', 'shareapi_exclude_groups', 'no');
@@ -320,7 +321,7 @@ class ViewTest extends \Test\TestCase {
$config->setAppValue('core', 'shareapi_exclude_groups_list', $oldExcludeGroupsList);
// Reset sharing disabled for users cache
- self::invokePrivate(\OC::$server->getShareManager(), 'sharingDisabledForUsersCache', [new CappedMemoryCache()]);
+ self::invokePrivate(\OC::$server->get(ShareDisableChecker::class), 'sharingDisabledForUsersCache', [new CappedMemoryCache()]);
}
public function testCacheIncompleteFolder() {
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 55d95ea4515..18a55ca996c 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -27,6 +27,7 @@ use OC\Share20\DefaultShareProvider;
use OC\Share20\Exception;
use OC\Share20\Manager;
use OC\Share20\Share;
+use OC\Share20\ShareDisableChecker;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\File;
@@ -110,6 +111,8 @@ class ManagerTest extends \Test\TestCase {
protected $userSession;
/** @var KnownUserService|MockObject */
protected $knownUserService;
+ /** @var ShareDisableChecker|MockObject */
+ protected $shareDisabledChecker;
protected function setUp(): void {
$this->logger = $this->createMock(LoggerInterface::class);
@@ -128,6 +131,8 @@ class ManagerTest extends \Test\TestCase {
$this->userSession = $this->createMock(IUserSession::class);
$this->knownUserService = $this->createMock(KnownUserService::class);
+ $this->shareDisabledChecker = new ShareDisableChecker($this->config, $this->userManager, $this->groupManager);
+
$this->l10nFactory = $this->createMock(IFactory::class);
$this->l = $this->createMock(IL10N::class);
$this->l->method('t')
@@ -159,7 +164,8 @@ class ManagerTest extends \Test\TestCase {
$this->defaults,
$this->dispatcher,
$this->userSession,
- $this->knownUserService
+ $this->knownUserService,
+ $this->shareDisabledChecker
);
$this->defaultProvider = $this->createMock(DefaultShareProvider::class);
@@ -190,7 +196,8 @@ class ManagerTest extends \Test\TestCase {
$this->defaults,
$this->dispatcher,
$this->userSession,
- $this->knownUserService
+ $this->knownUserService,
+ $this->shareDisabledChecker,
]);
}
@@ -2741,7 +2748,8 @@ class ManagerTest extends \Test\TestCase {
$this->defaults,
$this->dispatcher,
$this->userSession,
- $this->knownUserService
+ $this->knownUserService,
+ $this->shareDisabledChecker,
);
$share = $this->createMock(IShare::class);
@@ -2789,7 +2797,8 @@ class ManagerTest extends \Test\TestCase {
$this->defaults,
$this->dispatcher,
$this->userSession,
- $this->knownUserService
+ $this->knownUserService,
+ $this->shareDisabledChecker,
);
$share = $this->createMock(IShare::class);
@@ -2844,7 +2853,8 @@ class ManagerTest extends \Test\TestCase {
$this->defaults,
$this->dispatcher,
$this->userSession,
- $this->knownUserService
+ $this->knownUserService,
+ $this->shareDisabledChecker,
);
$share = $this->createMock(IShare::class);
@@ -4244,7 +4254,8 @@ class ManagerTest extends \Test\TestCase {
$this->defaults,
$this->dispatcher,
$this->userSession,
- $this->knownUserService
+ $this->knownUserService,
+ $this->shareDisabledChecker,
);
$this->assertSame($expected,
$manager->shareProviderExists($shareType)
@@ -4279,7 +4290,8 @@ class ManagerTest extends \Test\TestCase {
$this->defaults,
$this->dispatcher,
$this->userSession,
- $this->knownUserService
+ $this->knownUserService,
+ $this->shareDisabledChecker,
);
$factory->setProvider($this->defaultProvider);
@@ -4345,7 +4357,8 @@ class ManagerTest extends \Test\TestCase {
$this->defaults,
$this->dispatcher,
$this->userSession,
- $this->knownUserService
+ $this->knownUserService,
+ $this->shareDisabledChecker,
);
$factory->setProvider($this->defaultProvider);
@@ -4463,7 +4476,8 @@ class ManagerTest extends \Test\TestCase {
$this->defaults,
$this->dispatcher,
$this->userSession,
- $this->knownUserService
+ $this->knownUserService,
+ $this->shareDisabledChecker,
);
$factory->setProvider($this->defaultProvider);
@@ -4590,7 +4604,8 @@ class ManagerTest extends \Test\TestCase {
$this->defaults,
$this->dispatcher,
$this->userSession,
- $this->knownUserService
+ $this->knownUserService,
+ $this->shareDisabledChecker
);
$factory->setProvider($this->defaultProvider);