testSymfonyServiceReferencing()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
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