当前位置: 首页>>代码示例>>PHP>>正文


PHP vfsStream::create方法代码示例

本文整理汇总了PHP中org\bovigo\vfs\vfsStream::create方法的典型用法代码示例。如果您正苦于以下问题:PHP vfsStream::create方法的具体用法?PHP vfsStream::create怎么用?PHP vfsStream::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org\bovigo\vfs\vfsStream的用法示例。


在下文中一共展示了vfsStream::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUpVirtualFileAndGetPath

 /**
  * @param $csvContent
  * @return string
  */
 protected function setUpVirtualFileAndGetPath($csvContent)
 {
     $structure = array('directory' => array('my_file.csv' => $csvContent));
     vfsStream::setup();
     vfsStream::create($structure);
     return vfsStream::url('root/directory/my_file.csv');
 }
开发者ID:webgriffe,项目名称:associative-spreadsheet-iterator,代码行数:11,代码来源:IteratorTestCase.php

示例2: testLoad

 /**
  * Tests success case for loading a valid and readable YAML file.
  *
  * @covers ::load
  */
 public function testLoad()
 {
     $initialContent = ['hello' => 'world'];
     $ymlContent = Yaml::dump($initialContent);
     vfsStream::create(['file1' => $ymlContent], $this->root);
     $this->assertEquals($initialContent, (new YamlFileLoader())->load(vfsStream::url('test/file1')));
 }
开发者ID:ebidtech,项目名称:config-loader,代码行数:12,代码来源:YamlFileLoaderTest.php

