@ -41,13 +41,17 @@ class Principal extends \Test\TestCase {
$fooUser = $this->getMockBuilder('\OC\User\User')
->disableOriginalConstructor()->getMock();
$fooUser
->expects($this->exactly(3))
->method('getUID')
->will($this->returnValue('foo'));
->expects($this->exactly(2))
->method('getUID')
->will($this->returnValue('foo'));
$fooUser
->expects($this->exactly(1))
->method('getDisplayName')
->will($this->returnValue('Dr. Foo-Bar'));
$barUser = $this->getMockBuilder('\OC\User\User')
->disableOriginalConstructor()->getMock();
$barUser
->expects($this->exactly(3))
->expects($this->exactly(2 ))
->method('getUID')
->will($this->returnValue('bar'));
$this->userManager
@ -68,16 +72,16 @@ class Principal extends \Test\TestCase {
$expectedResponse = [
0 => [
'uri' => 'principals/foo',
'{DAV:}displayname' => 'foo '
'uri' => 'principals/users/ foo',
'{DAV:}displayname' => 'Dr. Foo-Bar '
],
1 => [
'uri' => 'principals/bar',
'uri' => 'principals/users/ bar',
'{DAV:}displayname' => 'bar',
'{http://sabredav.org/ns}email-address' => 'bar@owncloud.org'
]
];
$response = $this->connector->getPrincipalsByPrefix('principals');
$response = $this->connector->getPrincipalsByPrefix('principals/users ');
$this->assertSame($expectedResponse, $response);
}
@ -88,7 +92,7 @@ class Principal extends \Test\TestCase {
->with('')
->will($this->returnValue([]));
$response = $this->connector->getPrincipalsByPrefix('principals');
$response = $this->connector->getPrincipalsByPrefix('principals/users ');
$this->assertSame([], $response);
}
@ -96,7 +100,7 @@ class Principal extends \Test\TestCase {
$fooUser = $this->getMockBuilder('\OC\User\User')
->disableOriginalConstructor()->getMock();
$fooUser
->expects($this->exactly(3 ))
->expects($this->exactly(2 ))
->method('getUID')
->will($this->returnValue('foo'));
$this->userManager
@ -111,10 +115,10 @@ class Principal extends \Test\TestCase {
->will($this->returnValue(''));
$expectedResponse = [
'uri' => 'principals/foo',
'uri' => 'principals/users/ foo',
'{DAV:}displayname' => 'foo'
];
$response = $this->connector->getPrincipalByPath('principals/foo');
$response = $this->connector->getPrincipalByPath('principals/users/ foo');
$this->assertSame($expectedResponse, $response);
}
@ -122,7 +126,7 @@ class Principal extends \Test\TestCase {
$fooUser = $this->getMockBuilder('\OC\User\User')
->disableOriginalConstructor()->getMock();
$fooUser
->expects($this->exactly(3 ))
->expects($this->exactly(2 ))
->method('getUID')
->will($this->returnValue('foo'));
$this->userManager
@ -137,11 +141,11 @@ class Principal extends \Test\TestCase {
->will($this->returnValue('foo@owncloud.org'));
$expectedResponse = [
'uri' => 'principals/foo',
'uri' => 'principals/users/ foo',
'{DAV:}displayname' => 'foo',
'{http://sabredav.org/ns}email-address' => 'foo@owncloud.org'
];
$response = $this->connector->getPrincipalByPath('principals/foo');
$response = $this->connector->getPrincipalByPath('principals/users/ foo');
$this->assertSame($expectedResponse, $response);
}
@ -152,7 +156,7 @@ class Principal extends \Test\TestCase {
->with('foo')
->will($this->returnValue(null));
$response = $this->connector->getPrincipalByPath('principals/foo');
$response = $this->connector->getPrincipalByPath('principals/users/ foo');
$this->assertSame(null, $response);
}
@ -160,7 +164,7 @@ class Principal extends \Test\TestCase {
$fooUser = $this->getMockBuilder('\OC\User\User')
->disableOriginalConstructor()->getMock();
$fooUser
->expects($this->exactly(3 ))
->expects($this->exactly(2 ))
->method('getUID')
->will($this->returnValue('foo'));
$this->userManager
@ -174,8 +178,8 @@ class Principal extends \Test\TestCase {
->with('foo', 'settings', 'email')
->will($this->returnValue('foo@owncloud.org'));
$response = $this->connector->getGroupMemberSet('principals/foo');
$this->assertSame(['principals/foo'], $response);
$response = $this->connector->getGroupMemberSet('principals/users/ foo');
$this->assertSame(['principals/users/ foo'], $response);
}
/**
@ -189,14 +193,14 @@ class Principal extends \Test\TestCase {
->with('foo')
->will($this->returnValue(null));
$this->connector->getGroupMemberSet('principals/foo');
$this->connector->getGroupMemberSet('principals/users/ foo');
}
public function testGetGroupMembership() {
$fooUser = $this->getMockBuilder('\OC\User\User')
->disableOriginalConstructor()->getMock();
$fooUser
->expects($this->exactly(3 ))
->expects($this->exactly(2 ))
->method('getUID')
->will($this->returnValue('foo'));
$this->userManager
@ -211,10 +215,10 @@ class Principal extends \Test\TestCase {
->will($this->returnValue('foo@owncloud.org'));
$expectedResponse = [
'principals/foo/calendar-proxy-read',
'principals/foo/calendar-proxy-write'
'principals/users/ foo/calendar-proxy-read',
'principals/users/ foo/calendar-proxy-write'
];
$response = $this->connector->getGroupMembership('principals/foo');
$response = $this->connector->getGroupMembership('principals/users/ foo');
$this->assertSame($expectedResponse, $response);
}
@ -229,7 +233,7 @@ class Principal extends \Test\TestCase {
->with('foo')
->will($this->returnValue(null));
$this->connector->getGroupMembership('principals/foo');
$this->connector->getGroupMembership('principals/users/ foo');
}
/**
@ -237,7 +241,7 @@ class Principal extends \Test\TestCase {
* @expectedExceptionMessage Setting members of the group is not supported yet
*/
public function testSetGroupMembership() {
$this->connector->setGroupMemberSet('principals/foo', ['foo']);
$this->connector->setGroupMemberSet('principals/users/ foo', ['foo']);
}
public function testUpdatePrincipal() {
@ -245,6 +249,6 @@ class Principal extends \Test\TestCase {
}
public function testSearchPrincipals() {
$this->assertSame([], $this->connector->searchPrincipals('principals', []));
$this->assertSame([], $this->connector->searchPrincipals('principals/users ', []));
}
}