/** * @expectedException Respect\Validation\Exceptions\SizeException * @expectedExceptionMessage "vfs://root/1gb.txt" must be greater than 2pb */ public function testShouldThrowsSizeExceptionWhenAsserting() { $root = vfsStream::setup(); $file1Gb = vfsStream::newFile('1gb.txt')->withContent(LargeFileContent::withGigabytes(1))->at($root); $rule = new Size('2pb'); $rule->assert($file1Gb->url()); }
public function setUp() { parent::setUp(); $this->root = vfsStream::setup('root_dir', null, ['foo.txt' => 'foobar', 'bar.php' => '<?php echo "bar";']); vfsStream::newFile('large.txt')->withContent(LargeFileContent::withMegabytes(100))->at($this->root); app()['path.upload'] = vfsStream::url('root_dir') . '/upload'; $this->uploadService = app()->make('transit.upload'); }
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); }
/** * set up test environment */ public function setUp() { $root = vfsStream::setup(); $this->largeFile = vfsStream::newFile('large.txt')->withContent(LargeFileContent::withGigabytes(100))->at($root); }
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())); }