Example #1
0
 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);
 }
Example #2
0
 /**
  * Force a piped output stream to connect to a piped input stream and its
  * connected input stream is overwritten.
  */
 public function testForceConnect()
 {
     $upstream = new PipedOutputStream();
     $input = new PipedInputStream();
     $input->connect($upstream);
     $input->connect($upstream, true);
     $this->assertSame($upstream, $this->upstream->getValue($input));
     $this->assertFalse($upstream->isClosed());
 }