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


PHP vfsStreamWrapper類代碼示例

本文整理匯總了PHP中vfsStreamWrapper的典型用法代碼示例。如果您正苦於以下問題:PHP vfsStreamWrapper類的具體用法?PHP vfsStreamWrapper怎麽用?PHP vfsStreamWrapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了vfsStreamWrapper類的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()
 {
     $this->proxyClass = $this->buildAccessibleProxy('Tx_PtExtbase_SqlGenerator_SqlGenerator');
     $this->proxy = new $this->proxyClass();
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('Foo'));
 }
開發者ID:punktde,項目名稱:pt_extbase,代碼行數:7,代碼來源:SqlGeneratorTest.php

示例3: setUp

 function setUp()
 {
     _reset_wp();
     $this->cp = new ComicPress();
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('root'));
 }
開發者ID:johnbintz,項目名稱:comicpress-core,代碼行數:7,代碼來源:ComicPressTest.php

示例4: 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

示例5: unregisterWhenNotRegistered

 /**
  * Unregistering while not registers won't fail.
  *
  * @test
  */
 public function unregisterWhenNotRegistered()
 {
     // Unregister possible registered URL wrapper.
     vfsStreamWrapper::unregister();
     $this->assertNotContains(vfsStream::SCHEME, stream_get_wrappers());
     vfsStreamWrapper::unregister();
 }
開發者ID:kdambekalns,項目名稱:vfsStream,代碼行數:12,代碼來源:vfsStreamWrapperUnregisterTestCase.php

示例6: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->object = new F4h_TicketConverter_Data_Writer_Xml();
     $this->queue = $this->getMock('F4h_TicketConverter_Model_Queue');
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('root'));
 }
開發者ID:rebel-l,項目名稱:ticketconverter,代碼行數:11,代碼來源:XmlTest.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: setUp

 function setUp()
 {
     _reset_wp();
     $this->fa = new ComicPressBackendFilesystemFactory();
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('root'));
 }
開發者ID:johnbintz,項目名稱:comicpress-core,代碼行數:7,代碼來源:ComicPressBackendFilesystemFactoryTest.php

示例9: 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

示例10: set_up

 public function set_up()
 {
     $this->helper('directory');
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('testDir'));
     $this->_test_dir = vfsStreamWrapper::getRoot();
 }
開發者ID:ishawge,項目名稱:No-CMS,代碼行數:7,代碼來源:directory_helper_test.php

示例11: setUp

 /**
  * Setup
  *
  * @return void
  */
 public function setUp()
 {
     $this->unixStylePath = \TYPO3\FLOW3\Utility\Files::getUnixStylePath(__DIR__);
     $this->unixStylePathAndFilename = \TYPO3\FLOW3\Utility\Files::getUnixStylePath(__FILE__);
     \vfsStreamWrapper::register();
     \vfsStreamWrapper::setRoot(new \vfsStreamDirectory('testDirectory'));
 }
開發者ID:nxpthx,項目名稱:FLOW3,代碼行數:12,代碼來源:FileMonitorTest.php

示例12: testGenerateTest

 /**
  * @covers Generator::generate_test
  */
 function testGenerateTest()
 {
     mkdir(vfsStream::url('root/test/unit'), 0777, true);
     file_put_contents(vfsStream::url('root/template/unit_test.tmpl'), '{class_name}');
     Generator::generate_test('unit', 'Unit');
     $this->assertTrue(vfsStreamWrapper::getRoot()->hasChild('test/unit/UnitTest.php'));
     $this->assertEquals("Unit", file_get_contents(vfsStream::url('test/unit/UnitTest.php')));
 }
開發者ID:scottdavis,項目名稱:nimblize,代碼行數:11,代碼來源:GeneratorTest.php

示例13: setUp

 /**
  * Sets up this testcase
  *
  * @return void
  */
 public function setUp()
 {
     if (!class_exists('\\vfsStreamWrapper')) {
         $this->markTestSkipped('File backend tests are not available with this phpunit version.');
     }
     \vfsStreamWrapper::register();
     \vfsStreamWrapper::setRoot(new \vfsStreamDirectory('Foo'));
 }
開發者ID:noxludo,項目名稱:TYPO3v4-Core,代碼行數:13,代碼來源:FileBackendTest.php

示例14: testScriptExistsAndFails

 function testScriptExistsAndFails()
 {
     vfsStream::newFile('script')->at(vfsStreamWrapper::getRoot());
     $script_runner = new TryLib_Precheck_ScriptRunner(vfsStream::url('testDir/script'));
     $this->mock_cmd_runner->expects($this->once())->method('run')->with('vfs://testDir/script', false, true)->will($this->returnValue(255));
     $this->mock_cmd_runner->expects($this->once())->method('terminate')->with('Failed running pre-check script vfs://testDir/script');
     $script_runner->check($this->mock_cmd_runner, 'repoPath', 'origin/master');
 }
開發者ID:seanly,項目名稱:TryLib,代碼行數:8,代碼來源:ScriptRunnerTest.php

示例15: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     \vfsStreamWrapper::register();
     \vfsStreamWrapper::setRoot(new \vfsStreamDirectory('Foo'));
     $this->repository = $this->getAccessibleMock('TYPO3\\FLOW3\\I18n\\Cldr\\CldrRepository', array('dummy'));
     $this->repository->_set('cldrBasePath', 'vfs://Foo/');
     $this->dummyLocale = new \TYPO3\FLOW3\I18n\Locale('en');
 }
開發者ID:nxpthx,項目名稱:FLOW3,代碼行數:11,代碼來源:CldrRepositoryTest.php


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