Passed
Push — master ( 3312bd...c25b5e )
by Kirill
04:35
created

RotateHandlerTest.php$0 ➔ load()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
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\Monolog;
13
14
use Monolog\Handler\RotatingFileHandler;
15
use Monolog\Logger;
16
use PHPUnit\Framework\TestCase;
17
use Spiral\Boot\BootloadManager;
18
use Spiral\Config\ConfigManager;
19
use Spiral\Config\ConfiguratorInterface;
20
use Spiral\Config\LoaderInterface;
21
use Spiral\Core\Container;
22
use Spiral\Monolog\Bootloader\MonologBootloader;
23
24
class RotateHandlerTest extends TestCase
25
{
26
    public function testRotateHandler(): void
27
    {
28
        $container = new Container();
29
        $container->bind(ConfiguratorInterface::class, new ConfigManager(
0 ignored issues
show
Bug introduced by
new Spiral\Config\ConfigManager(new ClassNode()) of type Spiral\Config\ConfigManager is incompatible with the type array|callable|string expected by parameter $resolver of Spiral\Core\Container::bind(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

29
        $container->bind(ConfiguratorInterface::class, /** @scrutinizer ignore-type */ new ConfigManager(
Loading history...
30
            new class() implements LoaderInterface {
31
                public function has(string $section): bool
32
                {
33
                    return false;
34
                }
35
36
                public function load(string $section): array
37
                {
38
                    return [];
39
                }
40
            }
41
        ));
42
        $container->get(BootloadManager::class)->bootload([MonologBootloader::class]);
43
44
        $autowire = new Container\Autowire('log.rotate', [
45
            'filename' => 'monolog.log'
46
        ]);
47
48
        /** @var RotatingFileHandler $handler */
49
        $handler = $autowire->resolve($container);
50
        $this->assertInstanceOf(RotatingFileHandler::class, $handler);
51
52
        $this->assertSame(Logger::DEBUG, $handler->getLevel());
53
    }
54
}
55