/**
* @covers React\Stream\Buffer::end
*/
public function testEndWithData()
{
$stream = fopen('php://temp', 'r+');
$loop = $this->createWriteableLoopMock();
$buffer = new Buffer($stream, $loop);
$buffer->on('error', $this->expectCallableNever());
$buffer->on('close', $this->expectCallableOnce());
$buffer->end('final words');
rewind($stream);
$this->assertSame('final words', stream_get_contents($stream));
}