Use proper methods for registerBackend

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2017-08-15 10:34:27 +02:00
parent c5c23b30b9
commit 895b9c2309
7 changed files with 8 additions and 21 deletions

View File

@ -81,7 +81,7 @@ class RequestHandlerControllerTest extends TestCase {
parent::setUp(); parent::setUp();
self::loginHelper(self::TEST_FILES_SHARING_API_USER1); self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
\OCP\Share::registerBackend('test', 'Test\Share\Backend'); \OC\Share\Share::registerBackend('test', 'Test\Share\Backend');
$config = $this->getMockBuilder('\OCP\IConfig') $config = $this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();

View File

@ -28,8 +28,8 @@
\OCA\Files_Sharing\Helper::registerHooks(); \OCA\Files_Sharing\Helper::registerHooks();
\OCP\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File'); \OC\Share\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File');
\OCP\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file'); \OC\Share\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file');
$application = new \OCA\Files_Sharing\AppInfo\Application(); $application = new \OCA\Files_Sharing\AppInfo\Application();
$application->registerMountProviders(); $application->registerMountProviders();

View File

@ -156,7 +156,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase {
public function testKeepNonFileShares() { public function testKeepNonFileShares() {
$this->loginAsUser($this->user1); $this->loginAsUser($this->user1);
\OCP\Share::registerBackend('test', 'Test\Share\Backend'); \OC\Share\Share::registerBackend('test', 'Test\Share\Backend');
$this->assertTrue( $this->assertTrue(
\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ), \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ),

View File

@ -52,19 +52,6 @@ namespace OCP;
*/ */
class Share extends \OC\Share\Constants { class Share extends \OC\Share\Constants {
/**
* Register a sharing backend class that implements OCP\Share_Backend for an item type
* @param string $itemType Item type
* @param string $class Backend class
* @param string $collectionOf (optional) Depends on item type
* @param array $supportedFileExtensions (optional) List of supported file extensions if this item type depends on files
* @return boolean true if backend is registered or false if error
* @since 5.0.0
*/
public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null) {
return \OC\Share\Share::registerBackend($itemType, $class, $collectionOf, $supportedFileExtensions);
}
/** /**
* Get the items of item type shared with the current user * Get the items of item type shared with the current user
* @param string $itemType * @param string $itemType

View File

@ -34,8 +34,8 @@ class EtagTest extends \Test\TestCase {
\OC_Hook::clear('OC_Filesystem', 'setup'); \OC_Hook::clear('OC_Filesystem', 'setup');
$application = new \OCA\Files_Sharing\AppInfo\Application(); $application = new \OCA\Files_Sharing\AppInfo\Application();
$application->registerMountProviders(); $application->registerMountProviders();
\OCP\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File'); \OC\Share\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File');
\OCP\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file'); \OC\Share\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file');
$config = \OC::$server->getConfig(); $config = \OC::$server->getConfig();
$this->datadir = $config->getSystemValue('datadirectory'); $this->datadir = $config->getSystemValue('datadirectory');

View File

@ -100,7 +100,7 @@ class ShareTest extends \Test\TestCase {
$this->groupAndUser_group->addUser($this->user2); $this->groupAndUser_group->addUser($this->user2);
$this->groupAndUser_group->addUser($this->user3); $this->groupAndUser_group->addUser($this->user3);
\OCP\Share::registerBackend('test', 'Test\Share\Backend'); \OC\Share\Share::registerBackend('test', 'Test\Share\Backend');
\OC_Hook::clear('OCP\\Share'); \OC_Hook::clear('OCP\\Share');
\OC::registerShareHooks(); \OC::registerShareHooks();
$this->resharing = \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_resharing', 'yes'); $this->resharing = \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_resharing', 'yes');

View File

@ -287,7 +287,7 @@ class TagsTest extends \Test\TestCase {
public function testShareTags() { public function testShareTags() {
$testTag = 'TestTag'; $testTag = 'TestTag';
\OCP\Share::registerBackend('test', 'Test\Share\Backend'); \OC\Share\Share::registerBackend('test', 'Test\Share\Backend');
$tagger = $this->tagMgr->load('test'); $tagger = $this->tagMgr->load('test');
$tagger->tagAs(1, $testTag); $tagger->tagAs(1, $testTag);