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

Public Member Functions

 setUpTree ()
 
 testShareResource ()
 
 testShareResourceRemoveAccess ()
 testShareResource More...
 
 testShareResourceInviteProperty ()
 testShareResource More...
 
 testShareResourceNotFound ()
 
 testShareResourceNotISharedNode ()
 
 testShareResourceUnknownDoc ()
 
- Public Member Functions inherited from Sabre\DAVServerTest
 setUp ()
 
 initializeEverything ()
 
 request ($request, $expectedStatus=null)
 Makes a request, and returns a response object. More...
 
 autoLogin ($userName)
 This function takes a username and sets the server in a state where this user is logged in, and no longer requires an authentication check. More...
 
 setUpTree ()
 Override this to provide your own Tree for your test-case. More...
 
 setUpBackends ()
 
 assertHttpStatus ($expectedStatus, HTTP\Request $req)
 

Protected Attributes

 $setupSharing = true
 
 $sharingNodeMock
 
- Protected Attributes inherited from Sabre\DAVServerTest
 $setupCalDAV = false
 
 $setupCardDAV = false
 
 $setupACL = false
 
 $setupCalDAVSharing = false
 
 $setupCalDAVScheduling = false
 
 $setupCalDAVSubscriptions = false
 
 $setupCalDAVICSExport = false
 
 $setupLocks = false
 
 $setupFiles = false
 
 $setupSharing = false
 
 $setupPropertyStorage = false
 
 $caldavCalendars = []
 An array with calendars. More...
 
 $caldavCalendarObjects = []
 
 $carddavAddressBooks = []
 
 $carddavCards = []
 
 $server
 
 $tree = []
 
 $caldavBackend
 
 $carddavBackend
 
 $principalBackend
 
 $locksBackend
 
 $propertyStorageBackend
 
 $caldavPlugin
 
 $carddavPlugin
 
 $aclPlugin
 
 $caldavSharingPlugin
 
 $caldavSchedulePlugin
 
 $authPlugin
 
 $locksPlugin
 
 $sharingPlugin
 
 $propertyStoragePlugin
 
 $autoLogin = null
 If this string is set, we will automatically log in the user with this name. More...
 

Detailed Description

Definition at line 9 of file ShareResourceTest.php.

Member Function Documentation

◆ setUpTree()

Sabre\DAV\Sharing\ShareResourceTest::setUpTree ( )

Definition at line 14 of file ShareResourceTest.php.

References Sabre\DAV\Sharing\Plugin\ACCESS_SHAREDOWNER.

14  {
15 
16  $this->tree[] = $this->sharingNodeMock = new Mock\SharedNode(
17  'shareable',
19  );
20 
21  }

◆ testShareResource()

Sabre\DAV\Sharing\ShareResourceTest::testShareResource ( )

Definition at line 23 of file ShareResourceTest.php.

References $request, $response, Sabre\DAV\Sharing\Plugin\ACCESS_READWRITE, comment(), Sabre\DAV\Sharing\Plugin\INVITE_NORESPONSE, Sabre\DAVServerTest\request(), and Sabre\VObject\write().

Referenced by Sabre\DAV\Sharing\ShareResourceTest\testShareResourceInviteProperty(), and Sabre\DAV\Sharing\ShareResourceTest\testShareResourceRemoveAccess().

