ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Monolog\Handler\LogEntriesHandlerTest Class Reference
+ Inheritance diagram for Monolog\Handler\LogEntriesHandlerTest:
+ Collaboration diagram for Monolog\Handler\LogEntriesHandlerTest:

Public Member Functions

 testWriteContent ()
 
 testWriteBatchContent ()
 

Private Member Functions

 createHandler ()
 

Private Attributes

 $res
 
 $handler
 

Additional Inherited Members

- Protected Member Functions inherited from Monolog\TestCase
 getRecord ($level=Logger::WARNING, $message='test', $context=array())
 
 getMultipleRecords ()
 
 getIdentityFormatter ()
 

Detailed Description

Author
Robert Kaufmann III rok3@.nosp@m.rok3.nosp@m..me

Definition at line 20 of file LogEntriesHandlerTest.php.

Member Function Documentation

◆ createHandler()

Monolog\Handler\LogEntriesHandlerTest::createHandler ( )
private

Definition at line 59 of file LogEntriesHandlerTest.php.

60 {
61 $useSSL = extension_loaded('openssl');
62 $args = array('testToken', $useSSL, Logger::DEBUG, true);
63 $this->res = fopen('php://memory', 'a');
64 $this->handler = $this->getMock(
65 '\Monolog\Handler\LogEntriesHandler',
66 array('fsockopen', 'streamSetTimeout', 'closeSocket'),
67 $args
68 );
69
70 $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
71 $reflectionProperty->setAccessible(true);
72 $reflectionProperty->setValue($this->handler, 'localhost:1234');
73
74 $this->handler->expects($this->any())
75 ->method('fsockopen')
76 ->will($this->returnValue($this->res));
77 $this->handler->expects($this->any())
78 ->method('streamSetTimeout')
79 ->will($this->returnValue(true));
80 $this->handler->expects($this->any())
81 ->method('closeSocket')
82 ->will($this->returnValue(true));
83 }
const DEBUG
Detailed debug information.
Definition: Logger.php:32

References Monolog\Logger\DEBUG.

Referenced by Monolog\Handler\LogEntriesHandlerTest\testWriteBatchContent(), and Monolog\Handler\LogEntriesHandlerTest\testWriteContent().

+ Here is the caller graph for this function:

◆ testWriteBatchContent()

Monolog\Handler\LogEntriesHandlerTest::testWriteBatchContent ( )

Definition at line 43 of file LogEntriesHandlerTest.php.

44 {
45 $records = array(
46 $this->getRecord(),
47 $this->getRecord(),
48 $this->getRecord()
49 );
50 $this->createHandler();
51 $this->handler->handleBatch($records);
52
53 fseek($this->res, 0);
54 $content = fread($this->res, 1024);
55
56 $this->assertRegexp('/(testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] .* \[\] \[\]\n){3}/', $content);
57 }
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$records
Definition: simple_test.php:17

References $records, Monolog\Handler\LogEntriesHandlerTest\createHandler(), and Monolog\TestCase\getRecord().

+ Here is the call graph for this function:

◆ testWriteContent()

Monolog\Handler\LogEntriesHandlerTest::testWriteContent ( )

Definition at line 32 of file LogEntriesHandlerTest.php.

33 {
34 $this->createHandler();
35 $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Critical write test'));
36
37 fseek($this->res, 0);
38 $content = fread($this->res, 1024);
39
40 $this->assertRegexp('/testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] test.CRITICAL: Critical write test/', $content);
41 }
const CRITICAL
Critical conditions.
Definition: Logger.php:64

References Monolog\Handler\LogEntriesHandlerTest\createHandler(), Monolog\Logger\CRITICAL, and Monolog\TestCase\getRecord().

+ Here is the call graph for this function:

Field Documentation

◆ $handler

Monolog\Handler\LogEntriesHandlerTest::$handler
private

Definition at line 30 of file LogEntriesHandlerTest.php.

◆ $res

Monolog\Handler\LogEntriesHandlerTest::$res
private

Definition at line 25 of file LogEntriesHandlerTest.php.


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