assertInstanceOf(Channel::class, $a); $this->assertInstanceOf(Channel::class, $b); } public function testClose() { list($a, $b) = Channel::create(); // Close $a. $b should close on next read... $a->close(); new Coroutine\Coroutine($b->receive()); Loop\run(); $this->assertFalse($a->isOpen()); $this->assertFalse($b->isOpen()); } public function testSendReceive() { Coroutine\create(function () { list($a, $b) = Channel::create(); yield $a->send('hello'); $data = (yield $b->receive()); $this->assertEquals('hello', $data); }); Loop\run(); } }