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()
100100 ];
101101 $ schedule = [[$ first , '22:13:00 ' , '22:14:00 ' ]];
102102
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 ));
108104
109105 foreach ($ schedule as $ i => $ s ) {
110106 if (\is_array ($ s )) {
@@ -142,15 +138,15 @@ public function add(RecurringMessage $message): self
142138 $ toAdd = (object ) ['id ' => 'added-after-start ' ];
143139
144140 foreach ($ runs as $ time => $ expected ) {
145- $ now = self :: makeDateTime ($ time );
141+ $ clock -> modify ($ time );
146142 $ this ->assertSame ($ expected , iterator_to_array ($ scheduler ->getMessages (), false ));
147143 }
148144
149145 $ scheduleProvider ->add ($ this ->createMessage ($ toAdd , '22:13:10 ' , '22:13:11 ' ));
150146
151147 $ this ->assertSame ([], iterator_to_array ($ scheduler ->getMessages (), false ));
152148
153- $ now = self :: makeDateTime ( ' 22:13:10 ' );
149+ $ clock -> sleep ( 9 );
154150 $ this ->assertSame ([$ toAdd ], iterator_to_array ($ scheduler ->getMessages (), false ));
155151 }
156152
You can’t perform that action at this time.
0 commit comments