Skip to content

Commit a4bf806

Browse files
committed
Add StreamSelectLoop test for PHP_INT_MAX seconds timer interval.
1 parent be92b71 commit a4bf806

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/StreamSelectLoopTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,23 @@ public function testSmallTimerInterval()
176176

177177
$loop->run();
178178
}
179+
180+
/**
181+
* https://github.com/reactphp/event-loop/issues/19
182+
*
183+
* Tests that timer with PHP_INT_MAX seconds interval will work.
184+
*/
185+
public function testIntOverflowTimerInterval()
186+
{
187+
/** @var StreamSelectLoop|\PHPUnit_Framework_MockObject_MockObject $loop */
188+
$loop = $this->getMock('React\EventLoop\StreamSelectLoop', ['sleep']);
189+
$loop->expects($this->once())
190+
->method('sleep')
191+
->with(PHP_INT_MAX, 0)
192+
->willReturnCallback(function() use (&$loop) {
193+
$loop->stop();
194+
});
195+
$loop->addTimer(PHP_INT_MAX, function(){});
196+
$loop->run();
197+
}
179198
}

0 commit comments

Comments
 (0)