Skip to content

Commit f39d2ae

Browse files
committed
[RateLimiter] Add unittest for createFromPreviousWindow with a long expired window
1 parent 16a3f0c commit f39d2ae

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Symfony/Component/RateLimiter/Tests/Strategy/SlidingWindowTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,14 @@ public function testLongInterval()
6262
sleep(30);
6363
$this->assertSame(0, $new->getHitCount());
6464
}
65+
66+
public function testLongIntervalCreate()
67+
{
68+
ClockMock::register(SlidingWindow::class);
69+
$window = new SlidingWindow('foo', 60);
70+
71+
sleep(300);
72+
$new = SlidingWindow::createFromPreviousWindow($window, 60);
73+
$this->assertFalse($new->isExpired());
74+
}
6575
}

0 commit comments

Comments
 (0)