8000 Found zeh bug: `spl_objet_hash()` was used instead of `spl_object_has… · reedy/reactphp-event-loop@427853c · GitHub
[go: up one dir, main page]

Skip to content

Commit 427853c

Browse files
committed
Found zeh bug: spl_objet_hash() was used instead of spl_object_hash()
1 parent 707a875 commit 427853c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/Timer/Timers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class Timers
2121

2222
public function updateTime()
2323
{
24-
return $this->time = microtime(true);
24+
return $this->time = \microtime(true);
2525
}
2626

2727
public function getTime()

tests/Timer/TimersTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace React\Tests\EventLoop\Timer;
44

5+
use React\EventLoop\TimerInterface;
56
use React\Tests\EventLoop\TestCase;
67
use React\EventLoop\Timer\Timer;
78
use React\EventLoop\Timer\Timers;
@@ -24,4 +25,19 @@ public function testBlockedTimer()
2425

2526
$this->assertTrue(true);
2627
}
28+
29+
public function testContains()
30+
{
31+
$timers = new Timers();
32+
33+
/** @var TimerInterface $timer1 */
34+
$timer1 = $this->createMock('React\EventLoop\TimerInterface');
35+
/** @var TimerInterface $timer2 */
36+
$timer2 = $this->createMock('React\EventLoop\TimerInterface');
37+
38+
$timers->add($timer1);
39+
40+
self::assertTrue($timers->contains($timer1));
41+
self::assertFalse($timers->contains($timer2));
42+
}
2743
}

0 commit comments

Comments
 (0)
0