Passed
Push — master ( d47bdf...6296de )
by Kirill
03:33
created

FactoryTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 9
c 1
b 0
f 0
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testEvent() 0 14 1
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Tests\Logger;
13
14
use PHPUnit\Framework\TestCase;
15
use Psr\Log\LogLevel;
16
use Spiral\Logger\Event\LogEvent;
17
use Spiral\Logger\ListenerRegistry;
18
use Spiral\Logger\LogFactory;
19
20
class FactoryTest extends TestCase
21
{
22
    public function testEvent(): void
23
    {
24
        $l = new ListenerRegistry();
25
        $l->addListener(function (LogEvent $event): void {
26
            $this->assertSame('error', $event->getMessage());
27
            $this->assertSame('default', $event->getChannel());
28
            $this->assertSame(LogLevel::CRITICAL, $event->getLevel());
29
        });
30
31
        $f = new LogFactory($l);
32
33
        $l = $f->getLogger('default');
34
35
        $l->critical('error');
36
    }
37
}
38