2
2
3
3
declare (strict_types=1 );
4
4
5
- namespace Integration ;
5
+ namespace Test \ Ecotone \ EventSourcing \ Integration ;
6
6
7
7
use Doctrine \DBAL \Connection ;
8
8
use Ecotone \Dbal \Configuration \DbalConfiguration ;
@@ -54,35 +54,37 @@ protected function setUp(): void
54
54
$ this ->missingEvent = $ connection ->fetchAssociative (sprintf ('select * from %s where no = ? ' , $ streamName ), [2 ]);
55
55
$ connection ->delete ($ streamName , ['no ' => 2 ]);
56
56
57
- $ initialTimestamp = 1712501960 ;
57
+ $ initialTimestamp = time () ;
58
58
59
59
$ metadata = json_decode ($ connection ->fetchOne (sprintf ('select metadata from %s where no = ? ' , $ streamName ), [1 ]), true );
60
60
$ metadata ['timestamp ' ] = $ initialTimestamp ;
61
61
$ connection ->update ($ streamName , ['metadata ' => json_encode ($ metadata ), 'created_at ' => date (DATE_ATOM , $ initialTimestamp )], ['no ' => 1 ]);
62
62
63
63
$ metadata = json_decode ($ connection ->fetchOne (sprintf ('select metadata from %s where no = ? ' , $ streamName ), [3 ]), true );
64
- $ metadata ['timestamp ' ] = $ initialTimestamp + 100 ;
65
- $ connection ->update ($ streamName , ['metadata ' => json_encode ($ metadata ), 'created_at ' => date (DATE_ATOM , $ initialTimestamp + 100 )], ['no ' => 3 ]);
64
+ $ metadata ['timestamp ' ] = $ initialTimestamp + 10 ;
65
+ $ connection ->update ($ streamName , ['metadata ' => json_encode ($ metadata ), 'created_at ' => date (DATE_ATOM , $ initialTimestamp + 10 )], ['no ' => 3 ]);
66
66
67
67
$ metadata = json_decode ($ connection ->fetchOne (sprintf ('select metadata from %s where no = ? ' , $ streamName ), [4 ]), true );
68
- $ metadata ['timestamp ' ] = $ initialTimestamp + 200 ;
69
- $ connection ->update ($ streamName , ['metadata ' => json_encode ($ metadata ), 'created_at ' => date (DATE_ATOM , $ initialTimestamp + 200 )], ['no ' => 4 ]);
68
+ $ metadata ['timestamp ' ] = $ initialTimestamp + 20 ;
69
+ $ connection ->update ($ streamName , ['metadata ' => json_encode ($ metadata ), 'created_at ' => date (DATE_ATOM , $ initialTimestamp + 20 )], ['no ' => 4 ]);
70
70
}
71
71
72
72
public function test_detecting_gaps_without_detection_window (): void
73
73
{
74
- $ ecotone = $ this ->bootstrapEcotoneWithGapDetection (new GapDetection ([10 , 20 , 50 ], null ));
74
+ $ ecotone = $ this ->bootstrapEcotoneWithGapDetection (new GapDetection ([0 ], null ));
75
75
$ ecotone ->sendCommand (new CloseTicket ('124 ' ));
76
76
77
77
self ::assertEquals (
78
78
[
79
79
['ticket_id ' => '123 ' , 'ticket_type ' => 'alert ' ],
80
+ ['ticket_id ' => '125 ' , 'ticket_type ' => 'warning ' ],
80
81
],
81
82
$ ecotone ->sendQueryWithRouting ('getInProgressTickets ' )
82
83
);
83
84
84
85
$ this ->addMissingEvent ();
85
86
87
+ $ ecotone ->resetProjection (InProgressTicketList::IN_PROGRESS_TICKET_PROJECTION );
86
88
$ ecotone ->triggerProjection (InProgressTicketList::IN_PROGRESS_TICKET_PROJECTION );
87
89
88
90
self ::assertEquals (
@@ -95,7 +97,7 @@ public function test_detecting_gaps_without_detection_window(): void
95
97
96
98
public function test_detecting_gaps_with_detection_window (): void
97
99
{
98
- $ ecotone = $ this ->bootstrapEcotoneWithGapDetection (new GapDetection ([10 , 20 , 50 ], new DateInterval ('PT10S ' )));
100
+ $ ecotone = $ this ->bootstrapEcotoneWithGapDetection (new GapDetection ([0 ], new DateInterval ('PT1S ' )));
99
101
$ ecotone ->sendCommand (new CloseTicket ('124 ' ));
100
102
101
103
self ::assertEquals (
0 commit comments