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

Public Member Functions

 testConstructorShouldThrowExceptionForInvalidMongo ()
 @expectedException InvalidArgumentException More...
 
 testHandle ()
 

Additional Inherited Members

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

Detailed Description

Definition at line 17 of file MongoDBHandlerTest.php.

Member Function Documentation

◆ testConstructorShouldThrowExceptionForInvalidMongo()

Monolog\Handler\MongoDBHandlerTest::testConstructorShouldThrowExceptionForInvalidMongo ( )

@expectedException InvalidArgumentException

Definition at line 22 of file MongoDBHandlerTest.php.

23 {
24 new MongoDBHandler(new \stdClass(), 'DB', 'Collection');
25 }

◆ testHandle()

Monolog\Handler\MongoDBHandlerTest::testHandle ( )

Definition at line 27 of file MongoDBHandlerTest.php.

28 {
29 $mongo = $this->getMock('Mongo', array('selectCollection'), array(), '', false);
30 $collection = $this->getMock('stdClass', array('save'));
31
32 $mongo->expects($this->once())
33 ->method('selectCollection')
34 ->with('DB', 'Collection')
35 ->will($this->returnValue($collection));
36
37 $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
38
39 $expected = array(
40 'message' => 'test',
41 'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34),
42 'level' => Logger::WARNING,
43 'level_name' => 'WARNING',
44 'channel' => 'test',
45 'datetime' => $record['datetime']->format('Y-m-d H:i:s'),
46 'extra' => array(),
47 );
48
49 $collection->expects($this->once())
50 ->method('save')
51 ->with($expected);
52
53 $handler = new MongoDBHandler($mongo, 'DB', 'Collection');
54 $handler->handle($record);
55 }
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19

References Monolog\TestCase\getRecord(), and Monolog\Logger\WARNING.

+ Here is the call graph for this function:

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