summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-03-19 22:20:56 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2017-03-21 08:52:20 +0100
commit7cece61ff66df60e2df258285049b6009e921197 (patch)
treecdb374b5eaf003fe633146dc7070d9938fca9f62 /lib/private
parent246e9ce547fa885f4335a2bca04ad4f3c559c8e7 (diff)
downloadnextcloud-server-7cece61ff66df60e2df258285049b6009e921197.tar.gz
nextcloud-server-7cece61ff66df60e2df258285049b6009e921197.zip
Extend DI tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/AppFramework/DependencyInjection/DIContainer.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php
index 354b93873e9..939e45dcd35 100644
--- a/lib/private/AppFramework/DependencyInjection/DIContainer.php
+++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php
@@ -51,6 +51,7 @@ use OCP\AppFramework\QueryException;
use OCP\Federation\ICloudIdManager;
use OCP\Files\IAppData;
use OCP\Files\Mount\IMountManager;
+use OCP\IServerContainer;
use OCP\RichObjectStrings\IValidator;
use OCP\Util;
@@ -61,18 +62,25 @@ class DIContainer extends SimpleContainer implements IAppContainer {
*/
private $middleWares = array();
+ /** @var IServerContainer */
+ private $server;
+
/**
* Put your class dependencies in here
* @param string $appName the name of the app
+ * @param array $urlParams
+ * @param IServerContainer $server
*/
- public function __construct($appName, $urlParams = array()){
+ public function __construct($appName, $urlParams = array(), IServerContainer $server = null){
parent::__construct();
$this['AppName'] = $appName;
$this['urlParams'] = $urlParams;
/** @var \OC\ServerContainer $server */
- $server = $this->getServer();
- $server->registerAppContainer($appName, $this);
+ if ($server === null) {
+ $this->server = \OC::$server;
+ }
+ $this->server->registerAppContainer($appName, $this);
// aliases
$this->registerAlias('appName', 'AppName');
@@ -481,7 +489,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
*/
function getServer()
{
- return OC::$server;
+ return $this->server;
}
/**