本文整理汇总了PHP中org\bovigo\vfs\vfsStreamDirectory::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP vfsStreamDirectory::getName方法的具体用法?PHP vfsStreamDirectory::getName怎么用?PHP vfsStreamDirectory::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org\bovigo\vfs\vfsStreamDirectory
的用法示例。
在下文中一共展示了vfsStreamDirectory::getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: visitDirectory
/**
* visit a directory and process it
*
* @param vfsStreamDirectory $dir
* @return vfsStreamStructureVisitor
*/
public function visitDirectory(vfsStreamDirectory $dir)
{
$this->current[$dir->getName()] = array();
$tmp =& $this->current;
$this->current =& $tmp[$dir->getName()];
foreach ($dir as $child) {
$this->visit($child);
}
$this->current =& $tmp;
return $this;
}
示例2: testGetProjectRoot
public function testGetProjectRoot()
{
$tempDir = $this->root->getName();
$testDir = tempnam($tempDir, '');
unlink($testDir);
mkdir("{$testDir}/1/2/3/4/5", 0755, true);
$expectedRoot = "{$testDir}/1";
touch("{$expectedRoot}/.platform-project");
chdir($testDir);
$this->assertFalse(LocalProject::getProjectRoot());
chdir($expectedRoot);
$this->assertEquals($expectedRoot, LocalProject::getProjectRoot());
chdir("{$testDir}/1/2/3/4/5");
$this->assertEquals($expectedRoot, LocalProject::getProjectRoot());
}
示例3: visitDirectory
/**
* visit a directory and process it
*
* @param vfsStreamDirectory $dir
* @return vfsStreamPrintVisitor
*/
public function visitDirectory(vfsStreamDirectory $dir)
{
$this->printContent($dir->getName());
$this->depth++;
foreach ($dir as $child) {
$this->visit($child);
}
$this->depth--;
return $this;
}
示例4: createDummyProject
/**
* @param string $sourceDir
*
* @return string
*/
protected function createDummyProject($sourceDir)
{
if (!is_dir($sourceDir)) {
throw new \InvalidArgumentException("Not a directory: {$sourceDir}");
}
$tempDir = self::$root->getName();
$projectRoot = tempnam($tempDir, '');
unlink($projectRoot);
mkdir($projectRoot);
// Set up the project files.
$local = new LocalProject();
$local->createProjectFiles($projectRoot, 'testProjectId');
// Make a dummy repository.
$repositoryDir = $projectRoot . '/' . LocalProject::REPOSITORY_DIR;
mkdir($repositoryDir);
$fsHelper = new FilesystemHelper();
$fsHelper->copyAll($sourceDir, $repositoryDir);
return $projectRoot;
}
示例5: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->dir = vfsStream::setup();
vfsStream::copyFromFileSystem(__DIR__ . '/../fixtures/images', $this->dir);
$dir = $this->dir;
$image = $this->getMock('\\Imagine\\Image\\ImageInterface');
$image->expects($this->any())->method('save')->will($this->returnCallback(function ($destFile) use($dir) {
$temp = vfsStream::newFile(basename($destFile));
$dir->addChild($temp);
return TRUE;
}));
$imagine = $this->getMock('\\Imagine\\Image\\ImagineInterface');
$imagine->expects($this->any())->method('open')->will($this->returnValue($image));
$this->media = $this->getMock('\\Oryzone\\MediaStorage\\Model\\MediaInterface');
$this->media->expects($this->any())->method('getContext')->will($this->returnValue('default'));
$this->media->expects($this->any())->method('getName')->will($this->returnValue('sample'));
$this->variant = $this->getMock('\\Oryzone\\MediaStorage\\Variant\\VariantInterface');
$this->variant->expects($this->any())->method('getName')->will($this->returnValue('default'));
$this->variant->expects($this->any())->method('getOptions')->will($this->returnValue(array('width' => 50, 'height' => 30, 'resize' => 'stretch')));
$this->variant->expects($this->any())->method('getMetaValue')->will($this->returnValueMap(array(array('width', NULL, 50), array('height', NULL, 30))));
$this->provider = new ImageProvider(vfsStream::url($this->dir->getName()) . '/', $imagine);
}
示例6: tempDir
/**
* Create a test directory with a unique name.
*
* @param bool $fill Fill the directory with some files.
*
* @return string
*/
protected function tempDir($fill = false)
{
$tempDir = $this->root->getName();
$testDir = tempnam($tempDir, '');
unlink($testDir);
mkdir($testDir);
if ($fill) {
touch($testDir . '/test-file');
mkdir($testDir . '/test-dir');
touch($testDir . '/test-dir/test-file');
mkdir($testDir . '/test-nesting/1/2/3', 0755, true);
touch($testDir . '/test-nesting/1/2/3/test-file');
}
return $testDir;
}