diff options
author | Joas Schilling <coding@schilljs.com> | 2016-10-20 15:11:01 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-10-20 15:19:41 +0200 |
commit | 122edcd0c1b652f25c36c52cc7541eb62695bf37 (patch) | |
tree | b9fa6b1f1a4229aa63ea33bda790747a1933eb02 /tests/lib/AppTest.php | |
parent | b946e3ecfb2478f7aaca82c11367a2be8455a2d0 (diff) | |
download | nextcloud-server-122edcd0c1b652f25c36c52cc7541eb62695bf37.tar.gz nextcloud-server-122edcd0c1b652f25c36c52cc7541eb62695bf37.zip |
Make sure all tests use the TestCase method to overwrite services
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/AppTest.php')
-rw-r--r-- | tests/lib/AppTest.php | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php index ac4fb913beb..ea4f328b63a 100644 --- a/tests/lib/AppTest.php +++ b/tests/lib/AppTest.php @@ -493,24 +493,22 @@ class AppTest extends \Test\TestCase { * @param IAppConfig $appConfig app config mock */ private function registerAppConfig(IAppConfig $appConfig) { - \OC::$server->registerService('AppConfig', function ($c) use ($appConfig) { - return $appConfig; - }); - \OC::$server->registerService('AppManager', function (\OC\Server $c) use ($appConfig) { - return new \OC\App\AppManager($c->getUserSession(), $appConfig, $c->getGroupManager(), $c->getMemCacheFactory(), $c->getEventDispatcher()); - }); + $this->overwriteService('AppConfig', $appConfig); + $this->overwriteService('AppManager', new \OC\App\AppManager( + \OC::$server->getUserSession(), + $appConfig, + \OC::$server->getGroupManager(), + \OC::$server->getMemCacheFactory(), + \OC::$server->getEventDispatcher() + )); } /** * Restore the original app config service. */ private function restoreAppConfig() { - \OC::$server->registerService('AppConfig', function (\OC\Server $c) { - return new \OC\AppConfig($c->getDatabaseConnection()); - }); - \OC::$server->registerService('AppManager', function (\OC\Server $c) { - return new \OC\App\AppManager($c->getUserSession(), $c->getAppConfig(), $c->getGroupManager(), $c->getMemCacheFactory(), $c->getEventDispatcher()); - }); + $this->restoreService('AppConfig'); + $this->restoreService('AppManager'); // Remove the cache of the mocked apps list with a forceRefresh \OC_App::getEnabledApps(); |