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

UseCaseSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 29 1
A it_is_initializable() 0 3 1
A it_should_handle_command() 0 4 1
1
<?php
2
3
namespace spec\Aggrego\Domain\Api\Command\TransformBoard;
4
5
use PhpSpec\ObjectBehavior;
6
use Prophecy\Argument;
7
use Aggrego\Domain\Api\Command\TransformBoard\Command;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\Api\Command\TransformBoard\Command 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\Api\Command\TransformBoard\UseCase;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\Api\Command\TransformBoard\UseCase 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\Factory\ProfileBoardTransformationFactory;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\Factory\P...rdTransformationFactory 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\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...
11
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...
12
use Aggrego\Domain\Model\ProgressBoard\Repository as ProgressBoardRepository;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\Model\ProgressBoard\Repository 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\Model\ProgressBoard\ValueObject\Collection;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\Model\Pro...\ValueObject\Collection 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\Model\Unit\Repository as UnitRepository;
0 ignored issues
show
Bug introduced by
The type Aggrego\Domain\Model\Unit\Repository 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\Profile\BoardTransformation\Transformation;
16
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...
17
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...
18
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...
19
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...
20
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...
21
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...
22
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...
23
24
class UseCaseSpec extends ObjectBehavior
25
{
26
    function let(
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...
27
        ProgressBoardRepository $progressBoardRepository,
28
        UnitRepository $unitRepository,
29
        ProfileBoardTransformationFactory $boardTransformationFactory,
30
        Transformation $transformation
31
    )
32
    {
33
        $key = new Key(['init']);
34
        $name = new Name('test');
35
        $version = new Version('1.0');
36
        $profile = new Profile($name, $version);
37
38
        $board = new InitialBoard($key, $profile);
39
        $board->addShard($key, new Source($name, $version));
40
        $progressBoard = ProgressBoard::factoryFromInitial($board);
41
        $progressBoard->updateShard(
42
            new Uuid('4b7c7c15-6b50-5a1f-94ca-20a9749c5bc2'),
43
            new Source($name, $version),
44
            new Data('test')
45
        );
46
47
        $uuid = Argument::type(Uuid::class);
48
        $progressBoardRepository->getBoardByUuid($uuid)->willReturn($progressBoard);
49
50
        $boardTransformationFactory->factory($profile)->willReturn($transformation);
51
52
        $shards = Argument::type(Collection::class);
53
        $transformation->process($shards)->willReturn(new Data('test-double'));
0 ignored issues
show
Bug introduced by
$shards of type Prophecy\Argument\Token\TypeToken is incompatible with the type Aggrego\Domain\ProgressiveBoard\Step\Step expected by parameter $shards of Aggrego\Domain\Profile\B...ansformation::process(). ( Ignorable by Annotation )

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

53
        $transformation->process(/** @scrutinizer ignore-type */ $shards)->willReturn(new Data('test-double'));
Loading history...
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

53
        $transformation->process($shards)->/** @scrutinizer ignore-call */ willReturn(new Data('test-double'));

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...
54
        $this->beConstructedWith($progressBoardRepository, $unitRepository, $boardTransformationFactory);
55
    }
56
57
    function it_is_initializable()
58
    {
59
        $this->shouldHaveType(UseCase::class);
60
    }
61
62
    function it_should_handle_command(Command $command)
63
    {
64
        $command->getBoardUuid()->willReturn('123e4567-e89b-12d3-a456-426655440000');
65
        $this->handle($command)->shouldBeNull();
0 ignored issues
show
Bug introduced by
The method handle() does not exist on spec\Aggrego\Domain\Api\...nsformBoard\UseCaseSpec. 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

65
        $this->/** @scrutinizer ignore-call */ 
66
               handle($command)->shouldBeNull();
Loading history...
66
    }
67
}
68