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

Public Member Functions

 setUp ()
 
 testGet ()
 
 testGet2 ()
 
 testPut ()
 testGet More...
 
 testDelete ()
 
 testGetContentType ()
 
 testGetETag ()
 
 testGetETag2 ()
 
 testGetLastModified ()
 
 testGetSize ()
 
 testGetSize2 ()
 
 testACLMethods ()
 
 testOverrideACL ()
 
 testSetACL ()
 Sabre More...
 
 testGetSupportedPrivilegeSet ()
 

Protected Attributes

 $card
 
 $backend
 

Detailed Description

Definition at line 5 of file CardTest.php.

Member Function Documentation

◆ setUp()

Sabre\CardDAV\CardTest::setUp ( )

Definition at line 16 of file CardTest.php.

16  {
17 
18  $this->backend = new Backend\Mock();
19  $this->card = new Card(
20  $this->backend,
21  [
22  'uri' => 'book1',
23  'id' => 'foo',
24  'principaluri' => 'principals/user1',
25  ],
26  [
27  'uri' => 'card1',
28  'addressbookid' => 'foo',
29  'carddata' => 'card',
30  ]
31  );
32 
33  }

◆ testACLMethods()

Sabre\CardDAV\CardTest::testACLMethods ( )

Definition at line 148 of file CardTest.php.

148  {
149 
150  $this->assertEquals('principals/user1', $this->card->getOwner());
151  $this->assertNull($this->card->getGroup());
152  $this->assertEquals([
153  [
154  'privilege' => '{DAV:}all',
155  'principal' => 'principals/user1',
156  'protected' => true,
157  ],
158  ], $this->card->getACL());
159 
160  }

◆ testDelete()

Sabre\CardDAV\CardTest::testDelete ( )

Definition at line 76 of file CardTest.php.

76  {
77 
78  $this->card->delete();
79  $this->assertEquals(1, count($this->backend->cards['foo']));
80 
81  }

◆ testGet()

Sabre\CardDAV\CardTest::testGet ( )

Definition at line 35 of file CardTest.php.

References $result.

35  {
36 
37  $result = $this->card->get();
38  $this->assertEquals('card', $result);
39 
40  }
$result

◆ testGet2()

Sabre\CardDAV\CardTest::testGet2 ( )

Definition at line 41 of file CardTest.php.

References $result.

41  {
42 
43  $this->card = new Card(
44  $this->backend,
45  [
46  'uri' => 'book1',
47  'id' => 'foo',
48  'principaluri' => 'principals/user1',
49  ],
50  [
51  'uri' => 'card1',
52  'addressbookid' => 'foo',
53  ]
54  );
55  $result = $this->card->get();
56  $this->assertEquals("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD", $result);
57 
58  }
$result

◆ testGetContentType()

Sabre\CardDAV\CardTest::testGetContentType ( )

Definition at line 83 of file CardTest.php.

83  {
84 
85  $this->assertEquals('text/vcard; charset=utf-8', $this->card->getContentType());
86 
87  }

◆ testGetETag()

Sabre\CardDAV\CardTest::testGetETag ( )

Definition at line 89 of file CardTest.php.

89  {
90 
91  $this->assertEquals('"' . md5('card') . '"', $this->card->getETag());
92 
93  }

◆ testGetETag2()

Sabre\CardDAV\CardTest::testGetETag2 ( )

Definition at line 95 of file CardTest.php.

References Sabre\CardDAV\CardTest\$card.

95  {
96 
97  $card = new Card(
98  $this->backend,
99  [
100  'uri' => 'book1',
101  'id' => 'foo',
102  'principaluri' => 'principals/user1',
103  ],
104  [
105  'uri' => 'card1',
106  'addressbookid' => 'foo',
107  'carddata' => 'card',
108  'etag' => '"blabla"',
109  ]
110  );
111  $this->assertEquals('"blabla"', $card->getETag());
112 
113  }

◆ testGetLastModified()

Sabre\CardDAV\CardTest::testGetLastModified ( )

Definition at line 115 of file CardTest.php.

115  {
116 
117  $this->assertEquals(null, $this->card->getLastModified());
118 
119  }

◆ testGetSize()

Sabre\CardDAV\CardTest::testGetSize ( )

Definition at line 121 of file CardTest.php.

121  {
122 
123  $this->assertEquals(4, $this->card->getSize());
124  $this->assertEquals(4, $this->card->getSize());
125 
126  }

◆ testGetSize2()

Sabre\CardDAV\CardTest::testGetSize2 ( )

Definition at line 128 of file CardTest.php.

References Sabre\CardDAV\CardTest\$card.

128  {
129 
130  $card = new Card(
131  $this->backend,
132  [
133  'uri' => 'book1',
134  'id' => 'foo',
135  'principaluri' => 'principals/user1',
136  ],
137  [
138  'uri' => 'card1',
139  'addressbookid' => 'foo',
140  'etag' => '"blabla"',
141  'size' => 4,
142  ]
143  );
144  $this->assertEquals(4, $card->getSize());
145 
146  }

◆ testGetSupportedPrivilegeSet()

Sabre\CardDAV\CardTest::testGetSupportedPrivilegeSet ( )

Definition at line 202 of file CardTest.php.

202  {
203 
204  $this->assertNull(
205  $this->card->getSupportedPrivilegeSet()
206  );
207 
208  }

◆ testOverrideACL()

Sabre\CardDAV\CardTest::testOverrideACL ( )

Definition at line 161 of file CardTest.php.

References Sabre\CardDAV\CardTest\$card.

161  {
162 
163  $card = new Card(
164  $this->backend,
165  [
166  'uri' => 'book1',
167  'id' => 'foo',
168  'principaluri' => 'principals/user1',
169  ],
170  [
171  'uri' => 'card1',
172  'addressbookid' => 'foo',
173  'carddata' => 'card',
174  'acl' => [
175  [
176  'privilege' => '{DAV:}read',
177  'principal' => 'principals/user1',
178  'protected' => true,
179  ],
180  ],
181  ]
182  );
183  $this->assertEquals([
184  [
185  'privilege' => '{DAV:}read',
186  'principal' => 'principals/user1',
187  'protected' => true,
188  ],
189  ], $card->getACL());
190 
191  }

◆ testPut()

Sabre\CardDAV\CardTest::testPut ( )

testGet

Definition at line 64 of file CardTest.php.

References $result.

64  {
65 
66  $file = fopen('php://memory', 'r+');
67  fwrite($file, 'newdata');
68  rewind($file);
69  $this->card->put($file);
70  $result = $this->card->get();
71  $this->assertEquals('newdata', $result);
72 
73  }
$result

◆ testSetACL()

Sabre\CardDAV\CardTest::testSetACL ( )

Sabre

Definition at line 196 of file CardTest.php.

196  {
197 
198  $this->card->setACL([]);
199 
200  }

Field Documentation

◆ $backend

Sabre\CardDAV\CardTest::$backend
protected

Definition at line 14 of file CardTest.php.

◆ $card

Sabre\CardDAV\CardTest::$card
protected

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