public function testTruncate() { $s = new Stream(); $s->open(STREAM_MODE_READWRITE); $s->write('This is a beautiful example stream.'); // Truncating to a longer stream does not work... $this->assertFalse($s->truncate(1000)); // ... only truncating to smaller size $this->assertTrue($s->truncate(10)); $this->assertEquals($s->size(), 10); $this->assertEquals($s->tell(), 10); $this->assertEquals($s->buffer, 'This is a '); }