NetteServiceAliasTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A testSymfonyServiceReferencing() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Symplify\NetteAdapterForSymfonyBundles\Tests\TacticianBundle;
6
7
use Closure;
8
use League\Tactician\CommandBus;
9
use Nette\DI\Container;
10
use PHPUnit\Framework\TestCase;
11
use PHPUnit_Framework_Assert;
12
use stdClass;
13
use Symplify\NetteAdapterForSymfonyBundles\Tests\ContainerFactory;
14
15
final class NetteServiceAliasTest extends TestCase
16
{
17
    /**
18
     * @var Container
19
     */
20
    private $container;
21
22
    public function __construct()
23
    {
24
        $this->container = (new ContainerFactory())->createWithConfig(__DIR__ . '/config/netteServiceAlias.neon');
25
    }
26
27
    public function testSymfonyServiceReferencing()
28
    {
29
        /** @var CommandBus $commandBus */
30
        $commandBus = $this->container->getByType(CommandBus::class);
31
        $this->assertInstanceOf(CommandBus::class, $commandBus);
32
33
        /** @var Closure $middlewareChain */
34
        $middlewareChain = PHPUnit_Framework_Assert::getObjectAttribute($commandBus, 'middlewareChain');
35
36
        $output = $middlewareChain(new stdClass());
37
        $this->assertInstanceOf(stdClass::class, $output);
38
    }
39
}
40