Completed
Push — master ( 67ee93...84505b )
by Ivannis Suárez
07:55
created

AggregateRepositoryFactoryTests   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

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