Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1630280

Browse filesBrowse files
committed
Replace Mock by MockClock
1 parent 1cc4165 commit 1630280
Copy full SHA for 1630280

File tree

Expand file treeCollapse file tree

1 file changed

+3
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-5
lines changed

‎src/Symfony/Component/Scheduler/Tests/Generator/MessageGeneratorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Scheduler/Tests/Generator/MessageGeneratorTest.php
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1616
use Symfony\Component\Clock\ClockInterface;
17+
use Symfony\Component\Clock\MockClock;
1718
use Symfony\Component\Scheduler\Generator\Checkpoint;
1819
use Symfony\Component\Scheduler\Generator\MessageContext;
1920
use Symfony\Component\Scheduler\Generator\MessageGenerator;
@@ -131,10 +132,7 @@ public function testYieldedContext()
131132

132133
public function testCheckpointSavedInBrokenLoop()
133134
{
134-
$now = self::makeDateTime('22:12:00');
135-
136-
$clock = $this->createMock(ClockInterface::class);
137-
$clock->method('now')->willReturnReference($now);
135+
$clock = new MockClock(self::makeDateTime('22:12:00'));
138136

139137
$message = $this->createMessage((object) ['id' => 'message'], '22:13:00', '22:14:00', '22:16:00');
140138
$schedule = (new Schedule())->add($message);
@@ -148,7 +146,7 @@ public function testCheckpointSavedInBrokenLoop()
148146
// Warmup. The first run is always returns nothing.
149147
$this->assertSame([], iterator_to_array($scheduler->getMessages(), false));
150148

151-
$now = self::makeDateTime('22:13:10');
149+
$clock->sleep(60 + 10); // 22:13:10
152150

153151
foreach ($scheduler->getMessages() as $message) {
154152
// Message is handled but loop is broken just after

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.