mirror of
https://github.com/nextcloud/server.git
synced 2026-06-07 15:53:04 -04:00
fix: remove old test-only methods
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
00c53c9e78
commit
d0ebe36906
3 changed files with 13 additions and 40 deletions
|
|
@ -99,8 +99,8 @@ class UpdaterTest extends TestCase {
|
|||
// check if user2 can see the shared folder
|
||||
$this->assertTrue($view->file_exists($this->folder));
|
||||
|
||||
$foldersShared = \OC\Share\Share::getItemsSharedWith('folder');
|
||||
$this->assertSame(1, count($foldersShared));
|
||||
$foldersShared = $this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, IShare::TYPE_USER);
|
||||
$this->assertCount(1, $foldersShared);
|
||||
|
||||
$view->mkdir('localFolder');
|
||||
$view->file_put_contents('localFolder/localFile.txt', 'local file');
|
||||
|
|
@ -116,8 +116,8 @@ class UpdaterTest extends TestCase {
|
|||
$this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
|
||||
|
||||
// shared folder should be unshared
|
||||
$foldersShared = \OC\Share\Share::getItemsSharedWith('folder');
|
||||
$this->assertTrue(empty($foldersShared));
|
||||
$foldersShared = $this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, IShare::TYPE_USER);
|
||||
$this->assertCount(0, $foldersShared);
|
||||
|
||||
// trashbin should contain the local file but not the mount point
|
||||
$rootView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
|
||||
|
|
|
|||
|
|
@ -93,41 +93,6 @@ class Share extends Constants {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the items of item type shared with the current user
|
||||
*
|
||||
* @param string $itemType
|
||||
* @param int $format (optional) Format type must be defined by the backend
|
||||
* @param mixed $parameters (optional)
|
||||
* @param int $limit Number of items to return (optional) Returns all by default
|
||||
* @param boolean $includeCollections (optional)
|
||||
* @return mixed Return depends on format
|
||||
* @deprecated TESTS ONLY - this methods is only used by tests
|
||||
* called like this:
|
||||
* \OC\Share\Share::getItemsSharedWith('folder'); (apps/files_sharing/tests/UpdaterTest.php)
|
||||
*/
|
||||
public static function getItemsSharedWith() {
|
||||
return self::getItems('folder', null, self::$shareTypeUserAndGroups, \OC_User::getUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the items of item type shared with a user
|
||||
*
|
||||
* @param string $itemType
|
||||
* @param string $user id for which user we want the shares
|
||||
* @param int $format (optional) Format type must be defined by the backend
|
||||
* @param mixed $parameters (optional)
|
||||
* @param int $limit Number of items to return (optional) Returns all by default
|
||||
* @param boolean $includeCollections (optional)
|
||||
* @return mixed Return depends on format
|
||||
* @deprecated TESTS ONLY - this methods is only used by tests
|
||||
* called like this:
|
||||
* \OC\Share\Share::getItemsSharedWithUser('test', $shareWith); (tests/lib/Share/Backend.php)
|
||||
*/
|
||||
public static function getItemsSharedWithUser($itemType, $user) {
|
||||
return self::getItems('test', null, self::$shareTypeUserAndGroups, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item of item type shared with a given user by source
|
||||
*
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@
|
|||
|
||||
namespace Test\Share;
|
||||
|
||||
use OC\Share20\Manager;
|
||||
use OCP\Server;
|
||||
use OCP\Share\IShare;
|
||||
|
||||
class Backend implements \OCP\Share_Backend {
|
||||
public const FORMAT_SOURCE = 0;
|
||||
public const FORMAT_TARGET = 1;
|
||||
|
|
@ -46,7 +50,11 @@ class Backend implements \OCP\Share_Backend {
|
|||
}
|
||||
|
||||
|
||||
$shares = \OC\Share\Share::getItemsSharedWithUser('test', $shareWith);
|
||||
$shareManager = Server::get(Manager::class);
|
||||
$shares = array_merge(
|
||||
$shareManager->getSharedWith($shareWith, IShare::TYPE_USER),
|
||||
$shareManager->getSharedWith($shareWith, IShare::TYPE_GROUP),
|
||||
);
|
||||
|
||||
$knownTargets = [];
|
||||
foreach ($shares as $share) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue