File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
src/Symfony/Component/Scheduler/Tests/Generator Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -100,11 +100,7 @@ public function testGetMessagesFromScheduleProviderWithRestart()
100
100
];
101
101
$ schedule = [[$ first , '22:13:00 ' , '22:14:00 ' ]];
102
102
103
- // for referencing
104
- $ now = self ::makeDateTime ($ startTime );
105
-
106
- $ clock = $ this ->createMock (ClockInterface::class);
107
- $ clock ->method ('now ' )->willReturnReference ($ now );
103
+ $ clock = new MockClock (self ::makeDateTime ($ startTime ));
108
104
109
105
foreach ($ schedule as $ i => $ s ) {
110
106
if (\is_array ($ s )) {
@@ -142,15 +138,15 @@ public function add(RecurringMessage $message): self
142
138
$ toAdd = (object ) ['id ' => 'added-after-start ' ];
143
139
144
140
foreach ($ runs as $ time => $ expected ) {
145
- $ now = self :: makeDateTime ($ time );
141
+ $ clock -> modify ($ time );
146
142
$ this ->assertSame ($ expected , iterator_to_array ($ scheduler ->getMessages (), false ));
147
143
}
148
144
149
145
$ scheduleProvider ->add ($ this ->createMessage ($ toAdd , '22:13:10 ' , '22:13:11 ' ));
150
146
151
147
$ this ->assertSame ([], iterator_to_array ($ scheduler ->getMessages (), false ));
152
148
153
- $ now = self :: makeDateTime ( ' 22:13:10 ' );
149
+ $ clock -> sleep ( 9 );
154
150
$ this ->assertSame ([$ toAdd ], iterator_to_array ($ scheduler ->getMessages (), false ));
155
151
}
156
152
You can’t perform that action at this time.
0 commit comments