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

Public Member Functions

 testIsLoggerAware ()
 
 testGetNullLoggerByDefault ()
 
 testSetLogger ()
 
 testLogException ()
 Start the server, trigger an exception and see if the logger captured it. More...
 

Detailed Description

Definition at line 5 of file PSR3Test.php.

Member Function Documentation

◆ testGetNullLoggerByDefault()

Sabre\DAV\PSR3Test::testGetNullLoggerByDefault ( )

Definition at line 17 of file PSR3Test.php.

References $server.

17  {
18 
19  $server = new Server();
20  $this->assertInstanceOf(
21  'Psr\Log\NullLogger',
22  $server->getLogger()
23  );
24 
25  }
$server
Definition: sabredav.php:48

◆ testIsLoggerAware()

Sabre\DAV\PSR3Test::testIsLoggerAware ( )

Definition at line 7 of file PSR3Test.php.

References $server.

7  {
8 
9  $server = new Server();
10  $this->assertInstanceOf(
11  'Psr\Log\LoggerAwareInterface',
12  $server
13  );
14 
15  }
$server
Definition: sabredav.php:48

◆ testLogException()

Sabre\DAV\PSR3Test::testLogException ( )

Start the server, trigger an exception and see if the logger captured it.

Definition at line 45 of file PSR3Test.php.

References $request, $response, and $server.

45  {
46 
47  $server = new Server();
48  $logger = new MockLogger();
49 
50  $server->setLogger($logger);
51 
52  // Creating a fake environment to execute http requests in.
53  $request = new \Sabre\HTTP\Request(
54  'GET',
55  '/not-found',
56  []
57  );
58  $response = new \Sabre\HTTP\Response();
59 
60  $server->httpRequest = $request;
61  $server->httpResponse = $response;
62  $server->sapi = new \Sabre\HTTP\SapiMock();
63 
64  // Executing the request.
65  $server->exec();
66 
67  // The request should have triggered a 404 status.
68  $this->assertEquals(404, $response->getStatus());
69 
70  // We should also see this in the PSR-3 log.
71  $this->assertEquals(1, count($logger->logs));
72 
73  $logItem = $logger->logs[0];
74 
75  $this->assertEquals(
76  \Psr\Log\LogLevel::INFO,
77  $logItem[0]
78  );
79 
80  $this->assertInstanceOf(
81  'Exception',
82  $logItem[2]['exception']
83  );
84 
85  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
$server
Definition: sabredav.php:48
$response

◆ testSetLogger()

Sabre\DAV\PSR3Test::testSetLogger ( )

Definition at line 27 of file PSR3Test.php.

References $server.

27  {
28 
29  $server = new Server();
30  $logger = new MockLogger();
31 
32  $server->setLogger($logger);
33 
34  $this->assertEquals(
35  $logger,
36  $server->getLogger()
37  );
38 
39  }
$server
Definition: sabredav.php:48

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