handleWrite() public method

public handleWrite ( )
Exemplo n.º 1
0
 /**
  * @covers React\Stream\Buffer::write
  * @covers React\Stream\Buffer::handleWrite
  */
 public function testCloseDuringDrainWillNotEmitFullDrain()
 {
     $stream = fopen('php://temp', 'r+');
     $loop = $this->createLoopMock();
     $buffer = new Buffer($stream, $loop);
     $buffer->softLimit = 2;
     // close buffer on drain event => expect close event, but no full-drain after
     $buffer->on('drain', $this->expectCallableOnce());
     $buffer->on('drain', array($buffer, 'close'));
     $buffer->on('close', $this->expectCallableOnce());
     $buffer->on('full-drain', $this->expectCallableNever());
     $buffer->write("foo");
     $buffer->handleWrite();
 }
Exemplo n.º 2
0
 /**
  * @covers React\Stream\Buffer::write
  * @covers React\Stream\Buffer::handleWrite
  */
 public function testWriteEmitsErrorWhenResourceIsNotWritable()
 {
     if (defined('HHVM_VERSION')) {
         // via https://github.com/reactphp/stream/pull/52/files#r75493076
         $this->markTestSkipped('HHVM allows writing to read-only memory streams');
     }
     $stream = fopen('php://temp', 'r');
     $loop = $this->createLoopMock();
     $buffer = new Buffer($stream, $loop);
     $buffer->on('error', $this->expectCallableOnce());
     //$buffer->on('close', $this->expectCallableOnce());
     $buffer->write('hello');
     $buffer->handleWrite();
 }