Passed
Push — master ( bace86...bb4cad )
by Dmitriy
05:30 queued 02:57
created

ProxyServiceProviderTest::testRegister()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 12
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Tests\Unit;
6
7
use PHPUnit\Framework\TestCase;
8
use Psr\Container\ContainerInterface;
9
use Psr\EventDispatcher\EventDispatcherInterface;
10
use Psr\EventDispatcher\ListenerProviderInterface;
11
use Psr\Log\LoggerInterface;
12
use Psr\Log\NullLogger;
13
use Yiisoft\Definitions\Exception\InvalidConfigException;
14
use Yiisoft\Di\Container;
15
use Yiisoft\Di\ContainerConfig;
16
use Yiisoft\EventDispatcher\Dispatcher\Dispatcher;
17
use Yiisoft\EventDispatcher\Provider\Provider;
18
use Yiisoft\Yii\Debug\Collector\ContainerInterfaceProxy;
19
use Yiisoft\Yii\Debug\ProxyServiceProvider;
20
21
final class ProxyServiceProviderTest extends TestCase
22
{
23
    /**
24
     * @throws InvalidConfigException
25
     *
26
     * @covers \Yiisoft\Yii\Debug\ProxyServiceProvider::getDefinitions()
27
     * @covers \Yiisoft\Yii\Debug\ProxyServiceProvider::getExtensions()
28
     */
29
    public function testRegister(): void
30
    {
31
        $config = ContainerConfig::create()
32
            ->withDefinitions([
33
                LoggerInterface::class => NullLogger::class,
34
                EventDispatcherInterface::class => Dispatcher::class,
35
                ListenerProviderInterface::class => Provider::class,
36
            ])
37
            ->withProviders([new ProxyServiceProvider()]);
38
        $container = new Container($config);
39
40
        $this->assertInstanceOf(ContainerInterfaceProxy::class, $container->get(ContainerInterface::class));
41
    }
42
}
43