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


PHP vfsStream类代码示例

本文整理汇总了PHP中vfsStream的典型用法代码示例。如果您正苦于以下问题:PHP vfsStream类的具体用法?PHP vfsStream怎么用?PHP vfsStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 public function __construct()
 {
     $config = new stdClass();
     $config->paths = new stdClass();
     $config->paths->docroot = null;
     $config->site = new stdClass();
     $config->site->mode = 'prod';
     $config->site->cdnPrefix = 'a';
     $config->defaults = new stdClass();
     $config->defaults->cdnPrefix = '';
     $config->defaults->mediaVersion = 'a';
     parent::__construct(array('config' => $config));
     if (class_exists('vfsStream')) {
         vfsStreamWrapper::register();
         vfsStreamWrapper::setRoot(new vfsStreamDirectory('assetDir'));
         $config->paths->docroot = vfsStream::url('assetDir');
     }
     $this->docroot = $config->paths->docroot;
     $this->cacheDir = sprintf('%s/assets/cache', $this->docroot);
     $this->assets = $this->assetsRel = array('js' => array(), 'css' => array());
     $siteMode = $config->site->mode;
     if ($siteMode === 'prod') {
         $this->mode = self::minified;
     } else {
         $this->mode = self::combined;
     }
     $this->returnAsHeader = false;
 }
开发者ID:gg1977,项目名称:frontend,代码行数:28,代码来源:AssetPipelineTest.php

示例2: setUp

 public function setUp()
 {
     if (class_exists('vfsStream')) {
         vfsStreamWrapper::register();
         vfsStreamWrapper::setRoot(new vfsStreamDirectory('scriptsDir'));
         $this->scriptsDir = vfsStream::url('scriptsDir');
         mkdir($upgradeDir = "{$this->scriptsDir}/upgrade");
         mkdir("{$this->scriptsDir}/upgrade/readme");
         mkdir("{$this->scriptsDir}/upgrade/base");
         mkdir("{$this->scriptsDir}/upgrade/db");
         mkdir("{$this->scriptsDir}/upgrade/db/mysql");
         mkdir("{$this->scriptsDir}/upgrade/fs");
         $this->assertTrue(is_dir($upgradeDir));
     }
     $this->config = new stdClass();
     $this->config->paths = new stdClass();
     $this->config->paths->configs = $this->scriptsDir;
     $this->config->defaults = new stdClass();
     $this->config->defaults->currentCodeVersion = '1.1.1';
     $this->config->defaults->lastCodeVersion = '2.2.2';
     $this->config->site = new stdClass();
     $this->config->site->lastCodeVersion = '3.3.3';
     $params = array('config' => $this->config);
     $this->upgrade = new Upgrade($params);
 }
开发者ID:nicolargo,项目名称:frontend,代码行数:25,代码来源:UpgradeTest.php

示例3: generateExtensionFromVersion1Configuration

 /**
  * This test creates an extension based on a JSON file, generated
  * with version 1.0 of the ExtensionBuilder and compares all
  * generated files with the originally created ones
  * This test should help, to find compatibility breaking changes
  *
  * @test
  */
 function generateExtensionFromVersion1Configuration()
 {
     $this->configurationManager = $this->getMock($this->buildAccessibleProxy('Tx_ExtensionBuilder_Configuration_ConfigurationManager'), array('dummy'));
     $this->extensionSchemaBuilder = $this->objectManager->get('Tx_ExtensionBuilder_Service_ExtensionSchemaBuilder');
     $testExtensionDir = PATH_typo3conf . 'ext/extension_builder/Tests/Examples/TestExtensions/test_extension_v1/';
     $jsonFile = $testExtensionDir . Tx_ExtensionBuilder_Configuration_ConfigurationManager::EXTENSION_BUILDER_SETTINGS_FILE;
     if (file_exists($jsonFile)) {
         // compatibility adaptions for configurations from older versions
         $extensionConfigurationJSON = json_decode(file_get_contents($jsonFile), TRUE);
         $extensionConfigurationJSON = $this->configurationManager->fixExtensionBuilderJSON($extensionConfigurationJSON);
     } else {
         $this->fail('JSON file not found');
     }
     $this->extension = $this->extensionSchemaBuilder->build($extensionConfigurationJSON);
     $this->codeGenerator->setSettings(array('codeTemplateRootPath' => PATH_typo3conf . 'ext/extension_builder/Resources/Private/CodeTemplates/Extbase/', 'extConf' => array('enableRoundtrip' => '0')));
     $newExtensionDir = vfsStream::url('testDir') . '/';
     $this->extension->setExtensionDir($newExtensionDir . 'test_extension/');
     $this->codeGenerator->build($this->extension);
     $referenceFiles = t3lib_div::getAllFilesAndFoldersInPath(array(), $testExtensionDir);
     foreach ($referenceFiles as $referenceFile) {
         $createdFile = str_replace($testExtensionDir, $this->extension->getExtensionDir(), $referenceFile);
         if (!in_array(basename($createdFile), array('ExtensionBuilder.json'))) {
             // json file is generated by controller
             $referenceFileContent = str_replace(array('2011-08-11', '###YEAR###'), array(date('Y-m-d'), date('Y')), file_get_contents($referenceFile));
             //t3lib_div::writeFile(PATH_site.'fileadmin/'.basename($createdFile), file_get_contents($createdFile));
             $this->assertFileExists($createdFile, 'File ' . $createdFile . ' was not created!');
             $this->assertEquals(t3lib_div::trimExplode("\n", $referenceFileContent, TRUE), t3lib_div::trimExplode("\n", file_get_contents($createdFile), TRUE), 'File ' . $createdFile . ' was not equal to original file.');
         }
     }
 }
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:38,代码来源:CompatibilityTest.php

