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

Public Member Functions

 testExceptionLogLevel ()
 When reporting exceptions to Rollbar the level has to be set in the payload data. More...
 

Data Fields

 $reportedExceptionArguments = null
 

Protected Member Functions

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

Private Member Functions

 setupRollbarNotifierMock ()
 
 createHandler ()
 
 createExceptionRecord ($level=Logger::DEBUG, $message='test', $exception=null)
 

Private Attributes

 $rollbarNotifier
 

Detailed Description

Member Function Documentation

◆ createExceptionRecord()

Monolog\Handler\RollbarHandlerTest::createExceptionRecord (   $level = Logger::DEBUG,
  $message = 'test',
  $exception = null 
)
private

Definition at line 78 of file RollbarHandlerTest.php.

References $message, and Monolog\TestCase\getRecord().

Referenced by Monolog\Handler\RollbarHandlerTest\testExceptionLogLevel().

79  {
80  return $this->getRecord($level, $message, array(
81  'exception' => $exception ?: new Exception()
82  ));
83  }
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
catch(Exception $e) $message
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createHandler()

Monolog\Handler\RollbarHandlerTest::createHandler ( )
private

Definition at line 73 of file RollbarHandlerTest.php.

References Monolog\Logger\DEBUG.

Referenced by Monolog\Handler\RollbarHandlerTest\testExceptionLogLevel().

74  {
75  return new RollbarHandler($this->rollbarNotifier, Logger::DEBUG);
76  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
+ Here is the caller graph for this function:

◆ setUp()

Monolog\Handler\RollbarHandlerTest::setUp ( )
protected

Definition at line 37 of file RollbarHandlerTest.php.

References Monolog\Handler\RollbarHandlerTest\setupRollbarNotifierMock().

38  {
39  parent::setUp();
40 
41  $this->setupRollbarNotifierMock();
42  }
+ Here is the call graph for this function:

◆ setupRollbarNotifierMock()

Monolog\Handler\RollbarHandlerTest::setupRollbarNotifierMock ( )
private

Definition at line 57 of file RollbarHandlerTest.php.

References $context.

Referenced by Monolog\Handler\RollbarHandlerTest\setUp().

58  {
59  $this->rollbarNotifier = $this->getMockBuilder('RollbarNotifier')
60  ->setMethods(array('report_message', 'report_exception', 'flush'))
61  ->getMock();
62 
63  $that = $this;
64 
65  $this->rollbarNotifier
66  ->expects($this->any())
67  ->method('report_exception')
68  ->willReturnCallback(function ($exception, $context, $payload) use ($that) {
69  $that->reportedExceptionArguments = compact('exception', 'context', 'payload');
70  });
71  }
$context
Definition: webdav.php:25
+ Here is the caller graph for this function:

◆ testExceptionLogLevel()

Monolog\Handler\RollbarHandlerTest::testExceptionLogLevel ( )

When reporting exceptions to Rollbar the level has to be set in the payload data.

Definition at line 48 of file RollbarHandlerTest.php.

References $handler, Monolog\Handler\RollbarHandlerTest\createExceptionRecord(), Monolog\Handler\RollbarHandlerTest\createHandler(), and Monolog\Logger\DEBUG.

49  {
50  $handler = $this->createHandler();
51 
53 
54  $this->assertEquals('debug', $this->reportedExceptionArguments['payload']['level']);
55  }
createExceptionRecord($level=Logger::DEBUG, $message='test', $exception=null)
const DEBUG
Detailed debug information.
Definition: Logger.php:33
$handler
+ Here is the call graph for this function:

Field Documentation

◆ $reportedExceptionArguments

Monolog\Handler\RollbarHandlerTest::$reportedExceptionArguments = null

Definition at line 35 of file RollbarHandlerTest.php.

◆ $rollbarNotifier

Monolog\Handler\RollbarHandlerTest::$rollbarNotifier
private

Definition at line 30 of file RollbarHandlerTest.php.


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