public function testWriteTo() { $stream = new StringOutputStream(); $stream->write('hello'); $out = new PipedOutputStream(); $in = new PipedInputStream($out); $stream->writeTo($out); $this->assertEquals(5, $in->read($buffer, 5)); $this->assertEquals('hello', $buffer); }