本文整理汇总了PHP中org\bovigo\vfs\vfsStreamDirectory::hasChild方法的典型用法代码示例。如果您正苦于以下问题:PHP vfsStreamDirectory::hasChild方法的具体用法?PHP vfsStreamDirectory::hasChild怎么用?PHP vfsStreamDirectory::hasChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org\bovigo\vfs\vfsStreamDirectory
的用法示例。
在下文中一共展示了vfsStreamDirectory::hasChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWriteIsWritingYamlIntoFile
/**
* @depends testInstanceOf
*/
public function testWriteIsWritingYamlIntoFile()
{
$yamlWriterProvider = new YamlWriterProvider($this->mockWriter);
$this->mockWriter->expects($this->once())->method('dump')->with(array('result' => false))->willReturn('result: false');
$yamlWriterProvider->write(vfsStream::url('settings/config.yml'), array('result' => false));
$this->assertTrue($this->root->hasChild('settings/config.yml'));
}
示例2: 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);
}
示例3: 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;
}
示例4: 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()));
}
示例5: testCanCreateInstanceWithLogDirCreation
/**
* @covers \EscoMail\Service\MailLogger::__construct
* @covers \EscoMail\Service\MailLogger::getLogDirPath
*/
public function testCanCreateInstanceWithLogDirCreation()
{
$configArray = array('log_dir' => vfsStream::url('exampleDir') . '/tmp');
$serviceManager = new ServiceManager();
$options = new ModuleOptions($configArray);
$mailLogger = new MailLogger($options, $serviceManager);
$this->assertInstanceOf('EscoMail\\Service\\MailLogger', $mailLogger);
$this->assertTrue($this->root->hasChild('tmp/mail.log'));
}
示例6: 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'));
}
示例7: testProcessCreatesDirectories
/**
* @covers \Heystack\Core\DataObjectGenerate\DataObjectGenerator::process
*/
public function testProcessCreatesDirectories()
{
$this->schemaService->expects($this->once())->method('getSchemas')->will($this->returnValue([]));
ob_start();
$this->generator->process();
ob_end_clean();
$this->assertTrue(file_exists(vfsStream::url('root')));
$this->assertTrue($this->root->hasChild('cache'));
}
示例8: testCreateServiceWithDirectoryCreation
public function testCreateServiceWithDirectoryCreation()
{
$configArray = array('transport_class' => 'Zend\\Mail\\Transport\\File', 'transport_options' => array('path' => vfsStream::url('exampleDir') . '/tmp'));
$config = new ModuleOptions($configArray);
$this->serviceManager->setService('EscoMail\\Options', $config);
$factory = new TransportFactory();
$transport = $factory->createService($this->serviceManager);
$this->assertInstanceOf('Zend\\Mail\\Transport\\File', $transport);
$this->assertTrue($this->root->hasChild('tmp'));
}
示例9: 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'));
$this->adapter->upload('bar/foo.txt', $input);
$this->assertFalse($this->vfs->hasChild('foo.txt'));
$this->assertTrue($this->vfs->getChild('uploads')->hasChild('bar'));
$this->assertTrue($this->vfs->getChild('uploads')->getChild('bar')->hasChild('foo.txt'));
}
示例10: testContainerCreated
/**
* @covers \Heystack\Core\Console\Command\GenerateContainer::__construct
* @covers \Heystack\Core\Console\Command\GenerateContainer::execute
* @covers \Heystack\Core\Console\Command\GenerateContainer::configure
* @covers \Heystack\Core\Console\Command\GenerateContainer::createContainer
* @covers \Heystack\Core\Console\Command\GenerateContainer::loadConfig
* @covers \Heystack\Core\Console\Command\GenerateContainer::dumpContainer
*/
public function testContainerCreated()
{
$command = $this->getMock(__NAMESPACE__ . '\\GenerateContainer', ['getRealPath'], [vfsStream::url('root'), vfsStream::url('root/heystack')]);
$command->expects($this->once())->method('getRealPath')->will($this->returnArgument(0));
$application = new Application();
$application->add($command);
$application->find('generate-container');
$commandTester = new CommandTester($command);
$commandTester->execute(['command' => $command->getName()]);
$this->assertTrue($this->rootFileSystem->hasChild('heystack/cache/HeystackServiceContainerlive.php'));
$this->assertContains('class HeystackServiceContainerlive extends Heystack\\Core\\DependencyInjection\\SilverStripe\\HeystackSilverStripeContainer', file_get_contents(vfsStream::url('root/heystack/cache/HeystackServiceContainerlive.php')));
}
示例11: testExecute
public function testExecute()
{
$application = new Application();
$application->add(new Init(null, vfsStream::url('root')));
$command = $application->find('init');
$commandTester = new CommandTester($command);
$commandTester->execute(['command' => $command->getName()]);
$this->assertTrue($this->fs->hasChild('views'));
$this->assertTrue($this->fs->hasChild('cache'));
$this->assertTrue($this->fs->hasChild('compiled'));
$this->assertTrue($this->fs->hasChild('public'));
$this->assertFileExists(vfsStream::url('root/public/index.php'));
$this->assertRegExp('/Initialization complete!/', $commandTester->getDisplay());
}
示例12: 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'));
}
示例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: testProcess
public function testProcess()
{
$file = new \SplFileInfo(vfsStream::url('root/sample.jpg'));
$resultFile = $this->provider->process($this->media, $this->variant, $file);
$filename = $resultFile->getBasename();
$this->assertStringEndsWith('-temp-sample.jpg', $filename);
$this->assertTrue($this->dir->hasChild($filename));
}
示例15: testConstruct
/**
* @covers Intacct\Functions\Company\AttachmentFile::writeXml
*/
public function testConstruct()
{
$expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<attachment>
<attachmentname>input</attachmentname>
<attachmenttype>csv</attachmenttype>
<attachmentdata>aGVsbG8sd29ybGQKdW5pdCx0ZXN0</attachmentdata>
</attachment>
EOF;
$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->setIndentString(' ');
$xml->startDocument();
$record = new AttachmentFile();
$this->assertTrue($this->root->hasChild('csv/input.csv'));
$record->setFilePath($this->root->url() . '/csv/input.csv');
$record->writeXml($xml);
$this->assertXmlStringEqualsXmlString($expected, $xml->flush());
}