ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Monolog\Handler\InsightOpsHandlerTest Class Reference
+ Inheritance diagram for Monolog\Handler\InsightOpsHandlerTest:
+ Collaboration diagram for Monolog\Handler\InsightOpsHandlerTest:

Public Member Functions

 testWriteContent ()
 
 testWriteBatchContent ()
 

Private Member Functions

 createHandler ()
 

Private Attributes

 $resource
 
 $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
Gabriel Machado gabri.nosp@m.el.m.nosp@m.s1@ho.nosp@m.tmai.nosp@m.l.com

Definition at line 21 of file InsightOpsHandlerTest.php.

Member Function Documentation

◆ createHandler()

Monolog\Handler\InsightOpsHandlerTest::createHandler ( )
private

Definition at line 55 of file InsightOpsHandlerTest.php.

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

References Monolog\Logger\DEBUG.

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

+ Here is the caller graph for this function:

◆ testWriteBatchContent()

Monolog\Handler\InsightOpsHandlerTest::testWriteBatchContent ( )

Definition at line 44 of file InsightOpsHandlerTest.php.

45 {
46 $this->createHandler();
47 $this->handler->handleBatch($this->getMultipleRecords());
48
49 fseek($this->resource, 0);
50 $content = fread($this->resource, 1024);
51
52 $this->assertRegexp('/(testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] .* \[\] \[\]\n){3}/', $content);
53 }

References Monolog\Handler\InsightOpsHandlerTest\createHandler(), and Monolog\TestCase\getMultipleRecords().

+ Here is the call graph for this function:

◆ testWriteContent()

Monolog\Handler\InsightOpsHandlerTest::testWriteContent ( )

Definition at line 33 of file InsightOpsHandlerTest.php.

34 {
35 $this->createHandler();
36 $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Critical write test'));
37
38 fseek($this->resource, 0);
39 $content = fread($this->resource, 1024);
40
41 $this->assertRegexp('/testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] test.CRITICAL: Critical write test/', $content);
42 }
const CRITICAL
Critical conditions.
Definition: Logger.php:65
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19

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

+ Here is the call graph for this function:

Field Documentation

◆ $handler

Monolog\Handler\InsightOpsHandlerTest::$handler
private

Definition at line 31 of file InsightOpsHandlerTest.php.

◆ $resource

Monolog\Handler\InsightOpsHandlerTest::$resource
private

Definition at line 26 of file InsightOpsHandlerTest.php.


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