本文整理汇总了PHP中org\bovigo\vfs\vfsStream::hasChild方法的典型用法代码示例。如果您正苦于以下问题:PHP vfsStream::hasChild方法的具体用法?PHP vfsStream::hasChild怎么用?PHP vfsStream::hasChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org\bovigo\vfs\vfsStream
的用法示例。
在下文中一共展示了vfsStream::hasChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTransformWithEmptyFileDescriptor
/**
* @covers phpDocumentor\Plugin\Core\Transformer\Writer\Xml::transform
*/
public function testTransformWithEmptyFileDescriptor()
{
$transformer = m::mock('phpDocumentor\\Transformer\\Transformer');
$transformer->shouldReceive('getTarget')->andReturn(vfsStream::url('XmlTest'));
$transformation = m::mock('phpDocumentor\\Transformer\\Transformation');
$transformation->shouldReceive('getArtifact')->andReturn('artifact.xml');
$transformation->shouldReceive('getTransformer')->andReturn($transformer);
$fileDescriptor = m::mock('phpDocumentor\\Descriptor\\FileDescriptor');
$fileDescriptor->shouldReceive('getPath')->andReturn('foo.php');
$fileDescriptor->shouldReceive('getInheritedElement')->andReturn(null);
$transformer->shouldReceive('generateFilename')->with('foo.php')->andReturn('generated-foo.php');
$fileDescriptor->shouldReceive('getHash')->andReturn('hash');
$fileDescriptor->shouldReceive('getAllErrors')->andReturn(array());
$this->projectDescriptor->shouldReceive('getFiles')->andReturn(array($fileDescriptor));
$this->projectDescriptor->shouldReceive('getName')->andReturn('project');
$this->projectDescriptor->shouldReceive('getPartials')->andReturn(array());
$this->implementProtectedFinalize($this->projectDescriptor);
$this->implementProtectedBuildDocBlock($fileDescriptor);
$fileDescriptor->shouldReceive('getNamespaceAliases')->andReturn(array('foo', 'bar'));
$fileDescriptor->shouldReceive('getConstants')->andReturn(array());
$fileDescriptor->shouldReceive('getFunctions')->andReturn(array());
$fileDescriptor->shouldReceive('getInterfaces')->andReturn(array());
$fileDescriptor->shouldReceive('getClasses')->andReturn(array());
$fileDescriptor->shouldReceive('getTraits')->andReturn(array());
$fileDescriptor->shouldReceive('getMarkers')->andReturn(array());
$fileDescriptor->shouldReceive('getErrors')->andReturn(array());
$fileDescriptor->shouldReceive('getPartials')->andReturn(array());
$fileDescriptor->shouldReceive('getSource')->andReturn(null);
// Call the actual method
$this->xml->transform($this->projectDescriptor, $transformation);
// Check file exists
$this->assertTrue($this->fs->hasChild('artifact.xml'));
// Inspect XML
$xml = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<project version="2.0.0b8" title="project">
<partials/>
<file path="foo.php" generated-path="generated-foo.php" hash="hash" package="myPackage">
<docblock line="666">
<description>my summary</description>
<long-description>my description</long-description>
</docblock>
<namespace-alias name="0">foo</namespace-alias>
<namespace-alias name="1">bar</namespace-alias>
</file>
<package name="global" full_name="global"/>
<package name="myPackage" full_name="myPackage"/>
<deprecated count="0"/>
</project>
XML;
$expectedXml = new \DOMDocument();
$expectedXml->loadXML($xml);
$actualXml = new \DOMDocument();
$actualXml->load(vfsStream::url('XmlTest/artifact.xml'));
$this->assertEqualXMLStructure($expectedXml->firstChild, $actualXml->firstChild, true);
}
示例2: testConstructorCreatesLockFile
/**
* Test that the lock file is created
*
* @test
*/
public function testConstructorCreatesLockFile()
{
$this->assertFalse($this->vfs->hasChild("test.lock"));
$lock = new Lock("test", vfsStream::url("tests"));
$this->assertTrue($this->vfs->hasChild("test.lock"));
}