Completed
Push — master ( 1dff78...9fa5ae )
by GBProd
02:40
created

DomainEventExtensionTest::testLoadDispatcher()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 18
rs 9.4285
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
namespace Tests\GBProd\DomainEventBundle\DependencyInjection;
4
5
use GBProd\DomainEventBundle\DependencyInjection\DomainEventExtension;
6
use GBProd\DomainEventBundle\Event\Dispatcher;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
9
10
/**
11
 * Tests for DomainEventExtension
12
 * 
13
 * @author gbprod <[email protected]>
14
 */
15
class DomainEventExtensionTest extends \PHPUnit_Framework_TestCase
16
{
17
    private $extension;
18
    private $container;
19
20
    protected function setUp()
21
    {
22
        $this->extension = new DomainEventExtension();
23
24
        $this->container = new ContainerBuilder();
25
        $this->container->registerExtension($this->extension);
26
        
27
    }
28
    
29
    public function testLoadDispatcher()
30
    {
31
        $this->container->set(
32
            'event_dispatcher',
33
            $this->getMock(EventDispatcherInterface::class)
34
        );
35
        
36
        $this->container->loadFromExtension($this->extension->getAlias());
37
        $this->container->compile();
38
     
39
        $this->assertTrue(
40
            $this->container->has('gbprod.domain_event_dispatcher')
41
        );
42
        
43
        $dispatcher = $this->container->get('gbprod.domain_event_dispatcher');
44
        
45
        $this->assertInstanceOf(Dispatcher::class, $dispatcher);
46
    }
47
48
}