23  {
24 
25  $body = <<<XML
26 <?xml version="1.0" encoding="utf-8" ?>
27 <D:share-resource xmlns:D="DAV:">
28  <D:sharee>
29  <D:href>mailto:eric@example.com</D:href>
30  <D:prop>
31  <D:displayname>Eric York</D:displayname>
32  </D:prop>
33  <D:comment>Shared workspace</D:comment>
34  <D:share-access>
35  <D:read-write />
36  </D:share-access>
37  </D:sharee>
38 </D:share-resource>
39 XML;
40  $request = new Request('POST', '/shareable', ['Content-Type' => 'application/davsharing+xml; charset="utf-8"'], $body);
41 
42  $response = $this->request($request);
43  $this->assertEquals(200, $response->getStatus(), (string)$response->getBodyAsString());
44 
45  $expected = [
46  new Sharee([
47  'href' => 'mailto:eric@example.com',
48  'properties' => [
49  '{DAV:}displayname' => 'Eric York',
50  ],
51  'access' => Plugin::ACCESS_READWRITE,
52  'comment' => 'Shared workspace',
53  'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE,
54  ])
55  ];
56 
57  $this->assertEquals(
58  $expected,
59  $this->sharingNodeMock->getInvites()
60  );
61 
62  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
comment()
Definition: comment.php:2
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testShareResourceInviteProperty()

Sabre\DAV\Sharing\ShareResourceTest::testShareResourceInviteProperty ( )

testShareResource

Definition at line 102 of file ShareResourceTest.php.

References $request, $response, Sabre\DAVServerTest\request(), Sabre\DAV\Sharing\ShareResourceTest\testShareResource(), and Sabre\VObject\write().

102  {
103 
104  // First we just want to execute all the actions from the first
105  // test.
106  $this->testShareResource();
107 
108  $body = <<<XML
109 <?xml version="1.0" encoding="utf-8" ?>
110 <D:propfind xmlns:D="DAV:">
111  <D:prop>
112  <D:invite />
113  <D:share-access />
114  <D:share-resource-uri />
115  </D:prop>
116 </D:propfind>
117 XML;
118  $request = new Request('PROPFIND', '/shareable', ['Content-Type' => 'application/xml'], $body);
119  $response = $this->request($request);
120 
121  $this->assertEquals(207, $response->getStatus());
122 
123  $expected = <<<XML
124 <?xml version="1.0" encoding="utf-8" ?>
125 <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
126  <d:response>
127  <d:href>/shareable</d:href>
128  <d:propstat>
129  <d:prop>
130  <d:invite>
131  <d:sharee>
132  <d:href>mailto:eric@example.com</d:href>
133  <d:prop>
134  <d:displayname>Eric York</d:displayname>
135  </d:prop>
136  <d:share-access><d:read-write /></d:share-access>
137  <d:invite-noresponse />
138  </d:sharee>
139  </d:invite>
140  <d:share-access><d:shared-owner /></d:share-access>
141  <d:share-resource-uri><d:href>urn:example:bar</d:href></d:share-resource-uri>
142  </d:prop>
143  <d:status>HTTP/1.1 200 OK</d:status>
144  </d:propstat>
145  </d:response>
146 </d:multistatus>
147 XML;
148 
149  $this->assertXmlStringEqualsXmlString($expected, $response->getBodyAsString());
150 
151  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testShareResourceNotFound()

Sabre\DAV\Sharing\ShareResourceTest::testShareResourceNotFound ( )

Definition at line 153 of file ShareResourceTest.php.

References $request, $response, comment(), Sabre\DAVServerTest\request(), and Sabre\VObject\write().

153  {
154 
155  $body = <<<XML
156 <?xml version="1.0" encoding="utf-8" ?>
157 <D:share-resource xmlns:D="DAV:">
158  <D:sharee>
159  <D:href>mailto:eric@example.com</D:href>
160  <D:prop>
161  <D:displayname>Eric York</D:displayname>
162  </D:prop>
163  <D:comment>Shared workspace</D:comment>
164  <D:share-access>
165  <D:read-write />
166  </D:share-access>
167  </D:sharee>
168 </D:share-resource>
169 XML;
170  $request = new Request('POST', '/not-found', ['Content-Type' => 'application/davsharing+xml; charset="utf-8"'], $body);
171 
172  $response = $this->request($request, 404);
173 
174  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
comment()
Definition: comment.php:2
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testShareResourceNotISharedNode()

Sabre\DAV\Sharing\ShareResourceTest::testShareResourceNotISharedNode ( )

Definition at line 176 of file ShareResourceTest.php.

References $request, $response, comment(), Sabre\DAVServerTest\request(), and Sabre\VObject\write().

176  {
177 
178  $body = <<<XML
179 <?xml version="1.0" encoding="utf-8" ?>
180 <D:share-resource xmlns:D="DAV:">
181  <D:sharee>
182  <D:href>mailto:eric@example.com</D:href>
183  <D:prop>
184  <D:displayname>Eric York</D:displayname>
185  </D:prop>
186  <D:comment>Shared workspace</D:comment>
187  <D:share-access>
188  <D:read-write />
189  </D:share-access>
190  </D:sharee>
191 </D:share-resource>
192 XML;
193  $request = new Request('POST', '/', ['Content-Type' => 'application/davsharing+xml; charset="utf-8"'], $body);
194 
195  $response = $this->request($request, 403);
196 
197  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
comment()
Definition: comment.php:2
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testShareResourceRemoveAccess()

Sabre\DAV\Sharing\ShareResourceTest::testShareResourceRemoveAccess ( )

testShareResource

Definition at line 67 of file ShareResourceTest.php.

References $request, $response, Sabre\DAVServerTest\request(), and Sabre\DAV\Sharing\ShareResourceTest\testShareResource().

67  {
68 
69  // First we just want to execute all the actions from the first
70  // test.
71  $this->testShareResource();
72 
73  $body = <<<XML
74 <?xml version="1.0" encoding="utf-8" ?>
75 <D:share-resource xmlns:D="DAV:">
76  <D:sharee>
77  <D:href>mailto:eric@example.com</D:href>
78  <D:share-access>
79  <D:no-access />
80  </D:share-access>
81  </D:sharee>
82 </D:share-resource>
83 XML;
84  $request = new Request('POST', '/shareable', ['Content-Type' => 'application/davsharing+xml; charset="utf-8"'], $body);
85 
86  $response = $this->request($request);
87  $this->assertEquals(200, $response->getStatus(), (string)$response->getBodyAsString());
88 
89  $expected = [];
90 
91  $this->assertEquals(
92  $expected,
93  $this->sharingNodeMock->getInvites()
94  );
95 
96 
97  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testShareResourceUnknownDoc()

Sabre\DAV\Sharing\ShareResourceTest::testShareResourceUnknownDoc ( )

Definition at line 199 of file ShareResourceTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

199  {
200 
201  $body = <<<XML
202 <?xml version="1.0" encoding="utf-8" ?>
203 <D:blablabla xmlns:D="DAV:" />
204 XML;
205  $request = new Request('POST', '/shareable', ['Content-Type' => 'application/davsharing+xml; charset="utf-8"'], $body);
206  $response = $this->request($request, 400);
207 
208  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

Field Documentation

◆ $setupSharing

Sabre\DAV\Sharing\ShareResourceTest::$setupSharing = true
protected

Definition at line 11 of file ShareResourceTest.php.

◆ $sharingNodeMock

Sabre\DAV\Sharing\ShareResourceTest::$sharingNodeMock
protected

Definition at line 12 of file ShareResourceTest.php.


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