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


PHP vfsStreamDirectory::addChild方法代碼示例

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


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

示例1: setUp

 protected function setUp()
 {
     $file = vfsStream::newFile('template');
     $this->fileSystem = vfsStream::setup();
     $this->fileSystem->addChild($file);
     $this->filePath = $file->url();
 }
開發者ID:bazzline,項目名稱:php_component_template,代碼行數:7,代碼來源:FileBasedTemplateTest.php

示例2: setUp

 protected function setUp()
 {
     $this->basePath = vfsStream::setup();
     $this->basePath->addChild(vfsStream::newDirectory('project'));
     $this->basePath->addChild(vfsStream::newDirectory('hooks'));
     $this->basePath->addChild(vfsStream::newDirectory('.git/hooks'));
 }
開發者ID:bitban,項目名稱:php-code-quality-tools,代碼行數:7,代碼來源:HookManagerTest.php

示例3: testLoadFileNotReadable

 /**
  * @expectedException \EBT\ConfigLoader\Exception\InvalidArgumentException
  * @expectedExceptionMessage not readable
  */
 public function testLoadFileNotReadable()
 {
     $this->root->addChild(vfsStream::newFile('file1'));
     // make sure is not readable
     $this->root->getChild('file1')->chown('testuser')->chgrp('testuser')->chmod(0750);
     (new JsonFileLoader())->load(vfsStream::url('test/file1'));
 }
開發者ID:ebidtech,項目名稱:config-loader,代碼行數:11,代碼來源:JsonFileLoaderTest.php

示例4: testFustyRequest_ValidateUpload

 /**
  */
 public function testFustyRequest_ValidateUpload()
 {
     //// Setup test
     $firstChunk = vfsStream::newFile('temp_file');
     $firstChunk->setContent('1234567890');
     $this->vfs->addChild($firstChunk);
     $fileInfo = new \ArrayObject(array('size' => 10, 'error' => UPLOAD_ERR_OK, 'tmp_name' => $firstChunk->url()));
     $request = new \ArrayObject(array('flowIdentifier' => '13632-prettifyjs', 'flowFilename' => 'prettify.js', 'flowRelativePath' => 'home/prettify.js'));
     $fustyRequest = new FustyRequest($request, $fileInfo);
     $config = new Config();
     $config->setTempDir($this->vfs->url());
     /** @var File $file */
     $file = $this->getMock('Flow\\File', array('_move_uploaded_file'), array($config, $fustyRequest));
     /** @noinspection PhpUndefinedMethodInspection */
     $file->expects($this->once())->method('_move_uploaded_file')->will($this->returnCallback(function ($filename, $destination) {
         return rename($filename, $destination);
     }));
     //// Actual test
     $this->assertTrue($file->validateChunk());
     $this->assertFalse($file->validateFile());
     $this->assertTrue($file->saveChunk());
     $this->assertTrue($file->validateFile());
     $path = $this->vfs->url() . DIRECTORY_SEPARATOR . 'new';
     $this->assertTrue($file->save($path));
     $this->assertEquals(10, filesize($path));
 }
開發者ID:watonyweng,項目名稱:flowjs-tour,代碼行數:28,代碼來源:FustyRequestTest.php

示例5: setUp

 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->root = vfsStream::setup();
     $this->root->addChild(new vfsStreamFile('1.png'));
     $this->root->addChild(new vfsStreamFile('2.jpg'));
     $this->root->addChild(new vfsStreamFile('3.jpeg'));
 }
開發者ID:cotapreco,項目名稱:captcha,代碼行數:10,代碼來源:FilesystemImageCaptchaTest.php

示例6: getQueryShouldReturnQuery

 /**
  * @test
  *
  * @covers Cocur\NQM\QueryLoader\FilesystemQueryLoader::getQuery()
  * @covers Cocur\NQM\QueryLoader\FilesystemQueryLoader::getQueryFilename()
  */
 public function getQueryShouldReturnQuery()
 {
     $file = new vfsStreamFile('foobar.sql');
     $file->setContent('SELECT * FROM table;');
     $this->rootDir->addChild($file);
     $this->assertEquals('SELECT * FROM table;', $this->loader->getQuery('foobar'));
 }
