ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\CardDAV\AddressBookHomeTest Class Reference
+ Inheritance diagram for Sabre\CardDAV\AddressBookHomeTest:
+ Collaboration diagram for Sabre\CardDAV\AddressBookHomeTest:

Public Member Functions

 setUp ()
 
 testGetName ()
 
 testSetName ()
 @expectedException Sabre\DAV\Exception\MethodNotAllowed More...
 
 testDelete ()
 @expectedException Sabre\DAV\Exception\MethodNotAllowed More...
 
 testGetLastModified ()
 
 testCreateFile ()
 @expectedException Sabre\DAV\Exception\MethodNotAllowed More...
 
 testCreateDirectory ()
 @expectedException Sabre\DAV\Exception\MethodNotAllowed More...
 
 testGetChild ()
 
 testGetChild404 ()
 @expectedException Sabre\DAV\Exception\NotFound More...
 
 testGetChildren ()
 
 testCreateExtendedCollection ()
 
 testCreateExtendedCollectionInvalid ()
 @expectedException Sabre\DAV\Exception\InvalidResourceType More...
 
 testACLMethods ()
 
 testSetACL ()
 @expectedException Sabre\DAV\Exception\Forbidden More...
 
 testGetSupportedPrivilegeSet ()
 

Protected Attributes

 $s
 
 $backend
 

Detailed Description

Definition at line 7 of file AddressBookHomeTest.php.

Member Function Documentation

◆ setUp()

Sabre\CardDAV\AddressBookHomeTest::setUp ( )

Definition at line 15 of file AddressBookHomeTest.php.

15 {
16
17 $this->backend = new Backend\Mock();
18 $this->s = new AddressBookHome(
19 $this->backend,
20 'principals/user1'
21 );
22
23 }

◆ testACLMethods()

Sabre\CardDAV\AddressBookHomeTest::testACLMethods ( )

Definition at line 129 of file AddressBookHomeTest.php.

129 {
130
131 $this->assertEquals('principals/user1', $this->s->getOwner());
132 $this->assertNull($this->s->getGroup());
133 $this->assertEquals([
134 [
135 'privilege' => '{DAV:}all',
136 'principal' => '{DAV:}owner',
137 'protected' => true,
138 ],
139 ], $this->s->getACL());
140
141 }

◆ testCreateDirectory()

Sabre\CardDAV\AddressBookHomeTest::testCreateDirectory ( )

@expectedException Sabre\DAV\Exception\MethodNotAllowed

Definition at line 67 of file AddressBookHomeTest.php.

67 {
68
69 $this->s->createDirectory('bla');
70
71 }

◆ testCreateExtendedCollection()

Sabre\CardDAV\AddressBookHomeTest::testCreateExtendedCollection ( )

Definition at line 99 of file AddressBookHomeTest.php.

99 {
100
101 $resourceType = [
102 '{' . Plugin::NS_CARDDAV . '}addressbook',
103 '{DAV:}collection',
104 ];
105 $this->s->createExtendedCollection('book2', new MkCol($resourceType, ['{DAV:}displayname' => 'a-book 2']));
106
107 $this->assertEquals([
108 'id' => 'book2',
109 'uri' => 'book2',
110 '{DAV:}displayname' => 'a-book 2',
111 'principaluri' => 'principals/user1',
112 ], $this->backend->addressBooks[2]);
113
114 }
const NS_CARDDAV
xml namespace for CardDAV elements
Definition: Plugin.php:33

References Sabre\CardDAV\Plugin\NS_CARDDAV.

◆ testCreateExtendedCollectionInvalid()

Sabre\CardDAV\AddressBookHomeTest::testCreateExtendedCollectionInvalid ( )

@expectedException Sabre\DAV\Exception\InvalidResourceType

Definition at line 119 of file AddressBookHomeTest.php.

119 {
120
121 $resourceType = [
122 '{DAV:}collection',
123 ];
124 $this->s->createExtendedCollection('book2', new MkCol($resourceType, ['{DAV:}displayname' => 'a-book 2']));
125
126 }

◆ testCreateFile()

Sabre\CardDAV\AddressBookHomeTest::testCreateFile ( )

@expectedException Sabre\DAV\Exception\MethodNotAllowed

Definition at line 58 of file AddressBookHomeTest.php.

58 {
59
60 $this->s->createFile('bla');
61
62 }

◆ testDelete()

Sabre\CardDAV\AddressBookHomeTest::testDelete ( )

@expectedException Sabre\DAV\Exception\MethodNotAllowed

Definition at line 43 of file AddressBookHomeTest.php.

43 {
44
45 $this->s->delete();
46
47 }

◆ testGetChild()

Sabre\CardDAV\AddressBookHomeTest::testGetChild ( )

Definition at line 73 of file AddressBookHomeTest.php.

73 {
74
75 $child = $this->s->getChild('book1');
76 $this->assertInstanceOf('Sabre\\CardDAV\\AddressBook', $child);
77 $this->assertEquals('book1', $child->getName());
78
79 }

◆ testGetChild404()

Sabre\CardDAV\AddressBookHomeTest::testGetChild404 ( )

@expectedException Sabre\DAV\Exception\NotFound

Definition at line 84 of file AddressBookHomeTest.php.

84 {
85
86 $this->s->getChild('book2');
87
88 }

◆ testGetChildren()

Sabre\CardDAV\AddressBookHomeTest::testGetChildren ( )

Definition at line 90 of file AddressBookHomeTest.php.

90 {
91
92 $children = $this->s->getChildren();
93 $this->assertEquals(2, count($children));
94 $this->assertInstanceOf('Sabre\\CardDAV\\AddressBook', $children[0]);
95 $this->assertEquals('book1', $children[0]->getName());
96
97 }

◆ testGetLastModified()

Sabre\CardDAV\AddressBookHomeTest::testGetLastModified ( )

Definition at line 49 of file AddressBookHomeTest.php.

49 {
50
51 $this->assertNull($this->s->getLastModified());
52
53 }

◆ testGetName()

Sabre\CardDAV\AddressBookHomeTest::testGetName ( )

Definition at line 25 of file AddressBookHomeTest.php.

25 {
26
27 $this->assertEquals('user1', $this->s->getName());
28
29 }

◆ testGetSupportedPrivilegeSet()

Sabre\CardDAV\AddressBookHomeTest::testGetSupportedPrivilegeSet ( )

Definition at line 152 of file AddressBookHomeTest.php.

152 {
153
154 $this->assertNull(
155 $this->s->getSupportedPrivilegeSet()
156 );
157
158 }

◆ testSetACL()

Sabre\CardDAV\AddressBookHomeTest::testSetACL ( )

@expectedException Sabre\DAV\Exception\Forbidden

Definition at line 146 of file AddressBookHomeTest.php.

146 {
147
148 $this->s->setACL([]);
149
150 }

◆ testSetName()

Sabre\CardDAV\AddressBookHomeTest::testSetName ( )

@expectedException Sabre\DAV\Exception\MethodNotAllowed

Definition at line 34 of file AddressBookHomeTest.php.

34 {
35
36 $this->s->setName('user2');
37
38 }

Field Documentation

◆ $backend

Sabre\CardDAV\AddressBookHomeTest::$backend
protected

Definition at line 13 of file AddressBookHomeTest.php.

◆ $s

Sabre\CardDAV\AddressBookHomeTest::$s
protected

Definition at line 12 of file AddressBookHomeTest.php.


The documentation for this class was generated from the following file: