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

Public Member Functions

 setUp ()
 
 testNoAdminAccess ()
 
 testAdminAccess ()
 testNoAdminAccess More...
 

Data Fields

 $server
 

Detailed Description

Definition at line 11 of file PluginAdminTest.php.

Member Function Documentation

◆ setUp()

Sabre\DAVACL\PluginAdminTest::setUp ( )

Definition at line 15 of file PluginAdminTest.php.

References $principalBackend, and $tree.

15  {
16 
17  $principalBackend = new PrincipalBackend\Mock();
18 
19  $tree = [
20  new MockACLNode('adminonly', []),
21  new PrincipalCollection($principalBackend),
22  ];
23 
24  $this->server = new DAV\Server($tree);
25  $this->server->sapi = new HTTP\SapiMock();
26  $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
27  $this->server->addPlugin($plugin);
28  }
$principalBackend

◆ testAdminAccess()

Sabre\DAVACL\PluginAdminTest::testAdminAccess ( )

testNoAdminAccess

Definition at line 55 of file PluginAdminTest.php.

References $request, $response, and Sabre\HTTP\Sapi\createFromServerArray().

55  {
56 
57  $plugin = new Plugin();
58  $plugin->adminPrincipals = [
59  'principals/admin',
60  ];
61  $this->server->addPlugin($plugin);
62 
64  'REQUEST_METHOD' => 'OPTIONS',
65  'HTTP_DEPTH' => 1,
66  'REQUEST_URI' => '/adminonly',
67  ]);
68 
69  $response = new HTTP\ResponseMock();
70 
71  $this->server->httpRequest = $request;
72  $this->server->httpResponse = $response;
73 
74  $this->server->exec();
75 
76  $this->assertEquals(200, $response->status);
77 
78  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
$response
+ Here is the call graph for this function:

◆ testNoAdminAccess()

Sabre\DAVACL\PluginAdminTest::testNoAdminAccess ( )

Definition at line 30 of file PluginAdminTest.php.

References $request, $response, and Sabre\HTTP\Sapi\createFromServerArray().

30  {
31 
32  $plugin = new Plugin();
33  $this->server->addPlugin($plugin);
34 
36  'REQUEST_METHOD' => 'OPTIONS',
37  'HTTP_DEPTH' => 1,
38  'REQUEST_URI' => '/adminonly',
39  ]);
40 
41  $response = new HTTP\ResponseMock();
42 
43  $this->server->httpRequest = $request;
44  $this->server->httpResponse = $response;
45 
46  $this->server->exec();
47 
48  $this->assertEquals(403, $response->status);
49 
50  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
$response
+ Here is the call graph for this function:

Field Documentation

◆ $server

Sabre\DAVACL\PluginAdminTest::$server

Definition at line 13 of file PluginAdminTest.php.


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