diff options
author | Morris Jobke <hey@morrisjobke.de> | 2014-11-27 16:40:12 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-12-08 22:29:42 +0100 |
commit | 50c2a819a0c5ae50571d36a3e2dec4e8267fd13b (patch) | |
tree | c6241e94b567618b9f6e7952f45a3aaa11250d49 /tests | |
parent | f219f5a7a62fe88b364b9a5f50e9730eba1ee84c (diff) | |
download | nextcloud-server-50c2a819a0c5ae50571d36a3e2dec4e8267fd13b.tar.gz nextcloud-server-50c2a819a0c5ae50571d36a3e2dec4e8267fd13b.zip |
Extract interaction with config.php into SystemConfig
* introduce SystemConfig to avoid DI circle (used by database connection which is itself needed by AllConfig that itself contains the methods to access the config.php which then would need the database connection - did you get it? ;))
* use DI container and use that method in legacy code paths (for easier refactoring later)
* create and use getSystemConfig instead of query() in DI container
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/user/user.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/lib/user/user.php b/tests/lib/user/user.php index 6aa7243a75a..85ade9ccaf1 100644 --- a/tests/lib/user/user.php +++ b/tests/lib/user/user.php @@ -228,10 +228,19 @@ class User extends \Test\TestCase { ->method('implementsActions') ->will($this->returnValue(false)); - $allConfig = new AllConfig(); + $allConfig = $this->getMockBuilder('\OC\AllConfig') + ->disableOriginalConstructor() + ->getMock(); + $allConfig->expects($this->any()) + ->method('getUserValue') + ->will($this->returnValue(true)); + $allConfig->expects($this->any()) + ->method('getSystemValue') + ->with($this->equalTo('datadirectory')) + ->will($this->returnValue('arbitrary/path')); $user = new \OC\User\User('foo', $backend, null, $allConfig); - $this->assertEquals(\OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data") . '/foo', $user->getHome()); + $this->assertEquals('arbitrary/path/foo', $user->getHome()); } public function testCanChangePassword() { |