PostPersistEventTests   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testAggregate() 0 20 1
1
<?php
2
3
/**
4
 * This file is part of the Cubiche/EventSourcing component.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Domain\EventSourcing\Tests\Units\Event;
13
14
use Cubiche\Domain\EventSourcing\Event\PostPersistEvent;
15
use Cubiche\Domain\EventSourcing\EventStore\EventStream;
16
use Cubiche\Domain\EventSourcing\Tests\Fixtures\PostEventSourcedFactory;
17
use Cubiche\Domain\EventSourcing\Tests\Units\TestCase;
18
use Cubiche\Domain\Model\Tests\Fixtures\PostId;
19
20
/**
21
 * PostPersistEventTests class.
22
 *
23
 * Generated by TestGenerator on 2016-07-26 at 14:15:46.
24
 */
25
class PostPersistEventTests extends TestCase
26
{
27
    /**
28
     * Test Aggregate method.
29
     */
30
    public function testAggregate()
31
    {
32
        $this
33
            ->given(
34
                $post = PostEventSourcedFactory::create(
35
                    $this->faker->sentence,
36
                    $this->faker->paragraph
37
                )
38
            )
39
            ->and($postId = PostId::fromNative(md5(rand())))
40
            ->and($streamName = 'Posts-'.$postId)
41
            ->and($eventStream = new EventStream($streamName, $postId, []))
42
            ->and($event = new PostPersistEvent($post, $eventStream))
43
            ->then()
44
                ->object($event->aggregate())
45
                    ->isEqualTo($post)
46
                ->object($event->eventStream())
47
                    ->isEqualTo($eventStream)
48
        ;
49
    }
50
}
51