當前位置: 首頁>>代碼示例>>PHP>>正文


PHP vfsStream::create方法代碼示例

本文整理匯總了PHP中vfsStream::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP vfsStream::create方法的具體用法?PHP vfsStream::create怎麽用?PHP vfsStream::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vfsStream的用法示例。


在下文中一共展示了vfsStream::create方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: initializeVfs

 protected function initializeVfs()
 {
     if (is_callable('vfsStream::create') === FALSE) {
         $this->markTestSkipped('vfsStream::create() does not exist');
     }
     \vfsStream::create($this->vfsContents);
 }
開發者ID:nicksergio,項目名稱:TYPO3v4-Core,代碼行數:7,代碼來源:BaseTestCase.php

示例2: test_directory_map

 public function test_directory_map()
 {
     $structure = array('libraries' => array('benchmark.html' => '', 'database' => array('active_record.html' => '', 'binds.html' => ''), 'email.html' => '', '0' => '', '.hiddenfile.txt' => ''));
     vfsStream::create($structure, $this->_test_dir);
     // test default recursive behavior
     $expected = array('libraries/' => array('benchmark.html', 'database/' => array('active_record.html', 'binds.html'), 'email.html', '0'));
     $this->assertEquals($expected, directory_map(vfsStream::url('testDir')));
     // test detection of hidden files
     $expected['libraries/'][] = '.hiddenfile.txt';
     $this->assertEquals($expected, directory_map(vfsStream::url('testDir'), FALSE, TRUE));
     // test recursion depth behavior
     $this->assertEquals(array('libraries/'), directory_map(vfsStream::url('testDir'), 1));
 }
開發者ID:ishawge,項目名稱:No-CMS,代碼行數:13,代碼來源:directory_helper_test.php

示例3: test_directory_map

 public function test_directory_map()
 {
     $ds = DIRECTORY_SEPARATOR;
     $structure = array('libraries' => array('benchmark.html' => '', 'database' => array('active_record.html' => '', 'binds.html' => ''), 'email.html' => '', '0' => '', '.hiddenfile.txt' => ''));
     vfsStream::create($structure, $this->_test_dir);
     // is_dir(), opendir(), etc. seem to fail on Windows + vfsStream when there are trailing backslashes in directory names
     if (!is_dir(vfsStream::url('testDir') . DIRECTORY_SEPARATOR)) {
         $this->markTestSkipped();
         return;
     }
     // test default recursive behavior
     $expected = array('libraries' . $ds => array('benchmark.html', 'database' . $ds => array('active_record.html', 'binds.html'), 'email.html', '0'));
     $this->assertEquals($expected, directory_map(vfsStream::url('testDir')));
     // test detection of hidden files
     $expected['libraries' . $ds][] = '.hiddenfile.txt';
     $this->assertEquals($expected, directory_map(vfsStream::url('testDir'), 0, TRUE));
     // test recursion depth behavior
     $this->assertEquals(array('libraries' . $ds), directory_map(vfsStream::url('testDir'), 1));
 }
開發者ID:webalchemist,項目名稱:A3M,代碼行數:19,代碼來源:directory_helper_test.php

示例4: createCastsNumericDirectoriesToStringsWithRoot

 /**
  * @test
  * @group  issue_20
  * @since  0.11.0
  */
 public function createCastsNumericDirectoriesToStringsWithRoot()
 {
     $root = vfsStream::setup();
     $this->assertSame($root, vfsStream::create(array(2011 => array('test.txt' => 'some content'))));
     $this->assertTrue($root->hasChild('2011'));
     $directory = $root->getChild('2011');
     $this->assertVfsFile($directory->getChild('test.txt'), 'some content');
 }
開發者ID:1000k,項目名稱:whattoplaynext,代碼行數:13,代碼來源:vfsStreamTestCase.php

