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

Public Member Functions

 setUpTree ()
 Override this to provide your own Tree for your test-case. More...
 
 testFeatures ()
 
 testProperties ()
 
 testGetPluginInfo ()
 
 testHtmlActionsPanel ()
 
 testBrowserPostActionUnknownAction ()
 
 testBrowserPostActionSuccess ()
 
 testBrowserPostActionNoHref ()
 @expectedException \Sabre\DAV\Exception\BadRequest More...
 
 testBrowserPostActionNoAccess ()
 @expectedException \Sabre\DAV\Exception\BadRequest More...
 
 testBrowserPostActionBadAccess ()
 @expectedException \Sabre\DAV\Exception\BadRequest More...
 
 testBrowserPostActionAccessDenied ()
 @expectedException \Sabre\DAV\Exception\Forbidden More...
 
- 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
 
 $setupACL = true
 
 $autoLogin = 'admin'
 
- 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 8 of file PluginTest.php.

Member Function Documentation

◆ setUpTree()

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

Override this to provide your own Tree for your test-case.

Reimplemented from Sabre\DAVServerTest.

Definition at line 14 of file PluginTest.php.

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

References Sabre\DAV\Sharing\Plugin\ACCESS_READWRITE.

◆ testBrowserPostActionAccessDenied()

Sabre\DAV\Sharing\PluginTest::testBrowserPostActionAccessDenied ( )

@expectedException \Sabre\DAV\Exception\Forbidden

Definition at line 176 of file PluginTest.php.

176 {
177
178 $this->aclPlugin->setDefaultAcl([]);
179 $this->sharingPlugin->browserPostAction(
180 'shareable',
181 'share',
182 [
183 'access' => 'read',
184 'href' => 'mailto:foo@example.org',
185 ]
186 );
187
188 }

◆ testBrowserPostActionBadAccess()

Sabre\DAV\Sharing\PluginTest::testBrowserPostActionBadAccess ( )

@expectedException \Sabre\DAV\Exception\BadRequest

Definition at line 160 of file PluginTest.php.

160 {
161
162 $this->sharingPlugin->browserPostAction(
163 'shareable',
164 'share',
165 [
166 'href' => 'mailto:foo@example.org',
167 'access' => 'bleed',
168 ]
169 );
170
171 }

◆ testBrowserPostActionNoAccess()

Sabre\DAV\Sharing\PluginTest::testBrowserPostActionNoAccess ( )

@expectedException \Sabre\DAV\Exception\BadRequest

Definition at line 144 of file PluginTest.php.

144 {
145
146 $this->sharingPlugin->browserPostAction(
147 'shareable',
148 'share',
149 [
150 'href' => 'mailto:foo@example.org',
151 ]
152 );
153
154 }

◆ testBrowserPostActionNoHref()

Sabre\DAV\Sharing\PluginTest::testBrowserPostActionNoHref ( )

@expectedException \Sabre\DAV\Exception\BadRequest

Definition at line 129 of file PluginTest.php.

129 {
130
131 $this->sharingPlugin->browserPostAction(
132 'shareable',
133 'share',
134 [
135 'access' => 'read',
136 ]
137 );
138
139 }

◆ testBrowserPostActionSuccess()

Sabre\DAV\Sharing\PluginTest::testBrowserPostActionSuccess ( )

Definition at line 101 of file PluginTest.php.

101 {
102
103 $this->assertFalse($this->sharingPlugin->browserPostAction(
104 'shareable',
105 'share',
106 [
107 'access' => 'read',
108 'href' => 'mailto:foo@example.org',
109 ]
110 ));
111
112 $expected = [
113 new \Sabre\DAV\Xml\Element\Sharee([
114 'href' => 'mailto:foo@example.org',
115 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
116 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE,
117 ])
118 ];
119 $this->assertEquals(
120 $expected,
121 $this->tree[0]->getInvites()
122 );
123
124 }

References Sabre\DAV\Sharing\Plugin\ACCESS_READ, and Sabre\DAV\Sharing\Plugin\INVITE_NORESPONSE.

◆ testBrowserPostActionUnknownAction()

Sabre\DAV\Sharing\PluginTest::testBrowserPostActionUnknownAction ( )

Definition at line 91 of file PluginTest.php.

91 {
92
93 $this->assertNull($this->sharingPlugin->browserPostAction(
94 'shareable',
95 'foo',
96 []
97 ));
98
99 }

◆ testFeatures()

Sabre\DAV\Sharing\PluginTest::testFeatures ( )

Definition at line 23 of file PluginTest.php.

23 {
24
25 $this->assertEquals(
26 ['resource-sharing'],
27 $this->sharingPlugin->getFeatures()
28 );
29
30 }

◆ testGetPluginInfo()

Sabre\DAV\Sharing\PluginTest::testGetPluginInfo ( )

Definition at line 56 of file PluginTest.php.

56 {
57
58 $result = $this->sharingPlugin->getPluginInfo();
59 $this->assertInternalType('array', $result);
60 $this->assertEquals('sharing', $result['name']);
61
62 }
$result

References $result.

◆ testHtmlActionsPanel()

Sabre\DAV\Sharing\PluginTest::testHtmlActionsPanel ( )

Definition at line 64 of file PluginTest.php.

64 {
65
66 $node = new \Sabre\DAV\Mock\Collection('foo');
67 $html = '';
68
69 $this->assertNull(
70 $this->sharingPlugin->htmlActionsPanel($node, $html, 'foo/bar')
71 );
72
73 $this->assertEquals(
74 '',
75 $html
76 );
77
78 $node = new \Sabre\DAV\Mock\SharedNode('foo', \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER);
79 $html = '';
80
81 $this->assertNull(
82 $this->sharingPlugin->htmlActionsPanel($node, $html, 'shareable')
83 );
84 $this->assertContains(
85 'Share this resource',
86 $html
87 );
88
89 }
$html
Definition: example_001.php:87

References $html, and Sabre\DAV\Sharing\Plugin\ACCESS_SHAREDOWNER.

◆ testProperties()

Sabre\DAV\Sharing\PluginTest::testProperties ( )

Definition at line 32 of file PluginTest.php.

32 {
33
34 $result = $this->server->getPropertiesForPath(
35 'shareable',
36 ['{DAV:}share-access']
37 );
38
39 $expected = [
40 [
41 200 => [
42 '{DAV:}share-access' => new Property\ShareAccess(Plugin::ACCESS_READWRITE)
43 ],
44 404 => [],
45 'href' => 'shareable',
46 ]
47 ];
48
49 $this->assertEquals(
50 $expected,
52 );
53
54 }

References $result, and Sabre\DAV\Sharing\Plugin\ACCESS_READWRITE.

Field Documentation

◆ $autoLogin

Sabre\DAV\Sharing\PluginTest::$autoLogin = 'admin'
protected

Definition at line 12 of file PluginTest.php.

◆ $setupACL

Sabre\DAV\Sharing\PluginTest::$setupACL = true
protected

Definition at line 11 of file PluginTest.php.

◆ $setupSharing

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

Definition at line 10 of file PluginTest.php.


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