ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 

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

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

◆ testConstruct()

Monolog\Handler\DynamoDbHandlerTest::testConstruct ( )

Definition at line 29 of file DynamoDbHandlerTest.php.

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

◆ testGetFormatter()

Monolog\Handler\DynamoDbHandlerTest::testGetFormatter ( )

Definition at line 39 of file DynamoDbHandlerTest.php.

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

◆ testHandle()

Monolog\Handler\DynamoDbHandlerTest::testHandle ( )

Definition at line 45 of file DynamoDbHandlerTest.php.

References Monolog\TestCase\getRecord().

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

◆ testInterface()

Monolog\Handler\DynamoDbHandlerTest::testInterface ( )

Definition at line 34 of file DynamoDbHandlerTest.php.

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

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