File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 23
23
use Illuminate \Support \Carbon ;
24
24
use Illuminate \Support \Collection ;
25
25
use Illuminate \Support \Fluent ;
26
+ use Illuminate \Support \Sleep ;
26
27
use Illuminate \Support \Str ;
27
28
use JsonSerializable ;
28
29
use Mockery as m ;
@@ -1715,7 +1716,7 @@ public function testExceptionThrownInRetryCallbackWithoutRetrying()
1715
1716
1716
1717
public function testRequestsWillBeWaitingSleepMillisecondsReceivedBeforeRetry ()
1717
1718
{
1718
- $ startTime = microtime ( true );
1719
+ Sleep:: fake ( );
1719
1720
1720
1721
$ this ->factory ->fake ([
1721
1722
'* ' => $ this ->factory ->sequence ()
@@ -1734,8 +1735,13 @@ public function testRequestsWillBeWaitingSleepMillisecondsReceivedBeforeRetry()
1734
1735
1735
1736
$ this ->factory ->assertSentCount (3 );
1736
1737
1737
- // Make sure was waited 300ms for the first two attempts
1738
- $ this ->assertEqualsWithDelta (0.3 , microtime (true ) - $ startTime , 0.03 );
1738
+ // Make sure we waited 300ms for the first two attempts
1739
+ Sleep::assertSleptTimes (2 );
1740
+
1741
+ Sleep::assertSequence ([
1742
+ Sleep::usleep (100_000 ),
1743
+ Sleep::usleep (200_000 ),
1744
+ ]);
1739
1745
}
1740
1746
1741
1747
public function testMiddlewareRunsWhenFaked ()
You can’t perform that action at this time.
0 commit comments