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


PHP fDOMDocument::getDOMXPath方法代码示例

本文整理汇总了PHP中TheSeer\fDOM\fDOMDocument::getDOMXPath方法的典型用法代码示例。如果您正苦于以下问题:PHP fDOMDocument::getDOMXPath方法的具体用法?PHP fDOMDocument::getDOMXPath怎么用?PHP fDOMDocument::getDOMXPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TheSeer\fDOM\fDOMDocument的用法示例。


在下文中一共展示了fDOMDocument::getDOMXPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCloningTriggersCreationOfNewDOMXPathInstance

 /**
  * @covers \TheSeer\fDOM\fDOMDocument::__clone
  */
 public function testCloningTriggersCreationOfNewDOMXPathInstance()
 {
     $this->dom->loadXML('<?xml version="1.0" ?><test />');
     $xp1 = $this->dom->getDOMXPath();
     $clone = clone $this->dom;
     $xp2 = $clone->getDOMXPath();
     $this->assertNotSame($xp2, $xp1);
 }
开发者ID:KingNoosh,项目名称:Teknik,代码行数:11,代码来源:fDOMDocument.test.php

示例2: processUnit

 private function processUnit(fDOMDocument $unit, fDOMDocument $coverage)
 {
     $enrichment = $this->getEnrichtmentContainer($unit->documentElement, 'phpunit');
     $className = $unit->documentElement->getAttribute('name');
     $classNamespace = $unit->documentElement->getAttribute('namespace');
     $classNode = $coverage->queryOne(sprintf('//pu:class[@name = "%s" and pu:namespace[@name = "%s"]]', $className, $classNamespace));
     if (!$classNode) {
         // This class seems to be newer than the last phpunit run
         return;
     }
     $coverageTarget = $enrichment->appendElementNS(self::XMLNS, 'coverage');
     foreach (array('executable', 'executed', 'crap') as $attr) {
         $coverageTarget->appendChild($coverageTarget->ownerDocument->importNode($classNode->getAttributeNode($attr)));
     }
     $result = array('PASSED' => 0, 'SKIPPED' => 0, 'INCOMPLETE' => 0, 'FAILURE' => 0, 'ERROR' => 0, 'RISKY' => 0);
     $methods = $unit->query('/phpdox:*/phpdox:constructor|/phpdox:*/phpdox:destructor|/phpdox:*/phpdox:method');
     $xp = $this->index->getDOMXPath();
     foreach ($methods as $method) {
         $start = $method->getAttribute('start');
         $end = $method->getAttribute('end');
         $enrichment = $this->getEnrichtmentContainer($method, 'phpunit');
         $coverageTarget = $enrichment->appendElementNS(self::XMLNS, 'coverage');
         /** @var fDOMElement $coverageMethod */
         $coverageMethod = $coverage->queryOne(sprintf('//pu:method[@start = "%d" and @end = "%d"]', $start, $end));
         if ($coverageMethod != NULL) {
             foreach (array('executable', 'executed', 'coverage', 'crap') as $attr) {
                 $coverageTarget->appendChild($coverageTarget->ownerDocument->importNode($coverageMethod->getAttributeNode($attr)));
             }
         }
         $coveredNodes = $coverage->query(sprintf('//pu:coverage/pu:line[@nr >= "%d" and @nr <= "%d"]/pu:covered', $start, $end));
         $seen = array();
         foreach ($coveredNodes as $coveredNode) {
             $by = $coveredNode->getAttribute('by');
             if (isset($seen[$by])) {
                 continue;
             }
             $seen[$by] = true;
             $name = $xp->prepare(':name', array('name' => $by));
             $test = $coverageTarget->appendChild($unit->importNode($this->index->queryOne(sprintf('//pu:tests/pu:test[@name = %s]', $name))));
             $result[$test->getAttribute('status')]++;
         }
     }
     if (!isset($this->results[$classNamespace])) {
         $this->results[$classNamespace] = array();
         $this->coverage[$classNamespace] = array();
     }
     $this->results[$classNamespace][$className] = $result;
     $this->coverage[$classNamespace][$className] = $coverageTarget->cloneNode(false);
 }
开发者ID:webkingashu,项目名称:phpdox,代码行数:49,代码来源:PHPUnit.php

示例3: parse

 /**
  * @param  string $xpath
  * @return array
  */
 public function parse($xpath = '')
 {
     $result = array('items' => array(), 'excludes' => array(), 'names' => array());
     foreach ($this->xml->getDOMXPath()->query($xpath . 'include/directory') as $item) {
         $result['items'][] = $this->toAbsolutePath($item->nodeValue);
     }
     foreach ($this->xml->getDOMXPath()->query($xpath . 'include/file') as $item) {
         $result['items'][] = $this->toAbsolutePath($item->nodeValue);
     }
     foreach ($this->xml->getDOMXPath()->query($xpath . 'exclude') as $exclude) {
         $result['excludes'][] = $exclude->nodeValue;
     }
     foreach ($this->xml->getDOMXPath()->query($xpath . 'name') as $name) {
         $result['names'][] = $name->nodeValue;
     }
     return $result;
 }
开发者ID:nizarbey,项目名称:phpunit-all-in-one,代码行数:21,代码来源:Configuration.php

示例4: setUp

 public function setUp()
 {
     $this->dom = new fDOMDocument();
     $this->dom->loadXML('<?xml version="1.0" ?><root><node attr="foo" /></root>');
     $this->xp = $this->dom->getDOMXPath();
 }
开发者ID:klikar3,项目名称:yii2-RGraph,代码行数:6,代码来源:fDOMXPath.test.php


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