1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace spec\Aggrego\Domain\Model\Unit\Entity; |
4
|
|
|
|
5
|
|
|
use PhpSpec\ObjectBehavior; |
6
|
|
|
use Aggrego\Domain\Event\Aggregate; |
|
|
|
|
7
|
|
|
use Aggrego\Domain\Exception\UnprocessableBoardException; |
|
|
|
|
8
|
|
|
use Aggrego\Domain\Model\InitialBoard\Entity\Board as InitialBoard; |
|
|
|
|
9
|
|
|
use Aggrego\Domain\Model\ProgressBoard\Entity\Board as ProgressBoard; |
|
|
|
|
10
|
|
|
use Aggrego\Domain\Model\Unit\Entity\Unit; |
|
|
|
|
11
|
|
|
use Aggrego\Domain\Profile\BoardTransformation\Transformation; |
12
|
|
|
use Aggrego\Domain\ValueObject\Data; |
|
|
|
|
13
|
|
|
use Aggrego\Domain\ValueObject\Key; |
|
|
|
|
14
|
|
|
use Aggrego\Domain\ValueObject\Name; |
|
|
|
|
15
|
|
|
use Aggrego\Domain\ValueObject\Profile; |
|
|
|
|
16
|
|
|
use Aggrego\Domain\ValueObject\Source; |
|
|
|
|
17
|
|
|
use Aggrego\Domain\ValueObject\Uuid; |
|
|
|
|
18
|
|
|
use Aggrego\Domain\ValueObject\Version; |
|
|
|
|
19
|
|
|
|
20
|
|
|
class UnitSpec extends ObjectBehavior |
21
|
|
|
{ |
22
|
|
|
function let(Transformation $transformation) |
|
|
|
|
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('')); |
|
|
|
|
37
|
|
|
$this->beConstructedThrough('createFromBoard', [$progressBoard, $transformation]); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
function it_is_initializable() |
|
|
|
|
41
|
|
|
{ |
42
|
|
|
$this->shouldHaveType(Unit::class); |
43
|
|
|
$this->shouldImplement(Aggregate::class); |
44
|
|
|
$this->pullEvents()->shouldHaveCount(1); |
|
|
|
|
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
function it_should_have_uuid() |
48
|
|
|
{ |
49
|
|
|
$this->getUuid()->shouldBeAnInstanceOf(Uuid::class); |
|
|
|
|
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
function it_should_have_key() |
53
|
|
|
{ |
54
|
|
|
$this->getKey()->shouldBeAnInstanceOf(Key::class); |
|
|
|
|
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
function it_should_have_profile() |
58
|
|
|
{ |
59
|
|
|
$this->getProfile()->shouldBeAnInstanceOf(Profile::class); |
|
|
|
|
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
function is_should_have_data() |
63
|
|
|
{ |
64
|
|
|
$this->getData()->shouldBeAnInstanceOf(Data::class); |
|
|
|
|
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
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths