AggregateRootTests   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testId() 0 10 1
B testEquals() 0 24 1
1
<?php
2
3
/**
4
 * This file is part of the Cubiche/Model 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
namespace Cubiche\Domain\Model\Tests\Units;
12
13
use Cubiche\Domain\Model\Tests\Fixtures\Post;
14
use Cubiche\Domain\Model\Tests\Fixtures\PostId;
15
16
/**
17
 * AggregateRootTests class.
18
 *
19
 * Generated by TestGenerator on 2016-05-03 at 16:01:26.
20
 */
21
class AggregateRootTests extends TestCase
22
{
23
    /**
24
     * Test id method.
25
     */
26
    public function testId()
27
    {
28
        $this
29
            ->given($id = PostId::fromNative($this->faker->ean13()))
30
            ->and($aggregateRoot = new Post($id, $this->faker->sentence(), $this->faker->paragraph()))
31
            ->then()
32
                ->boolean($aggregateRoot->id()->equals($id))
33
                    ->isTrue()
34
        ;
35
    }
36
37
    /**
38
     * Test equals method.
39
     */
40
    public function testEquals()
41
    {
42
        $this
43
            ->given(
44
                $aggregateRoot1 = new Post(
45
                    PostId::fromNative($this->faker->unique()->uuid()),
46
                    $this->faker->sentence(),
47
                    $this->faker->paragraph()
48
                )
49
            )
50
            ->and(
51
                $aggregateRoot2 = new Post(
52
                    PostId::fromNative($this->faker->ean13()),
53
                    $this->faker->sentence(),
54
                    $this->faker->paragraph()
55
                )
56
            )
57
            ->then()
58
                ->boolean($aggregateRoot1->equals($aggregateRoot1))
59
                    ->isTrue()
60
                ->boolean($aggregateRoot1->equals($aggregateRoot2))
61
                    ->isFalse()
62
        ;
63
    }
64
}
65