3 * This file is part of vfsStream.
5 * For the full copyright and license information, please view the LICENSE
6 * file that was distributed with this source code.
8 * @package org\bovigo\vfs
10 namespace org\bovigo\vfs;
11 use org\bovigo\vfs\content\LargeFileContent;
13 * Test for large file mocks.
20 class vfsStreamWrapperLargeFileTestCase extends \PHPUnit_Framework_TestCase
30 * set up test environment
32 public function setUp()
34 $root = vfsStream::setup();
35 $this->largeFile = vfsStream::newFile('large.txt')
36 ->withContent(LargeFileContent::withGigabytes(100))
43 public function hasLargeFileSize()
45 if (PHP_INT_MAX == 2147483647) {
46 $this->markTestSkipped('Requires 64-bit version of PHP');
50 100 * 1024 * 1024 * 1024,
51 filesize($this->largeFile->url())
58 public function canReadFromLargeFile()
60 $fp = fopen($this->largeFile->url(), 'rb');
61 $data = fread($fp, 15);
63 $this->assertEquals(str_repeat(' ', 15), $data);
69 public function canWriteIntoLargeFile()
71 $fp = fopen($this->largeFile->url(), 'rb+');
72 fseek($fp, 100 * 1024 * 1024, SEEK_SET);
73 fwrite($fp, 'foobarbaz');
75 $this->largeFile->seek((100 * 1024 * 1024) - 3, SEEK_SET);
78 $this->largeFile->read(15)