示例3: initializeVfs

 protected function initializeVfs()
 {
     if (is_callable('org\\bovigo\\vfs\\vfsStream::create') === FALSE) {
         $this->markTestSkipped('vfsStream::create() does not exist');
     }
     vfsStream::create($this->vfsContents);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:7,代码来源:BaseTestCase.php

示例4: testLoad

 public function testLoad()
 {
     $initialContent = array('some content');
     vfsStream::create(array('file1' => json_encode($initialContent)), $this->root);
     $content = (new JsonFileLoader())->load(vfsStream::url('test/file1'));
     $this->assertEquals($initialContent, $content);
 }
开发者ID:ebidtech,项目名称:config-loader,代码行数:7,代码来源:JsonFileLoaderTest.php

示例5: setUp

 protected function setUp()
 {
     $this->loader = new LayoutLoader();
     $this->fileSystem = Stream::setup('root');
     $files = array('handle_one_file1.php' => sprintf('<?php %s', '$this->addItem(new EcomDev_LayoutCompiler_Layout_Item_Remove("handle_one_block_one"));'), 'handle_one_file2.php' => sprintf('<?php %s', implode("\n", array('$this->addItem(new EcomDev_LayoutCompiler_Layout_Item_Remove("handle_one_block_two"));', '$this->addItem($item = new EcomDev_LayoutCompiler_Layout_Item_Remove("handle_one_block_three"));', '$this->addItemRelation($item, "handle_one_block_three");'))), 'handle_two_file1.php' => sprintf('<?php %s', implode("\n", array('$this->addItem(new EcomDev_LayoutCompiler_Layout_Item_Remove("handle_two_block_one"));'))), 'handle_three_file1.php' => sprintf('<?php '), 'handle_three_file2.php' => sprintf('<?php '), 'handle_four_file1.php' => sprintf('<?php '));
     Stream::create($files, $this->fileSystem);
 }
开发者ID:albertobraschi,项目名称:EcomDev_LayoutCompiler,代码行数:7,代码来源:LoaderTest.php

示例6: testGetCommandsList

 public function testGetCommandsList()
 {
     $commandManager = $this->createCommandManager();
     $this->assertEquals([], $commandManager->getCommandsList());
     vfsStream::create(['foo.php' => '', 'bar.php' => '', 'baz' => ['baz.php' => '']], $this->commandsFolder);
     $this->assertEquals(['bar', 'baz', 'foo'], $commandManager->getCommandsList());
 }
开发者ID:it-shura,项目名称:mediawiki-sdk,代码行数:7,代码来源:CommandManagerTest.php

示例7: testRecursiveTempDirectory

 public function testRecursiveTempDirectory()
 {
     vfsStream::create(array('recursive' => array('a' => array('1' => 'file', 'A' => array()), 'b' => array())), $this->root);
     $temp = new TempDirectory(vfsStream::url('root/recursive'), true);
     unset($temp);
     $this->assertFalse($this->root->hasChild('recursive'), "recursive dir and its contents must have been deleted");
 }
开发者ID:vube,项目名称:php-filesystem,代码行数:7,代码来源:TempDirectoryTest.php

示例8: execute

 private function execute(array $fileStructure, array $options = []) : CommandTester
 {
     $fs = vfsStream::create($fileStructure, vfsStream::setup(getcwd()));
     $commandTester = new CommandTester($this->command);
     $commandTester->execute(array_merge(['command' => $this->command->getName(), 'path' => $fs->url()], $options));
     return $commandTester;
 }
开发者ID:phpassert,项目名称:phpassert,代码行数:7,代码来源:TestTestCommand.php

示例9: testItLoadsMetaDataObjectsFromFile

 /**
  * @param $fileContent
  * @param $expectedMetadataObjects
  * @param $expectedMetadataHandleObjects
  * 
  * @dataProvider dataProviderMetadataObjectsFromFile
  */
 public function testItLoadsMetaDataObjectsFromFile($fileContent, $expectedMetadataObjects, $expectedMetadataHandleObjects)
 {
     Stream::create(array('index_test_file.php' => $fileContent), $this->virtualDirectory);
     $this->index->setSavePath($this->virtualDirectory->url());
     $this->assertTrue($this->index->load(array('test' => 'file')));
     $this->assertAttributeEquals($expectedMetadataObjects, 'metadata', $this->index);
     $this->assertAttributeEquals($expectedMetadataHandleObjects, 'metadataByHandle', $this->index);
 }
开发者ID:albertobraschi,项目名称:EcomDev_LayoutCompiler,代码行数:15,代码来源:IndexTest.php

示例10: createTempFile

 private function createTempFile($file)
 {
     $url = vfsStream::url('root/' . $file);
     vfsStream::create(array($file => 'a temp file'), $this->root);
     $tempFile = new TempFile($url);
     // unused, we just want it to destruct after function returns
     $this->assertTrue($this->root->hasChild($file), "Expect we did create this file: {$file}");
 }
开发者ID:vube,项目名称:php-filesystem,代码行数:8,代码来源:TempFileTest.php

示例11: locate_should_return_correct_results

 /**
  * @test
  */
 public function locate_should_return_correct_results()
 {
     vfsStream::setup();
     $root = vfsStream::create(['config' => ['config_file.yml' => 'CONTENT', 'config_file.php' => 'CONTENT', 'foo.txt' => 'CONTENT'], 'src' => ['AppBundle' => ['config' => ['configuration.yml' => 'CONTENT']]], 'web' => ['app.php' => 'CONTENT']]);
     $result = $this->getLocator()->locate($root->url(), '.yml');
     sort($result);
     $this->assertEquals([$root->url() . '/config/config_file.yml', $root->url() . '/src/AppBundle/config/configuration.yml'], $result);
 }
开发者ID:alekitto,项目名称:metadata,代码行数:11,代码来源:BaseFileLocatorTest.php

示例12: setupVfsStream

 private function setupVfsStream()
 {
     $root = vfsStream::setup('root');
     vfsStream::create(['tmp' => ['file.txt' => 'foobar'], 'uploads' => ['image.png' => 'image']]);
     $this->sourceUrl = vfsStream::url('root/tmp/file.txt');
     $this->destUrl = vfsStream::url('root/uploads');
     $this->existingUrl = vfsStream::url('root/uploads/image.png');
 }
开发者ID:molnapps,项目名称:filemanager,代码行数:8,代码来源:FileManagerTest.php

示例13: mockFileSystem

 /**
  *
  * @param array $structure
  * @return string
  */
 public static function mockFileSystem(array $structure) : string
 {
     if (empty(self::$vfsStreamRoot)) {
         self::$vfsStreamRoot = vfsStream::setup('mock');
     }
     vfsStream::create($structure, self::$vfsStreamRoot);
     return vfsStream::url('mock');
 }
开发者ID:ignaszak,项目名称:cms,代码行数:13,代码来源:MockTest.php

示例14: setUp

 protected function setUp()
 {
     vfsStream::setup('root');
     vfsStream::create(['uploads' => ['upload 0 contents', 'upload 1 contents', 'upload 2 contents', 'upload 3 contents', 'upload 4 contents']]);
     $this->files = [['tmp_name' => vfsStream::url('root/uploads/0')], ['tmp_name' => vfsStream::url('root/uploads/1')], ['tmp_name' => vfsStream::url('root/uploads/2')], [], ['tmp_name' => [vfsStream::url('root/uploads/3'), vfsStream::url('root/uploads/4')]]];
     is_uploaded_file('', [$this->files[0]['tmp_name'], $this->files[1]['tmp_name'], $this->files[4]['tmp_name'][0], $this->files[4]['tmp_name'][1]]);
     $this->assertFilesExist();
 }
开发者ID:bitcpf,项目名称:djangoage,代码行数:8,代码来源:UnlinkUploadsTest.php

示例15: createVirtualFiles

 protected static function createVirtualFiles($upload_data)
 {
     $name_corrected_upload_data = [];
     foreach ($upload_data as $k => $v) {
         $name_corrected_upload_data[str_replace(self::BASE_PATH, "", $k)] = $v;
     }
     // vfsStream::create will take a reference, not a copy.
     vfsStream::create(['uploads' => $name_corrected_upload_data]);
 }
开发者ID:klarkc,项目名称:google-app-engine-php,代码行数:9,代码来源:DirectUploadHandler.php


注:本文中的org\bovigo\vfs\vfsStream::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。