Fix getCloudId

This commit is contained in:
Thomas Müller 2015-12-01 14:50:13 +01:00
parent 6abc02cb88
commit 0391cc0451
2 changed files with 8 additions and 1 deletions

View file

@ -79,6 +79,7 @@ class User implements IUser {
$this->emitter = $emitter;
$this->config = $config;
$this->avatarManager = $avatarManager;
$this->urlGenerator = $urlGenerator;
if ($this->config) {
$enabled = $this->config->getUserValue($uid, 'core', 'enabled', 'true');
$this->enabled = ($enabled === 'true');

View file

@ -468,8 +468,14 @@ class User extends \Test\TestCase {
*/
$backend = $this->getMock('\Test\Util\User\Dummy');
$urlGenerator = $this->getMockBuilder('\OC\URLGenerator')
->setMethods(['getAbsoluteURL'])
->disableOriginalConstructor()->getMock();
$urlGenerator
->expects($this->any())
->method('getAbsoluteURL')
->withAnyParameters()
->willReturn('http://localhost:8888/owncloud');
$user = new \OC\User\User('foo', $backend, null, null, null, $urlGenerator);
$this->assertEquals("foo@localhost", $user->getCloudId());
$this->assertEquals("foo@localhost:8888/owncloud", $user->getCloudId());
}
}