本文整理汇总了PHP中org\bovigo\vfs\vfsStreamDirectory::getChild方法的典型用法代码示例。如果您正苦于以下问题:PHP vfsStreamDirectory::getChild方法的具体用法?PHP vfsStreamDirectory::getChild怎么用?PHP vfsStreamDirectory::getChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org\bovigo\vfs\vfsStreamDirectory
的用法示例。
在下文中一共展示了vfsStreamDirectory::getChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testShouldThrowExceptionWhenDeletionNotPermitted
/**
* @expectedException RuntimeException
*/
public function testShouldThrowExceptionWhenDeletionNotPermitted()
{
$this->root->chmod(0555);
$this->root->getChild('testfile2')->chmod(0555);
$localDelete = new DefaultDelete($this->root->url() . '/testfile2');
$localDelete->execute();
}
示例2: getImageFolder
function getImageFolder()
{
$this->vfsRoot = vfsStream::setup('root');
mkdir(vfsStream::url('root') . '/images');
vfsStream::copyFromFileSystem(__DIR__ . '/Fixtures/source', $this->vfsRoot->getChild('images'));
return vfsStream::url('root');
}
示例3:
function it_should_do_multiple_to_registry()
{
$this->pushImage(vfsStream::url('system/docker/build/buildscript.sh'), 'registry/library/ubuntu:14.04');
$this->pushImage(vfsStream::url('system/docker/build/buildscript.sh'), 'registry/library/ubuntu:15.04');
$buildScript = $this->root->getChild('docker/build/buildscript.sh');
\PHPUnit_Framework_Assert::assertEquals("#!/usr/bin/env bash\ndocker push registry/library/ubuntu:14.04 \\\n&& docker push registry/library/ubuntu:15.04", $buildScript->getContent());
}
示例4: 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'));
}
示例5: 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'));
}
示例6: testSavingConfig
public function testSavingConfig()
{
$this->object->setGeneratorDirectory('generator/test/dir');
$this->assertTrue($this->filesystem->hasChild('.phpteda'));
$actualConfiguration = unserialize($this->filesystem->getChild('.phpteda')->getContent());
$expectedConfiguration = array('GeneratorDirectory' => 'generator/test/dir');
$this->assertEquals($expectedConfiguration, $actualConfiguration);
}
示例7: pathToUrl
protected function pathToUrl($path = '')
{
//@todo Consider adding hasChild() test and throw exception if test fails?
if ($this->root->hasChild(ltrim($path, '/'))) {
return $this->root->getChild(ltrim($path, '/'))->url();
}
return $this->root->url() . $path;
}
示例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()));
}
示例9: testItSavesTypeClassFiles
public function testItSavesTypeClassFiles()
{
$this->sut->save(FooBarType::class, 'foobar_type_class_content');
$filename = base64_encode(FooBarType::class) . '.php';
$this->assertTrue($this->root->hasChild($filename));
$child = $this->root->getChild($filename);
$this->assertEquals('<?php foobar_type_class_content', file_get_contents($child->url()));
}
示例10: testEnumTypeDefinitionsFromBundles
public function testEnumTypeDefinitionsFromBundles()
{
$this->container->setParameter('kernel.bundles', ['FooBundle', 'BarBundle']);
require_once $this->root->getChild('src/FooBundle/FooBundle.php')->url();
require_once $this->root->getChild('src/BarBundle/BarBundle.php')->url();
$this->container->compile();
$this->assertAddTypeCalls(['foobar' => FooBarType::class, 'onetwo' => OneTwoType::class, 'threefour' => OneTwoType::class]);
}
示例11: testFileIsOnDestinationAfterShift
public function testFileIsOnDestinationAfterShift()
{
$shift = new DefaultShift($this->root->url() . '/testfile1', $this->root->url() . '/testfile1Shifted');
$shift->execute();
/** @var vfsStreamFile $shiftedFile */
$shiftedFile = $this->root->getChild('testfile1Shifted');
$this->assertNotNull($shiftedFile);
$this->assertEquals('testfile1Shifted', $shiftedFile->getName());
$this->assertEquals('TestContent', $shiftedFile->getContent());
}
示例12: 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());
}
示例13: testUpload
public function testUpload()
{
$this->assertTrue($this->vfs->getChild('tmp')->hasChild('foo.txt'));
$this->assertFalse($this->vfs->getChild('uploads')->hasChild('bar'));
$input = new File('foo.txt', vfsStream::url('root/tmp/foo.txt'));
$id = $this->uploads->upload($input);
$this->assertFalse($this->vfs->hasChild('foo.txt'));
$parts = explode('/', $id);
$leaf = array_pop($parts);
$child = $this->vfs->getChild('uploads');
foreach ($parts as $part) {
$this->assertTrue($child->hasChild($part));
$child = $child->getChild($part);
}
$this->assertTrue($child->hasChild($leaf));
}
示例14: testNotifyBatch
public function testNotifyBatch()
{
$packagesBuilder = new PackagesBuilder(new NullOutput(), vfsStream::url('build'), ['notify-batch' => 'http://localhost:54715/notify', 'repositories' => [['type' => 'composer', 'url' => 'http://localhost:54715']], 'require' => ['vendor/name' => '*']], false);
$packagesBuilder->dump(self::createPackages(1));
$packagesJson = JsonFile::parseJson($this->root->getChild('build/packages.json')->getContent());
$this->assertEquals('http://localhost:54715/notify', $packagesJson['notify-batch']);
}
示例15: given_dump_file_appended
protected function given_dump_file_appended($new_mail)
{
$dump = $this->tmp_dir->getChild(self::DUMP_FILE);
/** @var vfsStreamFile $dump */
$content = $dump->getContent();
$content .= $new_mail;
$dump->setContent($content);
}