示例5: ci_vfs_create

 /**
  * Create VFS content
  *
  * @param	string	File name
  * @param	string	File content
  * @param	object	VFS directory object
  * @param	mixed	Optional subdirectory path or array of subs
  * @return	void
  */
 public function ci_vfs_create($file, $content = '', $root = NULL, $path = NULL)
 {
     // Check for array
     if (is_array($file)) {
         foreach ($file as $name => $content) {
             $this->ci_vfs_create($name, $content, $root, $path);
         }
         return;
     }
     // Assert .php extension if none given
     if (pathinfo($file, PATHINFO_EXTENSION) == '') {
         $file .= '.php';
     }
     // Build content
     $tree = array($file => $content);
     // Check for path
     $subs = array();
     if ($path) {
         // Explode if not array
         $subs = is_array($path) ? $path : explode('/', trim($path, '/'));
     }
     // Check for root
     if (!$root) {
         // Use base VFS root
         $root = $this->ci_vfs_root;
     }
     // Handle subdirectories
     while ($dir = array_shift($subs)) {
         // See if subdir exists under current root
         $dir_root = $root->getChild($dir);
         if ($dir_root) {
             // Yes - recurse into subdir
             $root = $dir_root;
         } else {
             // No - put subdirectory back and quit
             array_unshift($subs, $dir);
             break;
         }
     }
     // Create any remaining subdirectories
     if ($subs) {
         foreach (array_reverse($subs) as $dir) {
             // Wrap content in subdirectory for creation
             $tree = array($dir => $tree);
         }
     }
     // Create tree
     vfsStream::create($tree, $root);
 }
開發者ID:madwings,項目名稱:insanedb,代碼行數:58,代碼來源:ci_testcase.php

示例6: getFolderListFailsIfDirectoryDoesNotExist

 /**
  * @test
  */
 public function getFolderListFailsIfDirectoryDoesNotExist()
 {
     $this->setExpectedException('InvalidArgumentException', '', 1314349666);
     $fixture = $this->createDriverFixture(array('basePath' => $this->getMountRootUrl()));
     \vfsStream::create(array($this->basedir => array('somefile' => '')));
     $fixture->getFolderList('somedir/');
 }
開發者ID:nicksergio,項目名稱:TYPO3v4-Core,代碼行數:10,代碼來源:LocalDriverTest.php

示例7: directoryExitsTestUsingTrailingWinDirSeparator

 /**
  * @test
  */
 public function directoryExitsTestUsingTrailingWinDirSeparator()
 {
     $structure = array('dir' => array('bar' => array()));
     vfsStream::create($structure, $this->root);
     $this->assertTrue(file_exists(vfsStream::url('root/') . 'dir\\'));
 }
開發者ID:mikey179,項目名稱:vfsstream,代碼行數:9,代碼來源:vfsStreamWrapperDirSeparatorTestCase.php

示例8: recursiveDirectoryIterationWithDotsDisabled

 /**
  * @test
  * @group  issue_50
  */
 public function recursiveDirectoryIterationWithDotsDisabled()
 {
     vfsStream::disableDotfiles();
     vfsStream::setup();
     $structure = array('Core' => array('AbstractFactory' => array('test.php' => 'some text content', 'other.php' => 'Some more text content', 'Invalid.csv' => 'Something else'), 'AnEmptyFolder' => array(), 'badlocation.php' => 'some bad content'));
     $root = vfsStream::create($structure);
     $rootPath = vfsStream::url($root->getName());
     $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($rootPath), \RecursiveIteratorIterator::CHILD_FIRST);
     $pathes = array();
     foreach ($iterator as $fullFileName => $fileSPLObject) {
         $pathes[] = $fullFileName;
     }
     $this->assertEquals(array('vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AbstractFactory' . DIRECTORY_SEPARATOR . 'test.php', 'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AbstractFactory' . DIRECTORY_SEPARATOR . 'other.php', 'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AbstractFactory' . DIRECTORY_SEPARATOR . 'Invalid.csv', 'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AbstractFactory', 'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AnEmptyFolder', 'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'badlocation.php', 'vfs://root' . DIRECTORY_SEPARATOR . 'Core'), $pathes);
 }
開發者ID:kdambekalns,項目名稱:vfsStream,代碼行數:18,代碼來源:DirectoryIterationTestCase.php

示例9: createWithEmptyName

 /**
  * tests that a blank name for a block device throws an exception
  * @test
  * @expectedException org\bovigo\vfs\vfsStreamException
  */
 public function createWithEmptyName()
 {
     $structure = array('topLevel' => array('thisIsAFile' => 'file contents', '[]' => 'block contents'));
     $root = vfsStream::create($structure);
 }
開發者ID:kdambekalns,項目名稱:vfsStream,代碼行數:10,代碼來源:vfsStreamBlockTestCase.php


注:本文中的vfsStream::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。