testPopEventsReturnsEmptyArrayIfNoEventRaised()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
rs 9.6666
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Tests\GBProd\DomainEvent;
4
5
use GBProd\DomainEvent\DomainEvent;
6
use GBProd\DomainEvent\EventProviderTrait;
7
8
/**
9
 * Tests for EventProviderTrait
10
 * 
11
 * @author gbprod <[email protected]>
12
 */
13
class EventProviderTraitTest extends \PHPUnit_Framework_TestCase
14
{
15
    public function testPopEventsReturnsEmptyArrayIfNoEventRaised()
16
    {
17
        $provider = $this->getMockForTrait(EventProviderTrait::class);
18
        
19
        $this->assertEquals(
20
            [],
21
            $provider->popEvents()
22
        );
23
    }
24
    
25
    public function testPopEventsReturnsArrayWithRaisedEvents()
26
    {
27
        $provider = $this->getMockForTrait(EventProviderTrait::class);
28
        
29
        $event1 = $this->getMock(DomainEvent::class);
30
        $event2 = $this->getMock(DomainEvent::class);
31
        $event3 = $this->getMock(DomainEvent::class);
32
        
33
        $provider->raise($event1);
34
        $provider->raise($event2);
35
        $provider->raise($event3);
36
        
37
        $this->assertEquals(
38
            [$event1, $event2, $event3],
39
            $provider->popEvents()
40
        );
41
    }
42
}