Merge pull request #6121 from nextcloud/cleanup-registerBackend

Use proper methods for registerBackend
This commit is contained in:
Morris Jobke 2017-08-15 13:52:49 +02:00 committed by GitHub
commit c5f14ac884
7 changed files with 8 additions and 21 deletions

View File

@ -81,7 +81,7 @@ class RequestHandlerControllerTest extends TestCase {
parent::setUp();
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')
->disableOriginalConstructor()->getMock();

View File

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

View File

@ -156,7 +156,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase {
public function testKeepNonFileShares() {
$this->loginAsUser($this->user1);
\OCP\Share::registerBackend('test', 'Test\Share\Backend');
\OC\Share\Share::registerBackend('test', 'Test\Share\Backend');
$this->assertTrue(
\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 {
/**
* 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
* @param string $itemType

View File

@ -34,8 +34,8 @@ class EtagTest extends \Test\TestCase {
\OC_Hook::clear('OC_Filesystem', 'setup');
$application = new \OCA\Files_Sharing\AppInfo\Application();
$application->registerMountProviders();
\OCP\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File');
\OCP\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file');
\OC\Share\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File');
\OC\Share\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file');
$config = \OC::$server->getConfig();
$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->user3);
\OCP\Share::registerBackend('test', 'Test\Share\Backend');
\OC\Share\Share::registerBackend('test', 'Test\Share\Backend');
\OC_Hook::clear('OCP\\Share');
\OC::registerShareHooks();
$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() {
$testTag = 'TestTag';
\OCP\Share::registerBackend('test', 'Test\Share\Backend');
\OC\Share\Share::registerBackend('test', 'Test\Share\Backend');
$tagger = $this->tagMgr->load('test');
$tagger->tagAs(1, $testTag);