Completed
Push — l10n_master ( ff9163...a02a58 )
by Ruud
22:18 queued 07:25
created

ConsoleExceptionSubscriberTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 6
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testListener() 0 20 2
1
<?php
2
3
namespace Kunstmaan\AdminBundle\Tests\EventListener;
4
5
use Exception;
6
use Codeception\Test\Unit;
7
use Kunstmaan\AdminBundle\Command\ApplyAclCommand;
8
use Kunstmaan\AdminBundle\EventListener\ConsoleExceptionSubscriber;
9
use Psr\Log\LoggerInterface;
10
use Symfony\Component\Console\Event\ConsoleErrorEvent;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
class ConsoleExceptionSubscriberTest extends Unit
15
{
16
    public function testListener()
17
    {
18
        if (!class_exists(ConsoleErrorEvent::class)) {
19
            // Nothing to test
20
            return;
21
        }
22
23
        $logger = $this->createMock(LoggerInterface::class);
24
        $logger->expects($this->once())->method('error')->willReturn(true);
25
        $subscriber = new ConsoleExceptionSubscriber($logger);
26
27
        $command = new ApplyAclCommand();
28
        $exception = new Exception();
29
30
        $input = $this->createMock(InputInterface::class);
31
        $output = $this->createMock(OutputInterface::class);
32
        $event = new ConsoleErrorEvent($input, $output, $exception, $command);
33
34
        $subscriber->onConsoleError($event);
35
    }
36
}