ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Monolog\Handler\DynamoDbHandlerTest Class Reference
+ Inheritance diagram for Monolog\Handler\DynamoDbHandlerTest:
+ Collaboration diagram for Monolog\Handler\DynamoDbHandlerTest:

Public Member Functions

 setUp ()
 
 testConstruct ()
 
 testInterface ()
 
 testGetFormatter ()
 
 testHandle ()
 

Private Attributes

 $client
 

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 16 of file DynamoDbHandlerTest.php.

Member Function Documentation

◆ setUp()

Monolog\Handler\DynamoDbHandlerTest::setUp ( )

Definition at line 20 of file DynamoDbHandlerTest.php.

21 {
22 if (!class_exists('Aws\DynamoDb\DynamoDbClient')) {
23 $this->markTestSkipped('aws/aws-sdk-php not installed');
24 }
25
26 $this->client = $this->getMockBuilder('Aws\DynamoDb\DynamoDbClient')
27 ->setMethods(array('formatAttributes', '__call'))
28 ->disableOriginalConstructor()->getMock();
29 }

◆ testConstruct()

Monolog\Handler\DynamoDbHandlerTest::testConstruct ( )

Definition at line 31 of file DynamoDbHandlerTest.php.

32 {
33 $this->assertInstanceOf('Monolog\Handler\DynamoDbHandler', new DynamoDbHandler($this->client, 'foo'));
34 }

◆ testGetFormatter()

Monolog\Handler\DynamoDbHandlerTest::testGetFormatter ( )

Definition at line 41 of file DynamoDbHandlerTest.php.

42 {
43 $handler = new DynamoDbHandler($this->client, 'foo');
44 $this->assertInstanceOf('Monolog\Formatter\ScalarFormatter', $handler->getFormatter());
45 }
$handler

References $handler.

◆ testHandle()

Monolog\Handler\DynamoDbHandlerTest::testHandle ( )

Definition at line 47 of file DynamoDbHandlerTest.php.

48 {
49 $record = $this->getRecord();
50 $formatter = $this->getMock('Monolog\Formatter\FormatterInterface');
51 $formatted = array('foo' => 1, 'bar' => 2);
52 $handler = new DynamoDbHandler($this->client, 'foo');
53 $handler->setFormatter($formatter);
54
55 $formatter
56 ->expects($this->once())
57 ->method('format')
58 ->with($record)
59 ->will($this->returnValue($formatted));
60 $this->client
61 ->expects($this->once())
62 ->method('formatAttributes')
63 ->with($this->isType('array'))
64 ->will($this->returnValue($formatted));
65 $this->client
66 ->expects($this->once())
67 ->method('__call')
68 ->with('putItem', array(array(
69 'TableName' => 'foo',
70 'Item' => $formatted,
71 )));
72
73 $handler->handle($record);
74 }
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19

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

+ Here is the call graph for this function:

◆ testInterface()

Monolog\Handler\DynamoDbHandlerTest::testInterface ( )

Definition at line 36 of file DynamoDbHandlerTest.php.

37 {
38 $this->assertInstanceOf('Monolog\Handler\HandlerInterface', new DynamoDbHandler($this->client, 'foo'));
39 }

Field Documentation

◆ $client

Monolog\Handler\DynamoDbHandlerTest::$client
private

Definition at line 18 of file DynamoDbHandlerTest.php.


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