Skip to content

Commit

Permalink
Fix settings tests
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer committed Mar 20, 2017
1 parent ce2449e commit cc44e28
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
14 changes: 2 additions & 12 deletions lib/private/AppFramework/DependencyInjection/DIContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ public function __construct($appName, $urlParams = array(), ServerContainer $ser
/**
* Core services
*/
$this->registerService('OCP\\App\\IAppManager', function($c) {
return $this->getServer()->getAppManager();
});

$this->registerService('OCP\\AppFramework\\Http\\IOutput', function($c){
return new Output($this->getServer()->getWebRoot());
});
Expand All @@ -119,10 +115,6 @@ public function __construct($appName, $urlParams = array(), ServerContainer $ser
return $this->getServer()->getCache();
});

$this->registerService('OCP\\ICacheFactory', function($c) {
return $this->getServer()->getMemCacheFactory();
});

$this->registerService('OC\\CapabilitiesManager', function($c) {
return $this->getServer()->getCapabilitiesManager();
});
Expand Down Expand Up @@ -243,10 +235,6 @@ public function __construct($appName, $urlParams = array(), ServerContainer $ser
return $this->getServer()->getTagManager();
});

$this->registerService('OCP\\ITempManager', function($c) {
return $this->getServer()->getTempManager();
});

$this->registerAlias('OCP\\AppFramework\\Utility\\ITimeFactory', 'OC\AppFramework\Utility\TimeFactory');
$this->registerAlias('TimeFactory', 'OCP\\AppFramework\\Utility\\ITimeFactory');

Expand Down Expand Up @@ -580,6 +568,8 @@ public function query($name) {
if (strtolower($segments[1]) === strtolower($this['AppName'])) {
return parent::query($name);
}
} else if ($this['AppName'] === 'settings' && strpos($name, 'OC\\Settings\\') === 0) {
return parent::query($name);
}
}

Expand Down
20 changes: 17 additions & 3 deletions lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
namespace OC;

use bantu\IniGetWrapper\IniGetWrapper;
use OC\App\AppManager;
use OC\App\AppStore\Fetcher\AppFetcher;
use OC\App\AppStore\Fetcher\CategoryFetcher;
use OC\AppFramework\Http\Request;
Expand Down Expand Up @@ -73,6 +74,7 @@
use OC\Lockdown\LockdownManager;
use OC\Mail\Mailer;
use OC\Memcache\ArrayCache;
use OC\Memcache\Factory;
use OC\Notification\Manager;
use OC\Repair\NC11\CleanPreviewsBackgroundJob;
use OC\RichObjectStrings\Validator;
Expand All @@ -91,11 +93,14 @@
use OC\Session\CryptoWrapper;
use OC\Tagging\TagMapper;
use OCA\Theming\ThemingDefaults;
use OCP\App\IAppManager;
use OCP\Federation\ICloudIdManager;
use OCP\Authentication\LoginCredentials\IStore;
use OCP\ICacheFactory;
use OCP\IDBConnection;
use OCP\IL10N;
use OCP\IServerContainer;
use OCP\ITempManager;
use OCP\RichObjectStrings\IValidator;
use OCP\Security\IContentSecurityPolicyManager;
use Symfony\Component\EventDispatcher\EventDispatcher;
Expand Down Expand Up @@ -396,7 +401,7 @@ public function __construct($webRoot, \OC\Config $config) {
$this->registerService('UserCache', function ($c) {
return new Cache\File();
});
$this->registerService('MemCacheFactory', function (Server $c) {
$this->registerService(Factory::class, function (Server $c) {
$config = $c->getConfig();

if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
Expand All @@ -419,6 +424,9 @@ public function __construct($webRoot, \OC\Config $config) {
'\\OC\\Memcache\\ArrayCache'
);
});
$this->registerAlias('MemCacheFactory', Factory::class);
$this->registerAlias(ICacheFactory::class, Factory::class);

$this->registerService('RedisFactory', function (Server $c) {
$systemConfig = $c->getSystemConfig();
return new RedisFactory($systemConfig);
Expand Down Expand Up @@ -528,13 +536,16 @@ public function __construct($webRoot, \OC\Config $config) {
return new NullQueryLogger();
}
});
$this->registerService('TempManager', function (Server $c) {
$this->registerService(TempManager::class, function (Server $c) {
return new TempManager(
$c->getLogger(),
$c->getConfig()
);
});
$this->registerService('AppManager', function (Server $c) {
$this->registerAlias('TempManager', TempManager::class);
$this->registerAlias(ITempManager::class, TempManager::class);

$this->registerService(AppManager::class, function (Server $c) {
return new \OC\App\AppManager(
$c->getUserSession(),
$c->getAppConfig(),
Expand All @@ -543,6 +554,9 @@ public function __construct($webRoot, \OC\Config $config) {
$c->getEventDispatcher()
);
});
$this->registerAlias('AppManager', AppManager::class);
$this->registerAlias(IAppManager::class, AppManager::class);

$this->registerService('DateTimeZone', function (Server $c) {
return new DateTimeZone(
$c->getConfig(),
Expand Down

0 comments on commit cc44e28

Please sign in to comment.