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


PHP vfsStream::setup方法代碼示例

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


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

示例1: setUp

 /**
  * set up test environment
  */
 public function setUp()
 {
     vfsStream::setup()->lastModified(50)->lastAccessed(50)->lastAttributeModified(50);
     $this->fooUrl = vfsStream::url('root/foo.txt');
     $this->barUrl = vfsStream::url('root/bar');
     $this->bazUrl = vfsStream::url('root/bar/baz.txt');
 }
開發者ID:sunkangtaichi,項目名稱:PHPAPPLISTION_START,代碼行數:10,代碼來源:vfsStreamWrapperFileTimesTestCase.php

示例2: setUp

 function setUp()
 {
     parent::setUp();
     $this->mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
     $this->jenkins_runner = new TestRunner(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner);
     vfsStream::setup('testDir');
 }
開發者ID:seanly,項目名稱:TryLib,代碼行數:7,代碼來源:JenkinsRunnerTest.php

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

示例4: setUpVfsStream

 protected function setUpVfsStream()
 {
     if (!class_exists('vfsStream')) {
         $this->markTestSkipped('File backend tests are not available with this phpunit version.');
     }
     \vfsStream::setup('LogRoot');
 }
開發者ID:nicksergio,項目名稱:TYPO3v4-Core,代碼行數:7,代碼來源: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

 /**
  * 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

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

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

示例9: setUp

 public function setUp()
 {
     $this->mountDir = uniqid('mount-');
     $this->basedir = uniqid('base-');
     \vfsStream::setup($this->basedir);
     // Add an entry for the mount directory to the VFS contents
     $this->vfsContents = array($this->mountDir => array());
 }
開發者ID:nicksergio,項目名稱:TYPO3v4-Core,代碼行數:8,代碼來源:BaseTestCase.php

示例10: canNotRemoveWritableFileFromNonWritableDirectory

 /**
  * @test
  * @group  issue_51
  */
 public function canNotRemoveWritableFileFromNonWritableDirectory()
 {
     $structure = array('test_directory' => array('test.file' => ''));
     $root = vfsStream::setup('root', null, $structure);
     $root->getChild('test_directory')->chmod(0444);
     $root->getChild('test_directory')->getChild('test.file')->chmod(0777);
     $this->assertFalse(@unlink(vfsStream::url('root/test_directory/test.file')));
 }
開發者ID:1000k,項目名稱:whattoplaynext,代碼行數:12,代碼來源:UnlinkTestCase.php

示例11: setUp

 protected function setUp()
 {
     // setup a mock filesystem
     $lang = vfsStream::setup('lang');
     $this->langFile = new vfsStreamFile('language.php');
     $lang->addChild($this->langFile);
     $this->filePath = vfsStream::url('lang/language.php');
     $this->obj = new Language_WriteFile_Factory();
 }
開發者ID:hurcane,項目名稱:tiki-azure,代碼行數:9,代碼來源:FactoryTest.php

示例12: vfsStreamCanHandleUrlEncodedPath

 /**
  * @test
  */
 public function vfsStreamCanHandleUrlEncodedPath()
 {
     $content = '<xs:schema targetNamespace="http://www.example.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
                                 <xs:complexType name="myType"></xs:complexType>
                             </xs:schema>';
     $structure = array('foo bar' => array('schema.xsd' => $content));
     vfsStream::setup('root', null, $structure);
     $this->assertEquals($content, file_get_contents(vfsStream::url('root/foo bar/schema.xsd')));
 }
開發者ID:kdambekalns,項目名稱:vfsStream,代碼行數:12,代碼來源:Issue104TestCase.php

示例13: unlinkNonExistingFileTriggersError

 /**
  * @test
  * @since  1.4.0
  * @group  issue_68
  */
 public function unlinkNonExistingFileTriggersError()
 {
     vfsStream::setup();
     try {
         $this->assertFalse(unlink('vfs://root/foo.txt'));
     } catch (\PHPUnit_Framework_Error $fe) {
         $this->assertEquals('unlink(vfs://root/foo.txt): No such file or directory', $fe->getMessage());
     }
 }
開發者ID:kdambekalns,項目名稱:vfsStream,代碼行數:14,代碼來源:UnlinkTestCase.php

示例14: __construct

 /**
  * Registers vfsStream
  *
  * @param PHPUnit_Framework_TestCase $testCase
  *
  * @return vfsStreamHelper_Wrapper
  */
 public function __construct(PHPUnit_Framework_TestCase $testCase, $mountPoint = 'root')
 {
     @(include_once 'vfsStream/vfsStream.php');
     if (!class_exists('vfsStreamWrapper')) {
         $testCase->markTestSkipped('vfsStream is not available - skipping');
     } else {
         vfsStream::setup($mountPoint);
     }
 }
開發者ID:proofek,項目名稱:vfsStreamHelper,代碼行數:16,代碼來源:Wrapper.php

示例15: setUp

 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     vfsStream::setup('exampleDir');
     $file = vfsStream::newFile('test1.php');
     vfsStreamWrapper::getRoot()->addChild($file);
     $file->setContent('__' . '("test1"); __' . '(\'test2\')');
     $this->Translation_File_Source = new Translation_File_Source(vfsStream::url('exampleDir/test1.php'));
 }
開發者ID:spalax,項目名稱:zf2-translation-scanner,代碼行數:12,代碼來源:SourceTest.php


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