summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-09-13 14:29:57 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-09-26 23:10:24 +0200
commita28b1d91f95f421c6efbb7752d9404c6719c0688 (patch)
tree6a7db1eb763d4ec480e898046971db56d3a23768 /lib
parent4a315ede819b700b6f55fa1c6dc70c60ea728ea4 (diff)
downloadnextcloud-server-a28b1d91f95f421c6efbb7752d9404c6719c0688.tar.gz
nextcloud-server-a28b1d91f95f421c6efbb7752d9404c6719c0688.zip
split off former searchSharee unit test
also moves registering default plugins to Server for proper unit testing Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Collaboration/Collaborators/Search.php9
-rw-r--r--lib/private/Server.php15
2 files changed, 16 insertions, 8 deletions
diff --git a/lib/private/Collaboration/Collaborators/Search.php b/lib/private/Collaboration/Collaborators/Search.php
index 5a17a3fb653..e9b15dd1201 100644
--- a/lib/private/Collaboration/Collaborators/Search.php
+++ b/lib/private/Collaboration/Collaborators/Search.php
@@ -34,12 +34,7 @@ class Search implements ISearch {
/** @var IContainer */
private $c;
- protected $pluginList = [
- Share::SHARE_TYPE_USER => [UserPlugin::class],
- Share::SHARE_TYPE_GROUP => [GroupPlugin::class],
- Share::SHARE_TYPE_EMAIL => [MailPlugin::class],
- Share::SHARE_TYPE_REMOTE => [RemotePlugin::class],
- ];
+ protected $pluginList = [];
public function __construct(IContainer $c) {
$this->c = $c;
@@ -81,7 +76,7 @@ class Search implements ISearch {
$searchResult->unsetResult($emailType);
}
- return [$searchResult->asArray(), $hasMoreResults];
+ return [$searchResult->asArray(), (bool)$hasMoreResults];
}
public function registerPlugin(array $pluginInfo) {
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 88fc79e472e..29aee06d896 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -52,6 +52,10 @@ use OC\AppFramework\Http\Request;
use OC\AppFramework\Utility\SimpleContainer;
use OC\AppFramework\Utility\TimeFactory;
use OC\Authentication\LoginCredentials\Store;
+use OC\Collaboration\Collaborators\GroupPlugin;
+use OC\Collaboration\Collaborators\MailPlugin;
+use OC\Collaboration\Collaborators\RemotePlugin;
+use OC\Collaboration\Collaborators\UserPlugin;
use OC\Command\CronBus;
use OC\Contacts\ContactsMenu\ActionFactory;
use OC\Diagnostics\EventLogger;
@@ -115,6 +119,7 @@ use OCP\Contacts\ContactsMenu\IActionFactory;
use OCP\Lock\ILockingProvider;
use OCP\RichObjectStrings\IValidator;
use OCP\Security\IContentSecurityPolicyManager;
+use OCP\Share;
use OCP\Share\IShareHelper;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -994,7 +999,15 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerAlias('ShareManager', \OCP\Share\IManager::class);
$this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) {
- return new Collaboration\Collaborators\Search($c);
+ $instance = new Collaboration\Collaborators\Search($c);
+
+ // register default plugins
+ $instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]);
+ $instance->registerPlugin(['shareType' => 'SHARE_TYPE_GROUP', 'class' => GroupPlugin::class]);
+ $instance->registerPlugin(['shareType' => 'SHARE_TYPE_EMAIL', 'class' => MailPlugin::class]);
+ $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE', 'class' => RemotePlugin::class]);
+
+ return $instance;
});
$this->registerAlias('CollaboratorSearch', \OCP\Collaboration\Collaborators\ISearch::class);