示例4: testWriteRecord

 /**
  * @dataProvider writeRecordProvider
  * @param unknown_type $record
  * @param unknown_type $expected
  * @param unknown_type $escape
  */
 public function testWriteRecord($record, $expected, $escape, $lr)
 {
     $dir = vfsStream::setup('base');
     $sut = new Dfp_Datafeed_File_Writer_Format_Csv_File();
     $passed = $passed2 = false;
     try {
         $sut->writeRecord(array('test', 'testing', '2.35', '"test"'));
     } catch (Dfp_Datafeed_File_Writer_Exception $e) {
         if ($e->getMessage() == 'The file is not open') {
             $passed = True;
         }
     }
     $sut->open(vfsStream::url('base/test.csv'));
     try {
         $sut->writeRecord(array('test', 'testing', '2.35', '"test"'));
     } catch (Dfp_Datafeed_File_Writer_Exception $e) {
         if ($e->getMessage() == 'The dialect is invalid') {
             $passed2 = True;
         }
     }
     $mockDialect = $this->getMock('Dfp_Datafeed_File_Format_Csv_Dialect_Interface');
     $mockDialect->expects($this->any())->method('getQuote')->will($this->returnValue('"'));
     $mockDialect->expects($this->any())->method('getDelimiter')->will($this->returnValue(','));
     $mockDialect->expects($this->any())->method('getEscape')->will($this->returnValue($escape));
     $mockDialect->expects($this->any())->method('getLineReturn')->will($this->returnValue($lr));
     $sut->setDialect($mockDialect);
     $sut->writeRecord($record);
     $this->assertEquals($expected, file_get_contents(vfsStream::url('base/test.csv')));
     //echo "\n\n";var_dump(getcwd());
 }
开发者ID:henryhayes,项目名称:dfp,代码行数:36,代码来源:FileTest.php

示例5: setUp

 /**
  * set up test environment
  */
 public function setUp()
 {
     vfsStream::setup('root');
     $this->rootDir = vfsStream::url('root');
     $this->lostAndFound = $this->rootDir . '/lost+found/';
     mkdir($this->lostAndFound);
 }
开发者ID:mikey179,项目名称:vfsstream,代码行数:10,代码来源:FilenameTestCase.php

示例6: setUp

 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('exampleDir'));
     $this->Translation_File_Output = new Translation_File_Output_JavaScript(vfsStream::url('exampleDir/subdir1/subdir2/test.js'));
 }
开发者ID:spalax,项目名称:zf2-translation-scanner,代码行数:10,代码来源:OutputTest.php

