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

DispatcherTest::getAggregateId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
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\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
}