本文整理汇总了PHP中org\bovigo\vfs\vfsStream::setQuota方法的典型用法代码示例。如果您正苦于以下问题:PHP vfsStream::setQuota方法的具体用法?PHP vfsStream::setQuota怎么用?PHP vfsStream::setQuota使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org\bovigo\vfs\vfsStream
的用法示例。
在下文中一共展示了vfsStream::setQuota方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFilePutContentsWriteError
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));
}
}
示例2: testSaveRemovesFileOnError
public function testSaveRemovesFileOnError()
{
$root = vfsStream::setup('root');
$filename = $root->url() . '/test.xml';
$document = new DomDocument();
vfsStream::setQuota(1);
// File is opened, written but truncated
try {
$document->save($filename);
$this->fail('Expected exception has not been thrown');
} catch (\RuntimeException $e) {
$this->assertEquals("Error writing to file {$filename}", $e->getMessage());
$this->assertFileNotExists($filename);
}
}