開發者ID:cocur,項目名稱:nqm,代碼行數:13,代碼來源:FilesystemTest.php

示例7: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->provider = new FileProvider();
     $this->dir = vfsStream::setup('root');
     $file = vfsStream::newFile('test');
     $file->write('some content');
     $this->dir->addChild($file);
 }
開發者ID:jmcclell,項目名稱:OryzoneMediaStorage,代碼行數:12,代碼來源:FileProviderTest.php

示例8: testIsFile

 public function testIsFile()
 {
     $this->root->addChild(new vfsStreamDirectory('assets'));
     $dir = $this->root->getChild('assets');
     $file = vfsStream::newFile('foo.txt')->withContent('foo')->at($this->root);
     $this->assertFalse($this->trait->isFile($dir->url()));
     $this->assertTrue($this->trait->isFile($file->url()));
 }
開發者ID:viserio,項目名稱:filesystem,代碼行數:8,代碼來源:FilesystemHelperTraitTest.php

示例9: testForReadingWithOptionalKeyParameterConfigFile

 public function testForReadingWithOptionalKeyParameterConfigFile()
 {
     $configFile = vfsStream::newFile('config.inc.php');
     $configFile->setContent('<?php return ["primary-key"=>["test-key"=>"test-value"]];');
     $this->root->addChild($configFile);
     $configFileReading = new ConfigFileReader($this->root->getChild('config.inc.php')->url());
     $this->assertEquals(['test-key' => 'test-value'], $configFileReading->getConfiguration('primary-key'));
 }
開發者ID:spalax,項目名稱:zoho-books-al,代碼行數:8,代碼來源:ConfigFileReaderTest.php

示例10: testUpdateAddressFormatsRemovesLegacyFiles

 /**
  * @covers ::updateAddressFormats
  */
 public function testUpdateAddressFormatsRemovesLegacyFiles()
 {
     $this->root->addChild(new vfsStreamFile('legacy.json'));
     $httpClient = new HttpClient();
     $httpClient->setAdapter(new HttpTestAdapter());
     $maintenanceService = new MaintenanceService($this->options, $httpClient);
     $maintenanceService->updateAddressFormats();
     $this->assertFalse($this->root->hasChild('legacy.json'));
 }
開發者ID:DavidHavl,項目名稱:Ajasta,代碼行數:12,代碼來源:MaintenanceServiceTest.php

示例11: testShouldBeAbleToCopyFile

 public function testShouldBeAbleToCopyFile()
 {
     $this->root->addChild(vfsStream::newFile('testfile1copy')->setContent('TestContent'));
     $copy = new DefaultCopy($this->root->url() . '/testfile1', $this->root->url() . '/testfile1copy');
     $copy->execute();
     /** @var vfsStreamFile $copiedFile */
     $copiedFile = $this->root->getChild('testfile1copy');
     $this->assertEquals('testfile1copy', $copiedFile->getName());
     $this->assertEquals('TestContent', $copiedFile->getContent());
 }
開發者ID:fashionforhome,項目名稱:s3fileshifter,代碼行數:10,代碼來源:DefaultCopyTest.php

示例12: testValidateContent

 public function testValidateContent()
 {
     $textFile = vfsStream::newFile('foo.txt');
     $textFile->setContent('foo');
     $this->dir->addChild($textFile);
     $this->assertFalse($this->provider->validateContent(NULL));
     $this->assertFalse($this->provider->validateContent(1234));
     $this->assertFalse($this->provider->validateContent(vfsStream::url('root/foo.txt')));
     $imagePath = vfsStream::url('root/sample.jpg');
     $this->assertTrue($this->provider->validateContent($imagePath));
     $this->assertTrue($this->provider->validateContent(new \SplFileInfo($imagePath)));
 }
