Completed
Push — dev ( a1297d...02942d )
by Arnaud
03:36
created

MessageHandlerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 1
cbo 3
dl 0
loc 28
rs 10
1
<?php
2
3
namespace LAG\AdminBundle\Tests\AdminBundle\Message;
4
5
use LAG\AdminBundle\Message\MessageHandler;
6
use LAG\AdminBundle\Tests\Base;
7
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
8
9
class MessageHandlerTest extends Base
10
{
11
    public function testHandleError()
12
    {
13
        $loggerMock = $this->mockLogger();
14
        $loggerMock
15
            ->expects($this->once())
16
            ->method('error')
17
        ;
18
        $sessionMock = $this->mockSession();
19
        $sessionMock
20
            ->expects($this->exactly(2))
21
            ->method('getFlashBag')
22
            ->willReturn(new FlashBag())
23
        ;
24
        $translatorMock = $this->mockTranslator();
25
        $translatorMock
26
            ->expects($this->exactly(2))
27
            ->method('trans')
28
            ->willReturn('test')
29
        ;
30
31
        $messageHandler = new MessageHandler($loggerMock, $sessionMock, $translatorMock);
32
        $messageHandler->handleError('test', 'test');
33
        $messageHandler->handleError('test');
34
35
    }
36
}
37