Completed
Push — master ( 0fc7e8...41c904 )
by GBProd
04:06 queued 01:49
created

DispatcherTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAggregateId() 0 4 1
A testConstruct() 0 6 1
A testDispatchEvent() 0 17 1
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\EventDispatcherInterface;
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 implements DomainEvent
16
{
17
    public function getAggregateId()
18
    {
19
        return 1;
20
    }
21
    
22
    public function testConstruct()
23
    {
24
        new Dispatcher(
25
            $this->getMock(EventDispatcherInterface::class)
26
        );
27
    }
28
    
29
    public function testDispatchEvent()
30
    {
31
        $symfonyDispatcher = $this->getMock(EventDispatcherInterface::class);
32
        
33
        $symfonyDispatcher
34
            ->expects($this->once())
35
            ->method('dispatch')
36
            ->with(
37
                'DispatcherTest',
38
                $this->isInstanceOf(SymfonyEvent::class)
39
            )
40
        ;
41
        
42
        $dispatcher = new Dispatcher($symfonyDispatcher);
43
        
44
        $dispatcher->dispatch($this);
45
    }
46
}