public function validFileProvider() { $root = vfsStream::setup(); $file2Kb = vfsStream::newFile('2kb.txt')->withContent(LargeFileContent::withKilobytes(2))->at($root); $file2Mb = vfsStream::newFile('2mb.txt')->withContent(LargeFileContent::withMegabytes(2))->at($root); return array(array($file2Kb->url(), '1kb', null, true), array($file2Kb->url(), '2kb', null, true), array($file2Kb->url(), null, '2kb', true), array($file2Kb->url(), null, '3kb', true), array($file2Kb->url(), '1kb', '3kb', true), array($file2Mb->url(), '1mb', null, true), array($file2Mb->url(), '2mb', null, true), array($file2Mb->url(), null, '2mb', true), array($file2Mb->url(), null, '3mb', true), array($file2Mb->url(), '1mb', '3mb', true), array($file2Kb->url(), '3kb', null, false), array($file2Kb->url(), null, '1kb', false), array($file2Kb->url(), '1kb', '1.5kb', false), array($file2Mb->url(), '2.5mb', null, false), array($file2Mb->url(), '3gb', null, false), array($file2Mb->url(), null, '1b', false), array($file2Mb->url(), '1pb', '3pb', false)); }
protected function createBinDirectory(vfsStreamDirectory $rootDirectory) { $directory = new vfsStreamDirectory('bin'); $rootDirectory->addChild($directory); $checkFile = new vfsStreamFile('check.sh', 0755); $checkFile->lastAccessed(mktime(23, 10, 23, 12, 14, 1977))->lastAttributeModified(mktime(23, 10, 23, 12, 14, 1977))->lastModified(mktime(23, 10, 23, 12, 14, 1977)); $directory->addChild($checkFile); $runFile = new vfsStreamFile('run.sh'); $runFile->chown(vfsStream::OWNER_USER_1)->chgrp(vfsStream::GROUP_USER_1)->withContent(LargeFileContent::withKilobytes(3)); $directory->addChild($runFile); }
public function fileProvider() { $root = vfsStream::setup(); $file = vfsStream::newFile('2kb.txt')->withContent(LargeFileContent::withKilobytes(2))->at($root); return [[$file]]; }
public function testGetSizeOutputsSize() { $content = LargeFileContent::withKilobytes(2); $adapter = $this->adapter; $adapter->write('2kb.txt', $content->content()); $this->assertEquals(filesize($this->root . '2kb.txt'), $adapter->getSize('2kb.txt')); }
public function testGetSizeOutputsSize() { $content = LargeFileContent::withKilobytes(2); $file = vfsStream::newFile('2kb.txt')->withContent($content)->at($this->root); $this->assertEquals($file->size(), $this->files->getSize($file->url())); }