当前位置: 首页>>代码示例>>PHP>>正文


PHP vfsStream::hasChild方法代码示例

本文整理汇总了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);
    }
开发者ID:bbonnesoeur,项目名称:phpDocumentor2,代码行数:59,代码来源:XmlTest.php

示例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"));
 }
开发者ID:xiaobodu,项目名称:lock,代码行数:11,代码来源:LockTest.php


注:本文中的org\bovigo\vfs\vfsStream::hasChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。