From f4f27ce5c38e1069cad1ccf00b0f1ba0b06ea6c4 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 17 Nov 2014 16:18:43 +0100 Subject: get rid of appconfig --- appinfo/application.php | 5 ----- controller/pagecontroller.php | 5 +---- tests/unit/controller/PageControllerTest.php | 19 +++++++------------ 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/appinfo/application.php b/appinfo/application.php index 6e84cde64..727fe2dd3 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -82,7 +82,6 @@ class Application extends App { $c->query('CoreConfig'), $c->query('URLGenerator'), $c->query('AppConfig'), - $c->query('AdminConfig'), $c->query('Config'), $c->query('L10N'), $c->query('UserId') @@ -318,10 +317,6 @@ class Application extends App { return $c->query('ServerContainer')->getConfig(); }); - $container->registerService('AdminConfig', function($c) { - return $c->query('ServerContainer')->getAppConfig(); - }); - $container->registerService('DatabaseType', function($c) { return $c->query('ServerContainer') ->getConfig()->getSystemValue('dbtype'); diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php index 9fe0bdeb2..d21dcff62 100644 --- a/controller/pagecontroller.php +++ b/controller/pagecontroller.php @@ -20,7 +20,6 @@ use \OCP\IConfig; use \OCP\IL10N; use \OCP\IURLGenerator; use \OCP\AppFramework\Controller; -use \OCP\IAppConfig as AdminConfig; use \OCA\News\Config\AppConfig; use \OCA\News\Config\Config; @@ -40,7 +39,6 @@ class PageController extends Controller { IConfig $settings, IURLGenerator $urlGenerator, AppConfig $appConfig, - AdminConfig $adminConfig, Config $config, IL10N $l10n, $userId){ @@ -50,7 +48,6 @@ class PageController extends Controller { $this->appConfig = $appConfig; $this->l10n = $l10n; $this->userId = $userId; - $this->adminConfig = $adminConfig; $this->config = $config; } @@ -61,7 +58,7 @@ class PageController extends Controller { */ public function index() { $cronWarning = ''; - $cronMode = $this->adminConfig->getValue('core', 'backgroundjobs_mode'); + $cronMode = $this->settings->getAppValue('core', 'backgroundjobs_mode'); $cronOn = $this->config->getUseCronUpdates(); // check for cron modes which may lead to problems diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php index 03d3889d3..477be7ead 100644 --- a/tests/unit/controller/PageControllerTest.php +++ b/tests/unit/controller/PageControllerTest.php @@ -26,7 +26,6 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { private $appConfig; private $configData; private $config; - private $adminConfig; /** * Gets run before each test @@ -60,10 +59,6 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { '\OCP\IURLGenerator') ->disableOriginalConstructor() ->getMock(); - $this->adminConfig = $this->getMockBuilder( - '\OCP\IAppConfig') - ->disableOriginalConstructor() - ->getMock(); $this->appConfig = $this->getMockBuilder( '\OCA\News\Config\AppConfig') ->disableOriginalConstructor() @@ -74,7 +69,7 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { ->getMock(); $this->controller = new PageController($this->appName, $this->request, $this->settings, $this->urlGenerator, $this->appConfig, - $this->adminConfig, $this->config, $this->l10n, $this->user); + $this->config, $this->l10n, $this->user); } @@ -83,8 +78,8 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { ->method('getUseCronUpdates') ->will($this->returnValue(true)); - $this->adminConfig->expects($this->once()) - ->method('getValue') + $this->settings->expects($this->once()) + ->method('getAppValue') ->with( $this->equalTo('core'), $this->equalTo('backgroundjobs_mode') @@ -102,8 +97,8 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { ->method('getUseCronUpdates') ->will($this->returnValue(true)); - $this->adminConfig->expects($this->once()) - ->method('getValue') + $this->settings->expects($this->once()) + ->method('getAppValue') ->with( $this->equalTo('core'), $this->equalTo('backgroundjobs_mode') @@ -120,8 +115,8 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { ->method('getUseCronUpdates') ->will($this->returnValue(false)); - $this->adminConfig->expects($this->once()) - ->method('getValue') + $this->settings->expects($this->once()) + ->method('getAppValue') ->with( $this->equalTo('core'), $this->equalTo('backgroundjobs_mode') -- cgit v1.2.3