summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-08-15 16:24:56 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-08-15 16:25:34 +0200
commit8a7a0f328746230dd896ccc53b3ada271a91b930 (patch)
treeaaaaedf7167b74c48a91c90671f705edb71bc541 /lib
parent75a73a5a7301f203a962a17f6b2b8b90078c1884 (diff)
downloadnextcloud-server-8a7a0f328746230dd896ccc53b3ada271a91b930.tar.gz
nextcloud-server-8a7a0f328746230dd896ccc53b3ada271a91b930.zip
Add unit tests
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Settings/Admin/Additional.php4
-rw-r--r--lib/private/Settings/Admin/Encryption.php4
-rw-r--r--lib/private/Settings/Admin/Logging.php3
-rw-r--r--lib/private/Settings/Admin/Server.php15
-rw-r--r--lib/private/Settings/Admin/Sharing.php8
-rw-r--r--lib/private/Settings/Admin/TipsTricks.php3
-rw-r--r--lib/private/Settings/Manager.php36
-rw-r--r--lib/private/Settings/Section.php10
8 files changed, 57 insertions, 26 deletions
diff --git a/lib/private/Settings/Admin/Additional.php b/lib/private/Settings/Admin/Additional.php
index 106f0f65b8a..d133e4737a7 100644
--- a/lib/private/Settings/Admin/Additional.php
+++ b/lib/private/Settings/Admin/Additional.php
@@ -36,10 +36,12 @@ use OCP\Lock\ILockingProvider;
use OCP\Settings\ISettings;
class Additional implements ISettings {
-
/** @var IConfig */
private $config;
+ /**
+ * @param IConfig $config
+ */
public function __construct(IConfig $config) {
$this->config = $config;
}
diff --git a/lib/private/Settings/Admin/Encryption.php b/lib/private/Settings/Admin/Encryption.php
index ceae5aa6d3f..69c6bd17f03 100644
--- a/lib/private/Settings/Admin/Encryption.php
+++ b/lib/private/Settings/Admin/Encryption.php
@@ -35,6 +35,10 @@ class Encryption implements ISettings {
/** @var IUserManager */
private $userManager;
+ /**
+ * @param Manager $manager
+ * @param IUserManager $userManager
+ */
public function __construct(Manager $manager, IUserManager $userManager) {
$this->manager = $manager;
$this->userManager = $userManager;
diff --git a/lib/private/Settings/Admin/Logging.php b/lib/private/Settings/Admin/Logging.php
index 3097070577d..407248ac4b1 100644
--- a/lib/private/Settings/Admin/Logging.php
+++ b/lib/private/Settings/Admin/Logging.php
@@ -32,6 +32,9 @@ class Logging implements ISettings {
/** @var IConfig */
private $config;
+ /**
+ * @param IConfig $config
+ */
public function __construct(IConfig $config) {
$this->config = $config;
}
diff --git a/lib/private/Settings/Admin/Server.php b/lib/private/Settings/Admin/Server.php
index 20c3a6d7557..6b381ab48ed 100644
--- a/lib/private/Settings/Admin/Server.php
+++ b/lib/private/Settings/Admin/Server.php
@@ -36,20 +36,25 @@ use OCP\Lock\ILockingProvider;
use OCP\Settings\ISettings;
class Server implements ISettings {
-
/** @var IDBConnection|Connection */
private $db;
-
/** @var IConfig */
private $config;
-
/** @var ILockingProvider */
private $lockingProvider;
-
/** @var IL10N */
private $l;
- public function __construct(IDBConnection $db, IConfig $config, ILockingProvider $lockingProvider, IL10N $l) {
+ /**
+ * @param IDBConnection $db
+ * @param IConfig $config
+ * @param ILockingProvider $lockingProvider
+ * @param IL10N $l
+ */
+ public function __construct(IDBConnection $db,
+ IConfig $config,
+ ILockingProvider $lockingProvider,
+ IL10N $l) {
$this->db = $db;
$this->config = $config;
$this->lockingProvider = $lockingProvider;
diff --git a/lib/private/Settings/Admin/Sharing.php b/lib/private/Settings/Admin/Sharing.php
index d186dbed981..e110a3d81b7 100644
--- a/lib/private/Settings/Admin/Sharing.php
+++ b/lib/private/Settings/Admin/Sharing.php
@@ -31,6 +31,9 @@ class Sharing implements ISettings {
/** @var IConfig */
private $config;
+ /**
+ * @param IConfig $config
+ */
public function __construct(IConfig $config) {
$this->config = $config;
}
@@ -39,8 +42,9 @@ class Sharing implements ISettings {
* @return TemplateResponse
*/
public function getForm() {
- $excludeGroupsList = !is_null(json_decode($this->config->getAppValue('core', 'shareapi_exclude_groups_list', '')))
- ? implode('|', $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '')) : '';
+ $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '');
+ $excludeGroupsList = !is_null(json_decode($excludedGroups))
+ ? implode('|', json_decode($excludedGroups, true)) : '';
$parameters = [
// Built-In Sharing
diff --git a/lib/private/Settings/Admin/TipsTricks.php b/lib/private/Settings/Admin/TipsTricks.php
index 217ddacd443..fd0fd595844 100644
--- a/lib/private/Settings/Admin/TipsTricks.php
+++ b/lib/private/Settings/Admin/TipsTricks.php
@@ -31,6 +31,9 @@ class TipsTricks implements ISettings {
/** @var IConfig */
private $config;
+ /**
+ * @param IConfig $config
+ */
public function __construct(IConfig $config) {
$this->config = $config;
}
diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php
index fd360ede7f0..1304a60949e 100644
--- a/lib/private/Settings/Manager.php
+++ b/lib/private/Settings/Manager.php
@@ -41,25 +41,28 @@ class Manager implements IManager {
/** @var ILogger */
private $log;
-
/** @var IDBConnection */
private $dbc;
-
/** @var IL10N */
private $l;
-
/** @var IConfig */
private $config;
-
/** @var EncryptionManager */
private $encryptionManager;
-
/** @var IUserManager */
private $userManager;
-
/** @var ILockingProvider */
private $lockingProvider;
+ /**
+ * @param ILogger $log
+ * @param IDBConnection $dbc
+ * @param IL10N $l
+ * @param IConfig $config
+ * @param EncryptionManager $encryptionManager
+ * @param IUserManager $userManager
+ * @param ILockingProvider $lockingProvider
+ */
public function __construct(
ILogger $log,
IDBConnection $dbc,
@@ -135,7 +138,11 @@ class Manager implements IManager {
]);
}
- private function add($table, $values) {
+ /**
+ * @param string $table
+ * @param array $values
+ */
+ private function add($table, array $values) {
$query = $this->dbc->getQueryBuilder();
$values = array_map(function($value) use ($query) {
return $query->createNamedParameter($value);
@@ -196,7 +203,11 @@ class Manager implements IManager {
return $this->has(self::TABLE_ADMIN_SETTINGS, $className);
}
-
+ /**
+ * @param string $table
+ * @param string $className
+ * @return bool
+ */
private function has($table, $className) {
$query = $this->dbc->getQueryBuilder();
$query->select('class')
@@ -249,9 +260,7 @@ class Manager implements IManager {
}
/**
- * returns a list of the admin sections
- *
- * @return ISection[]
+ * @inheritdoc
*/
public function getAdminSections() {
$query = $this->dbc->getQueryBuilder();
@@ -347,11 +356,12 @@ class Manager implements IManager {
ksort($settings);
}
+ /**
+ * @inheritdoc
+ */
public function getAdminSettings($section) {
$settings = $this->getBuiltInAdminSettings($section);
$this->getAdminSettingsFromDB($section, $settings);
return $settings;
}
-
-
}
diff --git a/lib/private/Settings/Section.php b/lib/private/Settings/Section.php
index 2ea614b365e..b3cf242279f 100644
--- a/lib/private/Settings/Section.php
+++ b/lib/private/Settings/Section.php
@@ -21,23 +21,23 @@
*
*/
-
namespace OC\Settings;
-
use OCP\Settings\ISection;
class Section implements ISection {
-
/** @var string */
private $id;
-
/** @var string */
private $name;
-
/** @var int */
private $priority;
+ /**
+ * @param string $id
+ * @param string $name
+ * @param int $priority
+ */
public function __construct($id, $name, $priority) {
$this->id = $id;
$this->name = $name;