public function testBasic() { $r = $w = false; $this->assertCount(0, $this->ticker); $file = fopen(__FILE__, "r"); stream_set_blocking($file, false); $this->ticker->read($file, function ($file) use(&$r) { fread($file, fstat($file)["size"]); }); $this->assertCount(1, $this->ticker); $this->ticker->write($file, function ($file) use(&$w) { return $w; }); $this->assertCount(2, $this->ticker); $this->assertSame(2, $this->ticker->wait()); $this->assertSame(0, $this->ticker->wait()); }