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


PHP vfsStreamWrapper::getRoot方法代码示例

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


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

示例1: createFile

 private function createFile($filePath, $body = 'hello')
 {
     vfsStream::newFile($filePath)->at(vfsStreamWrapper::getRoot());
     $path = vfsStream::url('root/' . $filePath);
     file_put_contents($path, $body);
     return $path;
 }
开发者ID:mirobrando,项目名称:ng-phalcon,代码行数:7,代码来源:ManagementPathTest.php

示例2: test_create_token_folder_if_it_does_not_exist

 public function test_create_token_folder_if_it_does_not_exist()
 {
     $this->assertFalse(vfsStreamWrapper::getRoot()->hasChild('tokens'), 'Folder should not exists');
     $tokenizer = $this->instantiateClass('token_filename_retrieve.token', vfsStream::url('testDir/tokens'), $this->token_content, new Filesystem());
     $tokenizer->retrieve();
     $this->assertTrue(vfsStreamWrapper::getRoot()->hasChild('tokens'), 'Folder should now exists even if retrieve notes file does not');
 }
开发者ID:alnutile,项目名称:token_file_creator,代码行数:7,代码来源:TokenizerModelTest.php

示例3: testConstruct

 public function testConstruct()
 {
     // test non existent file
     $nonExistentFilePath = "non/existent/file.php";
     try {
         new ConsoleRunner($nonExistentFilePath, $this->pidFactory, []);
         $this->fail("Should not be able to create a console runner without a console file that exists");
     } catch (RunnerException $e) {
         $this->assertContains($nonExistentFilePath, $e->getMessage());
     }
     // test non executable file
     $nonExecutableFilePath = "nonExecutableFile.php";
     $nonExecutableFile = vfsStream::newFile($nonExecutableFilePath, 00);
     vfsStreamWrapper::getRoot()->addChild($nonExecutableFile);
     $nonExecutableFilePath = $this->getPath($nonExecutableFilePath);
     try {
         new ConsoleRunner($nonExecutableFilePath, $this->pidFactory, []);
         $this->fail("Should not be able to create a console runner without a console file that is executable");
     } catch (RunnerException $e) {
         $this->assertContains($nonExecutableFilePath, $e->getMessage());
     }
     // test valid file
     $consolePath = "console.php";
     $nonExecutableFile = vfsStream::newFile($consolePath, 0444);
     vfsStreamWrapper::getRoot()->addChild($nonExecutableFile);
     $consolePath = $this->getPath($consolePath);
     $runner = new ConsoleRunner($consolePath, $this->pidFactory, []);
     $this->assertAttributeEquals($consolePath, "consolePath", $runner);
 }
开发者ID:silktide,项目名称:teamster,代码行数:29,代码来源:ConsoleRunnerTest.php

示例4: testFactoryCreateServiceWithName

 public function testFactoryCreateServiceWithName()
 {
     $this->init(array('logger' => array($this->key => array('path' => vfsStream::url('logs/default.log')))));
     $this->assertFalse(vfsStreamWrapper::getRoot()->hasChild('default.log'));
     $this->assertInstanceOf('Zend\\Log\\Logger', $this->factory->createServiceWithName($this->serviceLocator, $this->key, $this->key));
     $this->assertTrue(vfsStreamWrapper::getRoot()->hasChild('default.log'));
 }
开发者ID:mhilker,项目名称:common,代码行数:7,代码来源:LoggerFactoryTest.php

示例5: setUp

 public function setUp(DiInterface $di = NULL, Config $config = NULL)
 {
     vfsStream::setup('root');
     vfsStream::newFile('file.php')->at(vfsStreamWrapper::getRoot());
     $this->file = vfsStream::url('root/file.php');
     parent::setUp($di, $config);
 }
开发者ID:mirobrando,项目名称:ng-phalcon,代码行数:7,代码来源:ServiceTest.php

示例6: writeShouldWriteIfFileIsInDirectory

 /**
  * @test
  *
  * @covers Cocur\Bundle\BuildBundle\Writer\FilesystemWriter::write()
  * @covers Cocur\Bundle\BuildBundle\Writer\FilesystemWriter::getRealName()
  */
 public function writeShouldWriteIfFileIsInDirectory()
 {
     $root = vfsStreamWrapper::getRoot();
     $this->writer->write('/foo', 'Foobar');
     $this->assertTrue($root->hasChild('foo'));
     $this->assertTrue($root->getChild('foo')->hasChild('index.html'));
     $this->assertEquals('Foobar', $root->getChild('foo')->getChild('index.html')->getContent());
 }
开发者ID:braincrafted,项目名称:static-site-bundle,代码行数:14,代码来源:FilesystemWriterTest.php

示例7: passwordShouldBeAddToRsaIfPasswordPassed

 /**
  * @test
  */
 public function passwordShouldBeAddToRsaIfPasswordPassed()
 {
     vfsStream::newFile('id_rsa')->at(vfsStreamWrapper::getRoot());
     $authentication = new Rsa('root', vfsStream::url('root/id_rsa'), 'password');
     /** @var \Crypt_RSA $rsa */
     $rsa = $authentication->getAuthentication();
     $this->assertEquals('password', $rsa->password);
 }
开发者ID:sayiho,项目名称:Jumper,代码行数:11,代码来源:RsaTest.php

