AggregateRepositoryFactoryTests::testCreate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 0
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