@@ 29-44 (lines=16) @@ | ||
26 | /** |
|
27 | * Test snapshotName method. |
|
28 | */ |
|
29 | public function testSnapshotName() |
|
30 | { |
|
31 | $this |
|
32 | ->given( |
|
33 | $post = PostEventSourcedFactory::create( |
|
34 | $this->faker->sentence, |
|
35 | $this->faker->paragraph |
|
36 | ) |
|
37 | ) |
|
38 | ->and($snapshotName = 'Posts-'.$post->id()->toNative()) |
|
39 | ->and($snapshot = new Snapshot($snapshotName, $post)) |
|
40 | ->then() |
|
41 | ->string($snapshot->snapshotName()) |
|
42 | ->isEqualTo($snapshotName) |
|
43 | ; |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * Test Aggregate method. |
|
@@ 49-64 (lines=16) @@ | ||
46 | /** |
|
47 | * Test Aggregate method. |
|
48 | */ |
|
49 | public function testAggregate() |
|
50 | { |
|
51 | $this |
|
52 | ->given( |
|
53 | $post = PostEventSourcedFactory::create( |
|
54 | $this->faker->sentence, |
|
55 | $this->faker->paragraph |
|
56 | ) |
|
57 | ) |
|
58 | ->and($snapshotName = 'Posts-'.$post->id()->toNative()) |
|
59 | ->and($snapshot = new Snapshot($snapshotName, $post)) |
|
60 | ->then() |
|
61 | ->object($snapshot->aggregate()) |
|
62 | ->isEqualTo($post) |
|
63 | ; |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * Test Version method. |
|
@@ 91-106 (lines=16) @@ | ||
88 | /** |
|
89 | * Test CreatedAt method. |
|
90 | */ |
|
91 | public function testCreatedAt() |
|
92 | { |
|
93 | $this |
|
94 | ->given( |
|
95 | $post = PostEventSourcedFactory::create( |
|
96 | $this->faker->sentence, |
|
97 | $this->faker->paragraph |
|
98 | ) |
|
99 | ) |
|
100 | ->and($snapshotName = 'Posts-'.$post->id()->toNative()) |
|
101 | ->and($snapshot = new Snapshot($snapshotName, $post)) |
|
102 | ->then() |
|
103 | ->object($snapshot->createdAt()) |
|
104 | ->isInstanceOf(\DateTime::class) |
|
105 | ; |
|
106 | } |
|
107 | } |
|
108 |