開發者ID:jmcclell,項目名稱:OryzoneMediaStorage,代碼行數:12,代碼來源:ImageProviderTest.php

示例13: testModuleInit

 public function testModuleInit()
 {
     $this->vfsRoot->addChild($this->createFile('file1'));
     $this->vfsRoot->addChild($this->createFile('file1'));
     $this->vfsRoot->addChild(vfsStream::newDirectory('dir1'));
     AspectMock::double(\Codeception\Configuration::class, ['outputDir' => vfsStream::url('outputDir')]);
     // Cleansman needs no configuration atm
     $event = m::mock(\Codeception\Event\SuiteEvent::class);
     $sut = new \Codeception\Extension\Cleansman([], ['silent' => false]);
     // Actual cleanup happens here
     $sut->moduleInit($event);
     $this->assertFalse($this->vfsRoot->hasChild('file1'));
     $this->assertFalse($this->vfsRoot->hasChild('file2'));
     $this->assertFalse($this->vfsRoot->hasChild('dir1'));
 }
開發者ID:carstenwindler,項目名稱:cleansman,代碼行數:15,代碼來源:ModuleInitTest.php

示例14: createVendorDirectory

 protected function createVendorDirectory(vfsStreamDirectory $rootDirectory)
 {
     $directory = new vfsStreamDirectory('vendor');
     $rootDirectory->addChild($directory);
     $directory->addChild(new vfsStreamFile('autoload.php'));
     $subDirectory = new vfsStreamDirectory('composer');
     $directory->addChild($subDirectory);
     $subDirectory->addChild(new vfsStreamFile('autoload_classmap.php'));
     $subDirectory->addChild(new vfsStreamFile('autoload_namespaces.php'));
     $subDirectory->addChild(new vfsStreamFile('autoload_psr4.php'));
     $subDirectory->addChild(new vfsStreamFile('autoload_real.php'));
     $subDirectory->addChild(new vfsStreamFile('ClassLoader.php'));
     $subDirectory->addChild(new vfsStreamFile('installed_paths.php'));
     $subDirectory->addChild(new vfsStreamFile('installed.json'));
     $subDirectory = new vfsStreamDirectory('psr');
     $directory->addChild($subDirectory);
     $secondLevelSubDirectory = new vfsStreamDirectory('log');
     $subDirectory->addChild($secondLevelSubDirectory);
     $secondLevelSubDirectory->addChild(new vfsStreamFile('.gitignore'));
     $secondLevelSubDirectory->addChild(new vfsStreamFile('composer.json'));
     $secondLevelSubDirectory->addChild(new vfsStreamFile('LICENSE'));
     $secondLevelSubDirectory->addChild(new vfsStreamFile('README.md'));
     $thirdLevelSubDirectory = new vfsStreamDirectory('Psr');
     $secondLevelSubDirectory->addChild($thirdLevelSubDirectory);
     $fourthLevelSubDirectory = new vfsStreamDirectory('Log');
     $thirdLevelSubDirectory->addChild($fourthLevelSubDirectory);
     $fourthLevelSubDirectory->addChild(new vfsStreamFile('InvalidArgumentException.php'));
     $fourthLevelSubDirectory->addChild(new vfsStreamFile('LoggerInterface.php'));
     $fourthLevelSubDirectory->addChild(new vfsStreamFile('LogLevel.php'));
     $fourthLevelSubDirectory->addChild(new vfsStreamFile('NullLogger.php'));
 }
開發者ID:jmfontaine,項目名稱:projectlint,代碼行數:31,代碼來源:ProjectLintTestCase.php

示例15: createSettingsFile

 /**
  * @param string $content
  *
  * @return string Created file URL
  */
 private function createSettingsFile($content)
 {
     $settingsFile = VfsStream::newFile('Settings.php');
     $settingsFile->setContent($content);
     $this->vfsStream->addChild($settingsFile);
     return $settingsFile->url();
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:12,代碼來源:ThemeSettingsSchemaProviderSpec.php


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