public function close()
{
$this->writable = false;
$this->listening = false;
$this->data = '';
$this->emit('close', array($this));
}
/** * @covers React\Stream\Buffer::write * @covers React\Stream\Buffer::close */ public function testWritingToClosedBufferShouldNotWriteToStream() { $stream = fopen('php://temp', 'r+'); $loop = $this->createWriteableLoopMock(); $buffer = new Buffer($stream, $loop); $buffer->close(); $buffer->write('foo'); rewind($stream); $this->assertSame('', stream_get_contents($stream)); }