14 $this->
dropTables([
'principals',
'groupmembers']);
19 $pdo->query(
"INSERT INTO principals (uri,email,displayname) VALUES ('principals/user','user@example.org','User')");
20 $pdo->query(
"INSERT INTO principals (uri,email,displayname) VALUES ('principals/group','group@example.org','Group')");
22 $pdo->query(
"INSERT INTO groupmembers (principal_id,member_id) VALUES (5,4)");
31 $this->assertTrue($backend instanceof
PDO);
45 'uri' =>
'principals/admin',
46 '{http://sabredav.org/ns}email-address' =>
'admin@example.org',
47 '{DAV:}displayname' =>
'Administrator',
50 'uri' =>
'principals/user',
51 '{http://sabredav.org/ns}email-address' =>
'user@example.org',
52 '{DAV:}displayname' =>
'User',
55 'uri' =>
'principals/group',
56 '{http://sabredav.org/ns}email-address' =>
'group@example.org',
57 '{DAV:}displayname' =>
'Group',
61 $this->assertEquals($expected, $backend->getPrincipalsByPrefix(
'principals'));
62 $this->assertEquals([], $backend->getPrincipalsByPrefix(
'foo'));
76 'uri' =>
'principals/user',
77 '{http://sabredav.org/ns}email-address' =>
'user@example.org',
78 '{DAV:}displayname' =>
'User',
81 $this->assertEquals($expected, $backend->getPrincipalByPath(
'principals/user'));
82 $this->assertEquals(null, $backend->getPrincipalByPath(
'foo'));
90 $expected = [
'principals/user'];
92 $this->assertEquals($expected, $backend->getGroupMemberSet(
'principals/group'));
100 $expected = [
'principals/group'];
102 $this->assertEquals($expected, $backend->getGroupMembership(
'principals/user'));
112 $this->assertEquals([
'principals/user'], $backend->getGroupMemberSet(
'principals/group'));
115 $backend->setGroupMemberSet(
'principals/group', []);
116 $this->assertEquals([], $backend->getGroupMemberSet(
'principals/group'));
119 $backend->setGroupMemberSet(
'principals/group', [
'principals/user']);
120 $this->assertEquals([
'principals/user'], $backend->getGroupMemberSet(
'principals/group'));
131 $result = $backend->searchPrincipals(
'principals', [
'{DAV:}blabla' =>
'foo']);
132 $this->assertEquals([],
$result);
134 $result = $backend->searchPrincipals(
'principals', [
'{DAV:}displayname' =>
'ou']);
135 $this->assertEquals([
'principals/group'],
$result);
137 $result = $backend->searchPrincipals(
'principals', [
'{DAV:}displayname' =>
'UsEr',
'{http://sabredav.org/ns}email-address' =>
'USER@EXAMPLE']);
138 $this->assertEquals([
'principals/user'],
$result);
140 $result = $backend->searchPrincipals(
'mom', [
'{DAV:}displayname' =>
'UsEr',
'{http://sabredav.org/ns}email-address' =>
'USER@EXAMPLE']);
141 $this->assertEquals([],
$result);
151 '{DAV:}displayname' =>
'pietje',
154 $backend->updatePrincipal(
'principals/user', $propPatch);
155 $result = $propPatch->commit();
159 $this->assertEquals([
161 'uri' =>
'principals/user',
162 '{DAV:}displayname' =>
'pietje',
163 '{http://sabredav.org/ns}email-address' =>
'user@example.org',
164 ], $backend->getPrincipalByPath(
'principals/user'));
174 '{DAV:}displayname' =>
'pietje',
175 '{DAV:}unknown' =>
'foo',
178 $backend->updatePrincipal(
'principals/user', $propPatch);
179 $result = $propPatch->commit();
183 $this->assertEquals([
184 '{DAV:}displayname' => 424,
185 '{DAV:}unknown' => 403
186 ], $propPatch->getResult());
188 $this->assertEquals([
190 'uri' =>
'principals/user',
191 '{DAV:}displayname' =>
'User',
192 '{http://sabredav.org/ns}email-address' =>
'user@example.org',
193 ], $backend->getPrincipalByPath(
'principals/user'));
201 $this->assertNull($backend->findByUri(
'http://foo',
'principals'));
212 $backend->findByUri(
'mailto:user@example.org',
'principals')
This class represents a set of properties that are going to be updated.
testFindByUriUnknownScheme()
dropTables($tableNames)
Drops tables, if they exist.
createSchema($schemaName)
Uses .sql files from the examples directory to initialize the database.
testUpdatePrincipalUnknownField()
testGetPrincipalByPath()
testConstruct
testGetPrincipalsByPrefix()
testConstruct