summaryrefslogtreecommitdiffstats
path: root/lib/private/Server.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-03-19 23:14:47 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2017-03-21 08:52:20 +0100
commit21641302a97815c2779f65ffd9efc95cf314e48d (patch)
tree2a963b50b2f9220c58882192405e660b02d7d104 /lib/private/Server.php
parent7cece61ff66df60e2df258285049b6009e921197 (diff)
downloadnextcloud-server-21641302a97815c2779f65ffd9efc95cf314e48d.tar.gz
nextcloud-server-21641302a97815c2779f65ffd9efc95cf314e48d.zip
Add DI intergration tests
* Moved some interface definitions to Server.php (more to come) * Build/Query only for existing classes in the AppContainer * Build/Query only for classes of the App in the AppContainer * Offload other stuff to the servercontainer Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r--lib/private/Server.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 57cc93f4477..8aaecf1d256 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -93,6 +93,7 @@ use OC\Tagging\TagMapper;
use OCA\Theming\ThemingDefaults;
use OCP\Federation\ICloudIdManager;
use OCP\Authentication\LoginCredentials\IStore;
+use OCP\IDBConnection;
use OCP\IL10N;
use OCP\IServerContainer;
use OCP\RichObjectStrings\IValidator;
@@ -485,7 +486,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService('CredentialsManager', function (Server $c) {
return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection());
});
- $this->registerService('DatabaseConnection', function (Server $c) {
+ $this->registerService(IDBConnection::class, function (Server $c) {
$systemConfig = $c->getSystemConfig();
$factory = new \OC\DB\ConnectionFactory($systemConfig);
$type = $systemConfig->getValue('dbtype', 'sqlite');
@@ -497,6 +498,7 @@ class Server extends ServerContainer implements IServerContainer {
$connection->getConfiguration()->setSQLLogger($c->getQueryLogger());
return $connection;
});
+ $this->registerAlias('DatabaseConnection', IDBConnection::class);
$this->registerService('HTTPHelper', function (Server $c) {
$config = $c->getConfig();
return new HTTPHelper(
@@ -740,9 +742,12 @@ class Server extends ServerContainer implements IServerContainer {
}
return new \OC_Defaults();
});
- $this->registerService('EventDispatcher', function () {
+ $this->registerService(EventDispatcher::class, function () {
return new EventDispatcher();
});
+ $this->registerAlias('EventDispatcher', EventDispatcher::class);
+ $this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class);
+
$this->registerService('CryptoWrapper', function (Server $c) {
// FIXME: Instantiiated here due to cyclic dependency
$request = new Request(