public function testRunWaitsForFutureTickEvents()
 {
     $stream = $this->createStream();
     $this->loop->addWriteStream($stream, function () use($stream) {
         $this->loop->removeStream($stream);
         $this->loop->futureTick(function () {
             echo 'future-tick' . PHP_EOL;
         });
     });
     $this->expectOutputString('future-tick' . PHP_EOL);
     $this->loop->run();
 }
Exemple #2
0
 public function close()
 {
     if ($this->closed) {
         return;
     }
     $this->emit('end', array($this));
     $this->loop->removeStream($this->fileDescriptor);
     $this->buffer->removeAllListeners();
     $this->removeAllListeners();
     unset($this->socket);
     $this->closed = true;
 }
 /**
  * Remove all listeners for the given stream.
  *
  * @param stream $stream The PHP stream resource.
  */
 public function removeStream($stream)
 {
     $this->emit('removeStream', [$stream]);
     $this->loop->removeStream($stream);
 }
 public function shutdown()
 {
     $this->loop->removeStream($this->master);
     fclose($this->master);
     $this->removeAllListeners();
 }