Completed
Push — master ( a0580c...57df1c )
by Tomasz
01:44
created

UnitSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 1
dl 0
loc 16
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
namespace spec\Aggrego\Domain\Model\Unit\Entity;
4
5
use PhpSpec\ObjectBehavior;
6
use Aggrego\Domain\Event\Aggregate;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\Event\Aggregate was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Aggrego\Domain\Exception\UnprocessableBoardException;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\Exception...ocessableBoardException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Aggrego\Domain\Model\InitialBoard\Entity\Board as InitialBoard;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\Model\InitialBoard\Entity\Board was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Aggrego\Domain\Model\ProgressBoard\Entity\Board as ProgressBoard;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\Model\ProgressBoard\Entity\Board was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Aggrego\Domain\Model\Unit\Entity\Unit;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\Model\Unit\Entity\Unit was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Aggrego\Domain\Profile\BoardTransformation\Transformation;
12
use Aggrego\Domain\ValueObject\Data;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\ValueObject\Data was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Aggrego\Domain\ValueObject\Key;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\ValueObject\Key was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Aggrego\Domain\ValueObject\Name;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\ValueObject\Name was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Aggrego\Domain\ValueObject\Profile;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\ValueObject\Profile was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Aggrego\Domain\ValueObject\Source;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\ValueObject\Source was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Aggrego\Domain\ValueObject\Uuid;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\ValueObject\Uuid was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Aggrego\Domain\ValueObject\Version;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\ValueObject\Version was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
20
class UnitSpec extends ObjectBehavior
21
{
22
    function let(Transformation $transformation)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
23
    {
24
        $key = new Key(['init']);
25
        $name = new Name('test');
26
        $version = new Version('1.0');
27
        $board = new InitialBoard($key, new Profile($name, $version));
28
        $board->addShard($key, new Source($name, $version));
29
        $progressBoard = ProgressBoard::factoryFromInitial($board);
30
        $progressBoard->updateShard(
31
            new Uuid('4b7c7c15-6b50-5a1f-94ca-20a9749c5bc2'),
32
            new Source($name, $version),
33
            new Data('test')
34
        );
35
36
        $transformation->process($progressBoard->getShards())->willReturn(new Data(''));
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Aggrego\Domain\ProgressiveBoard\Step\Step. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
        $transformation->process($progressBoard->getShards())->/** @scrutinizer ignore-call */ willReturn(new Data(''));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
        $this->beConstructedThrough('createFromBoard', [$progressBoard, $transformation]);
38
    }
39
40
    function it_is_initializable()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
41
    {
42
        $this->shouldHaveType(Unit::class);
43
        $this->shouldImplement(Aggregate::class);
44
        $this->pullEvents()->shouldHaveCount(1);
0 ignored issues
show
Bug introduced by
The method pullEvents() does not exist on spec\Aggrego\Domain\Model\Unit\Entity\UnitSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
        $this->/** @scrutinizer ignore-call */ 
45
               pullEvents()->shouldHaveCount(1);
Loading history...
45
    }
46
47
    function it_should_have_uuid()
48
    {
49
        $this->getUuid()->shouldBeAnInstanceOf(Uuid::class);
0 ignored issues
show
Bug introduced by
The method getUuid() does not exist on spec\Aggrego\Domain\Model\Unit\Entity\UnitSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
        $this->/** @scrutinizer ignore-call */ 
50
               getUuid()->shouldBeAnInstanceOf(Uuid::class);
Loading history...
50
    }
51
52
    function it_should_have_key()
53
    {
54
        $this->getKey()->shouldBeAnInstanceOf(Key::class);
0 ignored issues
show
Bug introduced by
The method getKey() does not exist on spec\Aggrego\Domain\Model\Unit\Entity\UnitSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

54
        $this->/** @scrutinizer ignore-call */ 
55
               getKey()->shouldBeAnInstanceOf(Key::class);
Loading history...
55
    }
56
57
    function it_should_have_profile()
58
    {
59
        $this->getProfile()->shouldBeAnInstanceOf(Profile::class);
0 ignored issues
show
Bug introduced by
The method getProfile() does not exist on spec\Aggrego\Domain\Model\Unit\Entity\UnitSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

59
        $this->/** @scrutinizer ignore-call */ 
60
               getProfile()->shouldBeAnInstanceOf(Profile::class);
Loading history...
60
    }
61
62
    function is_should_have_data()
63
    {
64
        $this->getData()->shouldBeAnInstanceOf(Data::class);
0 ignored issues
show
Bug introduced by
The method getData() does not exist on spec\Aggrego\Domain\Model\Unit\Entity\UnitSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

64
        $this->/** @scrutinizer ignore-call */ 
65
               getData()->shouldBeAnInstanceOf(Data::class);
Loading history...
65
    }
66
67
    function it_should_throw_exception_when_got_unfinished_board(Transformation $transformation)
68
    {
69
        $key = new Key(['init']);
70
        $name = new Name('test');
71
        $version = new Version('1.0');
72
        $board = new InitialBoard($key, new Profile($name, $version));
73
        $board->addShard($key, new Source($name, $version));
74
        $progressBoard = ProgressBoard::factoryFromInitial($board);
75
        $transformation->process($progressBoard->getShards())->willReturn(new Data(''));
76
77
        $this->beConstructedThrough('createFromBoard', [$progressBoard, $transformation]);
78
        $this->shouldThrow(UnprocessableBoardException::class)->duringInstantiation();
79
    }
80
}
81