public function testEmitsErrorWhenPromiseRejects()
 {
     $promise = Timer\reject(0.001, $this->loop);
     $stream = Stream\unwrapReadable($promise);
     $this->assertTrue($stream->isReadable());
     $stream->on('error', $this->expectCallableOnce());
     $stream->on('end', $this->expectCallableNever());
     $this->loop->run();
     $this->assertFalse($stream->isReadable());
 }
Ejemplo n.º 2
0
 public function testCancelingPromiseWillRejectTimer()
 {
     $promise = Timer\reject(0.01, $this->loop);
     $promise->cancel();
     $this->expectPromiseRejected($promise);
 }