本文整理汇总了PHP中org\bovigo\vfs\vfsStream::newDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP vfsStream::newDirectory方法的具体用法?PHP vfsStream::newDirectory怎么用?PHP vfsStream::newDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org\bovigo\vfs\vfsStream
的用法示例。
在下文中一共展示了vfsStream::newDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: visitDirectoryWritesDirectoryNameToStream
/**
* @test
*/
public function visitDirectoryWritesDirectoryNameToStream()
{
$output = vfsStream::newFile('foo.txt')->at(vfsStream::setup());
$printVisitor = new vfsStreamPrintVisitor(fopen('vfs://root/foo.txt', 'wb'));
$this->assertSame($printVisitor, $printVisitor->visitDirectory(vfsStream::newDirectory('baz')));
$this->assertEquals("- baz\n", $output->getContent());
}
示例2: testGenerateUnixRandomThrowsExceptionWhenRandomEmpty
/**
* @expectedException \RuntimeException
* @expectedExceptionMessage returned an empty value
*/
public function testGenerateUnixRandomThrowsExceptionWhenRandomEmpty()
{
vfsStream::setup('root');
vfsStream::newDirectory('dev')->at(vfsStreamWrapper::getRoot());
vfsStream::newFile('urandom')->at(vfsStreamWrapper::getRoot()->getChild('dev'));
$this->_stringGenerator->generateFromUnixRandom(10, vfsStream::url('root') . '/dev/urandom');
}
示例3: testDirectoryNonReadable
public function testDirectoryNonReadable()
{
$url = vfsStream::newDirectory('test', 00)->at($this->_root)->url();
$validator = new FileReadable();
$this->assertFalse($validator->isValid($url));
$this->assertEquals(array(FileReadable::FILE => "'{$url}' ist keine Datei oder nicht zugänglich"), $validator->getMessages());
}
示例4: 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'));
}
示例5: setFileSystem
protected function setFileSystem()
{
vfsStreamWrapper::register();
$root = vfsStream::newDirectory('build');
vfsStreamWrapper::setRoot($root);
return $root;
}
示例6: testVirtualizeCanAcceptVfsContentInstances
public function testVirtualizeCanAcceptVfsContentInstances()
{
$this->virtualSystem->virtualize(['test', vfsStream::newFile('test2'), vfsStream::newDirectory('testDir')]);
$this->assertEquals(3, $this->virtualSystem->getFileCount());
$this->assertInstanceOf(vfsStreamDirectory::class, $this->virtualSystem->getFileAtIndex(2));
$this->assertInstanceOf(vfsStreamFile::class, $this->virtualSystem->getFileAtIndex(1));
}
示例7: testInputFilterSaveValidDir
public function testInputFilterSaveValidDir()
{
$preferences = array('saveRawData' => '1', 'saveDir' => vfsStream::newDirectory('test', 0777)->at(vfsStream::setup('root'))->url(), 'saveFormat' => 'XML', 'saveOverwrite' => '0');
$this->_form->setValidationGroup('Preferences');
$this->_form->setData(array('Preferences' => $preferences));
$this->assertTrue($this->_form->isValid());
}
示例8: testDirectoryReadOnly
public function testDirectoryReadOnly()
{
$url = vfsStream::newDirectory('test', 00)->at($this->_root)->url();
$validator = new DirectoryWritable();
$this->assertFalse($validator->isValid($url));
$this->assertEquals(array(DirectoryWritable::WRITABLE => "Verzeichnis '{$url}' ist nicht schreibbar"), $validator->getMessages());
}
示例9: testDirectoryNonReadable
public function testDirectoryNonReadable()
{
$url = vfsStream::newDirectory('test', 00)->at($this->_root)->url();
$validator = new FileReadable();
$this->assertFalse($validator->isValid($url));
$this->assertEquals(FileReadable::FILE, key($validator->getMessages()));
}
示例10: testDecodeInventoryActionInputNotFile
public function testDecodeInventoryActionInputNotFile()
{
$inputFile = vfsStream::newDirectory('test')->at(vfsStream::setup('root'))->url();
$this->dispatch($inputFile);
$this->assertEquals(10, $this->getResponseStatusCode());
$this->assertConsoleOutputContains("Input file does not exist or is not readable.\n");
}
示例11: profileClosure
/**
* Profile the code contained inside the closure, returning
* an array of XHProf profiling information. Optionally
* filtered by a set of regular expressions which the called
* function/class must match for the result to be returned.
*
* Special note: the $flags default value is hardcoded to
* avoid errors when xhprof is not loaded - instead, this
* causes a graceful "test skipped".
*
* @param \Closure $closure A standard Closure that will execute exactly the code that will be profiled, nothing more.
* @param array $methodMatchExpressions An array of PERL regular expressions to filter which methods' results are returned.
* @param integer $flags Standard XHPROF flags for what gets profiled. Default excludes built-in functions and CPU/memory.
* @param array $options Optional further options (second argument for xhprof_enable).
* @return array
*/
protected function profileClosure(\Closure $closure, array $methodMatchExpressions = array(), $flags = 1, $options = array())
{
if (!$this->isProfilingExtensionLoaded()) {
$this->markTestSkipped('XHProf is not installed; test must be skipped');
}
$folder = vfsStream::newDirectory('profiles');
$backup = ini_set('xhprof.output_dir', vfsStream::url('profiles'));
xhprof_enable($flags, $options);
$closure();
$profile = xhprof_disable();
ini_set('xhprof.output_dir', $backup);
if (!empty($methodMatchExpressions)) {
foreach ($profile as $methodIdentifier => $_) {
$keep = FALSE;
foreach ($methodMatchExpressions as $expression) {
if (preg_match($expression, $methodIdentifier)) {
$keep = TRUE;
}
}
if (!$keep) {
unset($profile[$methodIdentifier]);
}
}
}
return $profile;
}
示例12: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new NlReader();
vfsStreamWrapper::register();
$root = vfsStream::newDirectory('tmp');
vfsStreamWrapper::setRoot($root);
$this->file = vfsStream::newFile('items.csv', 0764)->withContent("73-ou-XW46\nApple\n1\na")->at($root);
}
示例13: setUp
public function setUp()
{
$this->root = VFS::setup('root');
VFS::newDirectory('storage', 0777)->at($this->root);
VFS::newDirectory('private', 0400)->at($this->root);
$this->fileSystem = new LocalFileSystem();
$this->rootObject = Mockery::mock('FileSystem\\Root')->shouldIgnoreMissing();
}
示例14: _before
protected function _before()
{
$wp = vfsStream::newDirectory('wp');
$wpLoadFile = vfsStream::newFile('wp-load.php');
$wpLoadFile->setContent('foo');
$wp->addChild($wpLoadFile);
$this->wpLoadPath = $wp->url() . '/wp-load.php';
$this->system = $this->prophesize(System::class);
}
示例15: setFileSystem
protected function setFileSystem()
{
vfsStreamWrapper::register();
$root = vfsStream::newDirectory('build');
vfsStreamWrapper::setRoot($root);
$packagesBuilder = new PackagesBuilder(new NullOutput(), vfsStream::url('build'), array('repositories' => array(array('type' => 'composer', 'url' => 'http://localhost:54715')), 'require' => array('vendor/name' => '*')), false);
$packagesBuilder->dump(array($this->package));
return $root;
}