Esempio n. 1
0
 public function testReadAndWrite()
 {
     $stream = new Stream('php://memory', 'w+');
     $this->assertEquals(0, $stream->getSize());
     $stream->write("Hello World, And All Developers!");
     $this->assertEquals(32, $stream->getSize());
     // size
     $this->assertEquals(32, $stream->tell());
     // pointer
     $stream->rewind();
     $this->assertEquals(0, $stream->tell());
     $this->assertFalse($stream->eof());
     $this->assertEquals("Hell", $stream->read(4));
     $this->assertEquals("o World, ", $stream->read(9));
     $this->assertEquals("And All Developers!", $stream->getContents());
     $this->assertTrue($stream->eof());
 }