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

ConsoleExceptionSubscriberTest::testListener()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.6
c 0
b 0
f 0
cc 2
nc 2
nop 0
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
}