'SCRIPT_FILENAME' => $_SERVER['SCRIPT_FILENAME'],
],
];
- $fakeRequest = new \OC\AppFramework\Http\Request($params, null, new \OC\AllConfig(new \OC\SystemConfig()));
+ $fakeRequest = new \OC\AppFramework\Http\Request($params, null, new \OC\AllConfig(new \OC\SystemConfig(self::$config)));
$scriptName = $fakeRequest->getScriptName();
if (substr($scriptName, -1) == '/') {
$scriptName .= 'index.php';
}
// setup the basic server
- self::$server = new \OC\Server(\OC::$WEBROOT);
+ self::$server = new \OC\Server(\OC::$WEBROOT, self::$config);
\OC::$server->getEventLogger()->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
\OC::$server->getEventLogger()->start('boot', 'Initialize');
/**
* @param string $webRoot
+ * @param \OC\Config $config
*/
- public function __construct($webRoot) {
+ public function __construct($webRoot, \OC\Config $config) {
parent::__construct();
$this->webRoot = $webRoot;
$c->getSystemConfig()
);
});
- $this->registerService('SystemConfig', function ($c) {
- return new \OC\SystemConfig();
+ $this->registerService('SystemConfig', function ($c) use ($config) {
+ return new \OC\SystemConfig($config);
});
$this->registerService('AppConfig', function ($c) {
return new \OC\AppConfig(\OC_DB::getConnection());
'objectstore' => ['arguments' => ['password' => true]],
];
+ /** @var Config */
+ private $config;
+
+ public function __construct(Config $config) {
+ $this->config = $config;
+ }
+
/**
* Lists all available config keys
* @return array an array of key names
*/
public function getKeys() {
- return \OC::$config->getKeys();
+ return $this->config->getKeys();
}
/**
* @param mixed $value the value that should be stored
*/
public function setValue($key, $value) {
- \OC::$config->setValue($key, $value);
+ $this->config->setValue($key, $value);
}
/**
* If value is null, the config key will be deleted
*/
public function setValues(array $configs) {
- \OC::$config->setValues($configs);
+ $this->config->setValues($configs);
}
/**
* @return mixed the value or $default
*/
public function getValue($key, $default = '') {
- return \OC::$config->getValue($key, $default);
+ return $this->config->getValue($key, $default);
}
/**
* @param string $key the key of the value, under which it was saved
*/
public function deleteValue($key) {
- \OC::$config->deleteKey($key);
+ $this->config->deleteKey($key);
}
/**
$connection = $this->connection;
}
if($systemConfig === null) {
- $systemConfig = $this->getMock('\OC\SystemConfig');
+ $systemConfig = $this->getMockBuilder('\OC\SystemConfig')
+ ->disableOriginalConstructor()
+ ->getMock();
}
return new \OC\AllConfig($systemConfig, $connection);
}
public function testSetUserValueWithPreCondition() {
// mock the check for the database to run the correct SQL statements for each database type
- $systemConfig = $this->getMock('\OC\SystemConfig');
+ $systemConfig = $this->getMockBuilder('\OC\SystemConfig')
+ ->disableOriginalConstructor()
+ ->getMock();
$systemConfig->expects($this->once())
->method('getValue')
->with($this->equalTo('dbtype'),
*/
public function testSetUserValueWithPreConditionFailure() {
// mock the check for the database to run the correct SQL statements for each database type
- $systemConfig = $this->getMock('\OC\SystemConfig');
+ $systemConfig = $this->getMockBuilder('\OC\SystemConfig')
+ ->disableOriginalConstructor()
+ ->getMock();
$systemConfig->expects($this->once())
->method('getValue')
->with($this->equalTo('dbtype'),
public function testGetUsersForUserValue() {
// mock the check for the database to run the correct SQL statements for each database type
- $systemConfig = $this->getMock('\OC\SystemConfig');
+ $systemConfig = $this->getMockBuilder('\OC\SystemConfig')
+ ->disableOriginalConstructor()
+ ->getMock();
$systemConfig->expects($this->once())
->method('getValue')
->with($this->equalTo('dbtype'),
public function setUp() {
parent::setUp();
- $this->server = new \OC\Server('');
+ $config = new \OC\Config(\OC::$configDir);
+ $this->server = new \OC\Server('', $config);
}
public function dataTestQuery() {