NameResolverTests   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testResolve() 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\Utils;
13
14
use Cubiche\Domain\EventSourcing\Tests\Fixtures\PostEventSourced;
15
use Cubiche\Domain\EventSourcing\Tests\Units\TestCase;
16
use Cubiche\Domain\EventSourcing\Utils\NameResolver;
17
use Cubiche\Domain\Model\Tests\Fixtures\PostId;
18
19
/**
20
 * NameResolverTests class.
21
 *
22
 * Generated by TestGenerator on 2016-07-26 at 14:15:46.
23
 */
24
class NameResolverTests extends TestCase
25
{
26
    /**
27
     * Test Resolve method.
28
     */
29
    public function testResolve()
30
    {
31
        $this
32
            ->given($className = PostEventSourced::class)
33
            ->and($postId = PostId::fromNative(md5(rand())))
34
            ->when($result = NameResolver::resolve($className, $postId))
35
            ->then()
36
                ->string($result)
37
                    ->isEqualTo('PostEventSourced-'.$postId->toNative())
38
        ;
39
40
        $this
41
            ->given($className = 'FooDocument')
42
            ->and($postId = PostId::fromNative(md5(rand())))
43
            ->when($result = NameResolver::resolve($className, $postId))
44
            ->then()
45
                ->string($result)
46
                    ->isEqualTo('FooDocument-'.$postId->toNative())
47
        ;
48
    }
49
}
50