Skip to content

Commit 31a613a

Browse files
committed
Add StreamSelectLoop test for PHP_INT_MAX seconds timer interval.
1 parent 69aa951 commit 31a613a

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy