ErrorHandlerTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testLogExceptionWritesExceptionMessage() 0 6 1
1
<?php
2
3
namespace DmCommonTest\Service;
4
5
use DmCommon\Service\ErrorHandler;
6
7
class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
8
{
9
    /** @var ErrorHandler System Under Test */
10
    private $sut;
11
12
    /** @var \PHPUnit_Framework_MockObject_MockObject */
13
    private $loggerMock;
14
15
    protected function setUp()
16
    {
17
        $this->loggerMock = $this->getMock('Zend\Log\Logger', ['err']);
18
19
        $this->sut = new ErrorHandler($this->loggerMock);
20
    }
21
22
    /**
23
     * @covers DmCommon\Service\ErrorHandler
24
     */
25
    public function testLogExceptionWritesExceptionMessage()
26
    {
27
        $this->loggerMock->expects($this->once())->method('err');
28
29
        $this->sut->logException(new \Exception('Hello'));
30
    }
31
}
32