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

Public Member Functions

 testConstructorShouldThrowExceptionForInvalidRedis ()
 InvalidArgumentException More...
 
 testConstructorShouldWorkWithPredis ()
 
 testConstructorShouldWorkWithRedis ()
 
 testPredisHandle ()
 
 testRedisHandle ()
 

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 18 of file RedisHandlerTest.php.

Member Function Documentation

◆ testConstructorShouldThrowExceptionForInvalidRedis()

Monolog\Handler\RedisHandlerTest::testConstructorShouldThrowExceptionForInvalidRedis ( )

InvalidArgumentException

Definition at line 23 of file RedisHandlerTest.php.

24  {
25  new RedisHandler(new \stdClass(), 'key');
26  }

◆ testConstructorShouldWorkWithPredis()

Monolog\Handler\RedisHandlerTest::testConstructorShouldWorkWithPredis ( )

Definition at line 28 of file RedisHandlerTest.php.

29  {
30  $redis = $this->getMock('Predis\Client');
31  $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key'));
32  }

◆ testConstructorShouldWorkWithRedis()

Monolog\Handler\RedisHandlerTest::testConstructorShouldWorkWithRedis ( )

Definition at line 34 of file RedisHandlerTest.php.

35  {
36  $redis = $this->getMock('Redis');
37  $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key'));
38  }

◆ testPredisHandle()

Monolog\Handler\RedisHandlerTest::testPredisHandle ( )

Definition at line 40 of file RedisHandlerTest.php.

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

41  {
42  $redis = $this->getMock('Predis\Client', array('rpush'));
43 
44  // Predis\Client uses rpush
45  $redis->expects($this->once())
46  ->method('rpush')
47  ->with('key', 'test');
48 
49  $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
50 
51  $handler = new RedisHandler($redis, 'key');
52  $handler->setFormatter(new LineFormatter("%message%"));
53  $handler->handle($record);
54  }
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
+ Here is the call graph for this function:

◆ testRedisHandle()

Monolog\Handler\RedisHandlerTest::testRedisHandle ( )

Definition at line 56 of file RedisHandlerTest.php.

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

57  {
58  $redis = $this->getMock('Redis', array('rpush'));
59 
60  // Redis uses rPush
61  $redis->expects($this->once())
62  ->method('rPush')
63  ->with('key', 'test');
64 
65  $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
66 
67  $handler = new RedisHandler($redis, 'key');
68  $handler->setFormatter(new LineFormatter("%message%"));
69  $handler->handle($record);
70  }
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
+ Here is the call graph for this function:

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