Skip to content

Commit a86fae2

Browse files
kelunikjsor
authored andcommitted
Add tests for double watchers to be ignored
1 parent a756442 commit a86fae2

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/AbstractLoopTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ public function testAddReadStream()
4747
$this->tickLoop($this->loop);
4848
}
4949

50+
public function testAddReadStreamIgnoresSecondCallable()
51+
{
52+
list ($input, $output) = $this->createSocketPair();
53+
54+
$this->loop->addReadStream($input, $this->expectCallableExactly(2));
55+
$this->loop->addReadStream($input, $this->expectCallableNever());
56+
57+
fwrite($output, "foo\n");
58+
$this->tickLoop($this->loop);
59+
60+
fwrite($output, "bar\n");
61+
$this->tickLoop($this->loop);
62+
}
63+
5064
public function testAddWriteStream()
5165
{
5266
list ($input) = $this->createSocketPair();
@@ -56,6 +70,16 @@ public function testAddWriteStream()
5670
$this->tickLoop($this->loop);
5771
}
5872

73+
public function testAddWriteStreamIgnoresSecondCallable()
74+
{
75+
list ($input) = $this->createSocketPair();
76+
77+
$this->loop->addWriteStream($input, $this->expectCallableExactly(2));
78+
$this->loop->addWriteStream($input, $this->expectCallableNever());
79+
$this->tickLoop($this->loop);
80+
$this->tickLoop($this->loop);
81+
}
82+
5983
public function testRemoveReadStreamInstantly()
6084
{
6185
list ($input, $output) = $this->createSocketPair();

0 commit comments

Comments
 (0)