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

DomainEventExtensionTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 3
dl 0
loc 34
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
A testLoadDispatcher() 0 18 1
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
}