當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。