Completed
Push — master ( e4a43c...c6b5e7 )
by Tomáš
15:17
created

testSymfonyServiceReferencing()   A

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