Completed
Push — master ( 6e0bb5...dae7dc )
by GBProd
04:09
created

DispatcherTest::testDispatchEvent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
rs 9.4285
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
namespace Tests\GBProd\DomainEventBundle\Dispatcher;
4
5
use GBProd\DomainEventBundle\Event\Dispatcher;
6
use GBProd\DomainEvent\DomainEvent;
7
use Symfony\Component\EventDispatcher\EventDispatcher;
8
use Symfony\Component\EventDispatcher\Event as SymfonyEvent;
9
10
/**
11
 * Tests for Dispatcher
12
 * 
13
 * @author gbprod <[email protected]>
14
 */
15
class DispatcherTest extends \PHPUnit_Framework_TestCase
16
{
17
    public function testConstruct()
18
    {
19
        new Dispatcher(
20
            $this->getMock(EventDispatcher::class)
21
        );
22
    }
23
    
24
    public function testDispatchEvent()
25
    {
26
        $domainEvent = $this->getMock(DomainEvent::class);
27
        
28
        $symfonyDispatcher = $this->getMock(EventDispatcher::class);
29
        
30
        $symfonyDispatcher
31
            ->expects($this->once())
32
            ->method('dispatch')
33
            ->with(
34
                get_class($domainEvent),
35
                $this->isInstanceOf(SymfonyEvent::class)
36
            )
37
        ;
38
        
39
        $dispatcher = new Dispatcher($symfonyDispatcher);
40
        
41
        $dispatcher->dispatch($domainEvent);
42
    }
43
}