示例8: vfsPath

 /**
  * Retrieves the virtual file system path
  *
  * @param string $path The path relative to the root folder
  *
  * @return string
  */
 protected function vfsPath($path = '')
 {
     $root = vfsStreamWrapper::getRoot()->getName();
     if (empty($path)) {
         return vfsStream::url($root);
     }
     return vfsStream::url($root . '/' . $path);
 }
开发者ID:novuso,项目名称:system,代码行数:15,代码来源:VirtualFileSystem.php

示例9: testSetLastUidCorrectly

 public function testSetLastUidCorrectly()
 {
     $this->initRoot();
     $file = vfsStream::url('home/lastui.json');
     $lastUidPersistFile = new LastUidPersistFile($file);
     $lastUidPersistFile->setLastUid(12);
     $this->assertTrue(vfsStreamWrapper::getRoot()->hasChild('lastui.json'), 'The file is not created');
     $this->assertTrue(file_get_contents($file) == json_encode(array('lastUid' => 12)), 'The file content is not correct');
 }
开发者ID:k3roulas,项目名称:email-watcher,代码行数:9,代码来源:LastUidPersistFileTest.php

示例10: testInitWithExistingIdxFile

 public function testInitWithExistingIdxFile()
 {
     vfsStreamWrapper::getRoot()->addChild(new vfsStreamFile('idxfile.php'));
     $idx = $this->getMock('\\Idephix\\IdephixInterface');
     $idx->output = $this->getMock('Symfony\\Component\\Console\\Output\\OutputInterface');
     $idx->output->expects($this->exactly(1))->method('writeln')->with("<error>An idxfile.php already exists, generation skipped.</error>");
     $initIdxFile = new InitIdxFile('vfs://root');
     $initIdxFile->setIdephix($idx);
     $initIdxFile->initFile();
 }
开发者ID:Catapush,项目名称:Idephix,代码行数:10,代码来源:InitIdxFileTest.php

示例11: testExceptionThrownWhenConfigFileNotReadable

 /**
  * @expectedException        Message\Cog\Config\Exception
  * @expectedExceptionMessage Config file `vfs://config/myconfig.yml` is not readable
  */
 public function testExceptionThrownWhenConfigFileNotReadable()
 {
     vfsStream::setup('config');
     vfsStream::newFile('myconfig.yml', 0333)->at(vfsStreamWrapper::getRoot());
     $env = new FauxEnvironment();
     $env->set('staging');
     $loader = new Loader(vfsStream::url('config'), $env);
     $registry = new NonLoadingRegistry($loader);
     $loader->load($registry);
 }
开发者ID:mothership-ec,项目名称:cog,代码行数:14,代码来源:LoaderTest.php

示例12: testPartial

 /**
  * testPartial
  *
  * @since 2.3.0
  */
 public function testPartial()
 {
     /* setup */
     Stream::setup('root');
     $file = new StreamFile('partial.phtml');
     StreamWrapper::getRoot()->addChild($file);
     /* actual */
     $actual = Template::partial(Stream::url('root/partial.phtml'));
     /* compare */
     $this->assertTrue(is_string($actual));
 }
开发者ID:EtienneBruines,项目名称:redaxscript,代码行数:16,代码来源:TemplateTest.php

示例13:

 function it_checks_whether_a_file_is_writable()
 {
     $root = vfsStreamWrapper::getRoot();
     vfsStream::newFile('writable.txt', 0666)->at($root);
     vfsStream::newFile('not_writable.txt', 0444)->at($root);
     $rootPath = vfsStream::url('root') . DIRECTORY_SEPARATOR;
     $file1 = $rootPath . 'writable.txt';
     $this->writable($file1)->shouldBe(true);
     $file2 = $rootPath . 'not_writable.txt';
     $this->writable($file2)->shouldBe(false);
 }
开发者ID:jpkleemans,项目名称:htaccess-firewall,代码行数:11,代码来源:BuiltInFilesystemSpec.php

示例14: setUp

 public function setUp(DiInterface $di = NULL, Config $config = NULL)
 {
     vfsStream::setup('root');
     vfsStream::newFile('modules/module1/config/services.yml')->at(vfsStreamWrapper::getRoot());
     vfsStream::newFile('modules/module2/config/services.yml')->at(vfsStreamWrapper::getRoot());
     vfsStream::newFile('config/config.yml')->at(vfsStreamWrapper::getRoot());
     $this->module1 = vfsStream::url('root/modules/module1');
     $this->module2 = vfsStream::url('root/modules/module2');
     $this->configFile = vfsStream::url('root/config/config.yml');
     parent::setUp($di, $config);
 }
开发者ID:mirobrando,项目名称:ng-phalcon,代码行数:11,代码来源:ParserTest.php

示例15: generateShouldReturnListOfParameters

 /**
  * @test
  *
  * @covers Cocur\Bundle\BuildBundle\Generator\FileGenerator::generate()
  */
 public function generateShouldReturnListOfParameters()
 {
     $file = vfsStream::newFile('parameters.txt')->at(vfsStreamWrapper::getRoot());
     $generator = new FileGenerator(['filename' => vfsStream::url('data/parameters.txt'), 'parameter' => 'var']);
     $file->setContent("param1\nparam2\nparam3\n");
     $parameters = $generator->generate();
     $this->assertCount(3, $parameters);
     $this->assertEquals('param1', $parameters[0]['var']);
     $this->assertEquals('param2', $parameters[1]['var']);
     $this->assertEquals('param3', $parameters[2]['var']);
 }
开发者ID:braincrafted,项目名称:static-site-bundle,代码行数:16,代码来源:FileGeneratorTest.php


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