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

Public Member Functions

 setUp ()
 
 trueFalseDataProvider ()
 
 testIsHandling ($result)
 
 testHandle ($result)
 
 testHandleBatch ($result)
 
 testPushProcessor ()
 
 testPopProcessor ()
 
 testSetFormatter ()
 
 testGetFormatter ()
 

Private Attributes

 $wrapper
 
 $handler
 

Additional Inherited Members

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

Detailed Description

Author
Alexey Karapetov alexe.nosp@m.y@ka.nosp@m.rapet.nosp@m.ov.c.nosp@m.om

Definition at line 19 of file HandlerWrapperTest.php.

Member Function Documentation

◆ setUp()

Monolog\Handler\HandlerWrapperTest::setUp ( )

Definition at line 28 of file HandlerWrapperTest.php.

29  {
30  parent::setUp();
31  $this->handler = $this->getMock('Monolog\\Handler\\HandlerInterface');
32  $this->wrapper = new HandlerWrapper($this->handler);
33  }

◆ testGetFormatter()

Monolog\Handler\HandlerWrapperTest::testGetFormatter ( )

Definition at line 121 of file HandlerWrapperTest.php.

References Sabre\Event\once().

122  {
123  $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
124  $this->handler->expects($this->once())
125  ->method('getFormatter')
126  ->willReturn($formatter);
127 
128  $this->assertEquals($formatter, $this->wrapper->getFormatter());
129  }
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
+ Here is the call graph for this function:

◆ testHandle()

Monolog\Handler\HandlerWrapperTest::testHandle (   $result)
Parameters
$resulttrueFalseDataProvider

Definition at line 65 of file HandlerWrapperTest.php.

References $result, Monolog\TestCase\getRecord(), and Sabre\Event\once().

66  {
67  $record = $this->getRecord();
68  $this->handler->expects($this->once())
69  ->method('handle')
70  ->with($record)
71  ->willReturn($result);
72 
73  $this->assertEquals($result, $this->wrapper->handle($record));
74  }
$result
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
+ Here is the call graph for this function:

◆ testHandleBatch()

Monolog\Handler\HandlerWrapperTest::testHandleBatch (   $result)
Parameters
$resulttrueFalseDataProvider

Definition at line 80 of file HandlerWrapperTest.php.

References $records, $result, Monolog\TestCase\getMultipleRecords(), and Sabre\Event\once().

81  {
82  $records = $this->getMultipleRecords();
83  $this->handler->expects($this->once())
84  ->method('handleBatch')
85  ->with($records)
86  ->willReturn($result);
87 
88  $this->assertEquals($result, $this->wrapper->handleBatch($records));
89  }
$result
$records
Definition: simple_test.php:22
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
+ Here is the call graph for this function:

◆ testIsHandling()

Monolog\Handler\HandlerWrapperTest::testIsHandling (   $result)
Parameters
$resulttrueFalseDataProvider

Definition at line 50 of file HandlerWrapperTest.php.

References $result, Monolog\TestCase\getRecord(), and Sabre\Event\once().

51  {
52  $record = $this->getRecord();
53  $this->handler->expects($this->once())
54  ->method('isHandling')
55  ->with($record)
56  ->willReturn($result);
57 
58  $this->assertEquals($result, $this->wrapper->isHandling($record));
59  }
$result
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
+ Here is the call graph for this function:

◆ testPopProcessor()

Monolog\Handler\HandlerWrapperTest::testPopProcessor ( )

Definition at line 101 of file HandlerWrapperTest.php.

References Sabre\Event\once().

102  {
103  $processor = function () {};
104  $this->handler->expects($this->once())
105  ->method('popProcessor')
106  ->willReturn($processor);
107 
108  $this->assertEquals($processor, $this->wrapper->popProcessor());
109  }
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
+ Here is the call graph for this function:

◆ testPushProcessor()

Monolog\Handler\HandlerWrapperTest::testPushProcessor ( )

Definition at line 91 of file HandlerWrapperTest.php.

References Sabre\Event\once().

92  {
93  $processor = function () {};
94  $this->handler->expects($this->once())
95  ->method('pushProcessor')
96  ->with($processor);
97 
98  $this->assertEquals($this->wrapper, $this->wrapper->pushProcessor($processor));
99  }
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
+ Here is the call graph for this function:

◆ testSetFormatter()

Monolog\Handler\HandlerWrapperTest::testSetFormatter ( )

Definition at line 111 of file HandlerWrapperTest.php.

References Sabre\Event\once().

112  {
113  $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
114  $this->handler->expects($this->once())
115  ->method('setFormatter')
116  ->with($formatter);
117 
118  $this->assertEquals($this->wrapper, $this->wrapper->setFormatter($formatter));
119  }
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
+ Here is the call graph for this function:

◆ trueFalseDataProvider()

Monolog\Handler\HandlerWrapperTest::trueFalseDataProvider ( )
Returns
array

Definition at line 38 of file HandlerWrapperTest.php.

39  {
40  return array(
41  array(true),
42  array(false),
43  );
44  }

Field Documentation

◆ $handler

Monolog\Handler\HandlerWrapperTest::$handler
private

Definition at line 26 of file HandlerWrapperTest.php.

◆ $wrapper

Monolog\Handler\HandlerWrapperTest::$wrapper
private

Definition at line 24 of file HandlerWrapperTest.php.


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