org\bovigo\vfs\vfsStream::setQuota PHP Method

setQuota() public static method

sets quota to given amount of bytes
Since: 1.1.0
public static setQuota ( integer $bytes )
$bytes integer
    public static function setQuota($bytes)
    {
        vfsStreamWrapper::setQuota(new Quota($bytes));
    }

Usage Example

Example #1
0
 public function testFilePutContentsWriteError()
 {
     // Force error by simulating full disk
     vfsStream::setQuota(3);
     $filename = $this->_root->url() . '/test.txt';
     try {
         FileObject::filePutContents($filename, 'content');
         $this->fail('Expected exception has not been thrown');
     } catch (\RuntimeException $e) {
         $this->assertEquals("Error writing to file {$filename}", $e->getMessage());
         // A truncated file should remain on disk
         $this->assertFileExists($filename);
         $this->assertEquals('con', file_get_contents($filename));
     }
 }
All Usage Examples Of org\bovigo\vfs\vfsStream::setQuota