AggregateRepositoryFactoryTests   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createFactory() 0 4 1
A testCreate() 0 14 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\Factory;
13
14
use Cubiche\Domain\EventSourcing\AggregateRepository;
15
use Cubiche\Domain\EventSourcing\EventStore\InMemoryEventStore;
16
use Cubiche\Domain\EventSourcing\Factory\AggregateRepositoryFactory;
17
use Cubiche\Domain\EventSourcing\Tests\Fixtures\PostEventSourced;
18
use Cubiche\Domain\EventSourcing\Tests\Units\TestCase;
19
use Cubiche\Domain\Model\Tests\Fixtures\PostId;
20
21
/**
22
 * AggregateRepositoryFactoryTests class.
23
 *
24
 * Generated by TestGenerator on 2016-06-28 at 14:36:54.
25
 */
26
class AggregateRepositoryFactoryTests extends TestCase
27
{
28
    /**
29
     * @return AggregateRepositoryFactory
30
     */
31
    protected function createFactory()
32
    {
33
        return new AggregateRepositoryFactory(new InMemoryEventStore());
34
    }
35
36
    /**
37
     * Test create.
38
     */
39
    public function testCreate()
40
    {
41
        $this
42
            ->given($factory = $this->createFactory())
43
            ->and($postId = PostId::fromNative(md5(rand())))
44
            ->and($repository = $factory->create(PostEventSourced::class))
45
            ->then()
46
                ->object($repository)
47
                    ->isInstanceOf(AggregateRepository::class)
48
                ->and()
49
                ->string($this->invoke($repository)->streamName($postId))
50
                    ->isEqualTo('PostEventSourced-'.$postId)
51
        ;
52
    }
53
}
54