示例7: testProviderReturnsAResultForEveryInstalledLanguage

 /**
  * @param ilTermsOfServiceAgreementByLanguageProvider $provider
  * @depends testAgreementByLanguageProviderCanBeCreatedByFactory
  */
 public function testProviderReturnsAResultForEveryInstalledLanguage(ilTermsOfServiceAgreementByLanguageProvider $provider)
 {
     $client_rel_path = implode('/', array('clients', 'default', 'agreement'));
     $global_rel_path = implode('/', array('global', 'agreement'));
     $root = vfsStreamWrapper::setRoot(new vfsStreamDirectory('root'));
     $customizing_dir = vfsStream::newDirectory('Customizing')->at($root);
     $client_dir = vfsStream::newDirectory($client_rel_path)->at($customizing_dir);
     vfsStream::newFile('agreement_de.html', 0777)->at($client_dir);
     file_put_contents(vfsStream::url('root/Customizing/' . $client_rel_path . '/agreement_de.html'), 'phpunit');
     $global_dir = vfsStream::newDirectory($global_rel_path)->at($customizing_dir);
     vfsStream::newFile('agreement_en.html', 0777)->at($global_dir);
     file_put_contents(vfsStream::url('root/Customizing/' . $global_rel_path . '/agreement_en.html'), 'phpunit');
     $provider->setSourceDirectories(array(vfsStream::url('root/Customizing/' . $client_rel_path), vfsStream::url('root/Customizing/' . $global_rel_path)));
     $lng = $this->getMockBuilder('ilLanguage')->disableOriginalConstructor()->getMock();
     $installed_languages = array('en', 'de', 'fr');
     $lng->expects($this->once())->method('getInstalledLanguages')->will($this->onConsecutiveCalls($installed_languages));
     $provider->setLanguageAdapter($lng);
     $data = $provider->getList(array(), array());
     $this->assertArrayHasKey('items', $data);
     $this->assertArrayHasKey('cnt', $data);
     $this->assertCount(count($installed_languages), $data['items']);
     $this->assertEquals(count($installed_languages), $data['cnt']);
     for ($i = 0; $i < count($installed_languages); $i++) {
         $this->assertArrayHasKey('language', $data['items'][$i]);
         $this->assertArrayHasKey('agreement', $data['items'][$i]);
         $this->assertArrayHasKey('agreement_document', $data['items'][$i]);
         $this->assertArrayHasKey('agreement_document_modification_ts', $data['items'][$i]);
         if ($installed_languages[$i] == 'fr') {
             $this->assertFalse(file_exists($data['items'][$i]['agreement_document']));
         } else {
             $this->assertTrue(file_exists($data['items'][$i]['agreement_document']));
         }
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:38,代码来源:ilTermsOfServiceAgreementsByLanguageTableDataProviderTest.php

示例8: testDirectoryIsCreated

 /**
  * test that the directory is created
  */
 public function testDirectoryIsCreated()
 {
     $example = new Example('id');
     $this->assertFalse(vfsStreamWrapper::getRoot()->hasChild('id'));
     $example->setDirectory(vfsStream::url('exampleDir'));
     $this->assertTrue(vfsStreamWrapper::getRoot()->hasChild('id'));
 }
开发者ID:pago,项目名称:pantr,代码行数:10,代码来源:ExampleTestCaseWithVfsStream.php

示例9: testGenerateXml

 /**
  * @large
  */
 public function testGenerateXml()
 {
     $syntaxFile = $this->fixtureDir . DIRECTORY_SEPARATOR . "test_grammar.ebnf";
     \vfsStream::setup("testdir");
     $this->assertEquals(Command::EBNF_OK, Command::main(array("s" => $syntaxFile, "o" => \vfsStream::url("testdir/out.xml"), "f" => "xml")));
     $this->assertEquals(file_get_contents($this->fixtureDir . DIRECTORY_SEPARATOR . "test_grammar.xml"), file_get_contents(\vfsStream::url("testdir/out.xml")));
 }
开发者ID:bgarrels,项目名称:ebnf,代码行数:10,代码来源:CommandTest.php

示例10: setUp

 /**
  * set up test environment
  */
 public function setUp()
 {
     $this->backupIncludePath = get_include_path();
     vfsStream::setup();
     mkdir('vfs://root/a/path', 0777, true);
     set_include_path('vfs://root/a' . PATH_SEPARATOR . $this->backupIncludePath);
 }
开发者ID:sunkangtaichi,项目名称:PHPAPPLISTION_START,代码行数:10,代码来源:vfsStreamResolveIncludePathTestCase.php

示例11: testGetTranslations_shouldReturnEmptyArray

 public function testGetTranslations_shouldReturnEmptyArray()
 {
     $root = vfsStream::setup('root');
     $root->addChild(new vfsStreamFile('language.php'));
     $obj = new Language_File(vfsStream::url('root/language.php'));
     $this->assertEquals(array(), $obj->getTranslations());
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:7,代码来源:ParseFileTest.php

示例12: setLogFileSetsLogFile

 /**
  * @test
  */
 public function setLogFileSetsLogFile()
 {
     $this->setUpVfsStream();
     vfsStream::newFile($this->logFileName)->at(vfsStreamWrapper::getRoot());
     $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter');
     $writer->setLogFile($this->getDefaultFileName());
     $this->assertAttributeEquals($this->getDefaultFileName(), 'logFile', $writer);
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:11,代码来源:class.t3lib_log_writer_fileTest.php

示例13: __construct

 /**
  * constructor
  *
  * @param  vfsStreamContent[]  $children
  */
 public function __construct(array $children)
 {
     $this->children = $children;
     if (vfsStream::useDotfiles()) {
         array_unshift($this->children, new DotDirectory('.'), new DotDirectory('..'));
     }
     reset($this->children);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:13,代码来源:vfsStreamContainerIterator.php

示例14: __construct

 /**
  * constructor
  *
  * @param  string  $name
  * @param  int     $permissions
  */
 public function __construct($name, $permissions = 0777)
 {
     $this->name = $name;
     $this->lastModified = time();
     $this->permissions = $permissions;
     $this->user = vfsStream::getCurrentUser();
     $this->group = vfsStream::getCurrentGroup();
 }
开发者ID:pago,项目名称:pantr,代码行数:14,代码来源:vfsStreamAbstractContent.php

示例15: getLanguagesScansFormatDirectoryAndReturnsLanguagesAsStrings

 /**
  * @test
  */
 public function getLanguagesScansFormatDirectoryAndReturnsLanguagesAsStrings()
 {
     $formatPath = \vfsStream::url('testDirectory') . '/';
     \TYPO3\FLOW3\Utility\Files::createDirectoryRecursively($formatPath . 'en');
     $format = new \TYPO3\FLOW3\Package\Documentation\Format('DocBook', $formatPath);
     $availableLanguages = $format->getAvailableLanguages();
     $this->assertEquals(array('en'), $availableLanguages);
 }
开发者ID:nxpthx,项目名称:FLOW3,代码行数:11,代码来源:FormatTest.php


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