/**
  * @param $xml
  * @return bool
  */
 public function matchXmlStructure($xml)
 {
     $xml = XmlUtils::toXml($xml);
     $root = $xml->firstChild;
     $els = $this->xml->getElementsByTagName($root->nodeName);
     if (empty($els)) {
         throw new ElementNotFound($root->nodeName, 'Element');
     }
     $matches = false;
     foreach ($els as $node) {
         $matches |= $this->matchForNode($root, $node);
     }
     return $matches;
 }
示例#2
0
文件: REST.php 项目: corcre/elabftw
 /**
  * Checks XML response does not include provided XML.
  * Comparison is done by canonicalizing both xml`s.
  * Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
  *
  * @param $xml
  * @part xml
  */
 public function dontSeeXmlResponseIncludes($xml)
 {
     $this->assertNotContains(XmlUtils::toXml($xml)->C14N(), XmlUtils::toXml($this->response)->C14N(), "found in XML Response");
 }
示例#3
0
 protected function canonicalize($xml)
 {
     return SoapUtils::toXml($xml)->C14N();
 }
示例#4
0
 /**
  * Checks XML response does not include provided XML.
  * Comparison is done by canonicalizing both xml`s.
  * Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
  *
  * @param $xml
  * @part xml
  */
 public function dontSeeXmlResponseIncludes($xml)
 {
     $this->assertNotContains(XmlUtils::toXml($xml)->C14N(), XmlUtils::toXml($this->connectionModule->_getResponseContent())->C14N(), "found in XML Response");
 }
示例#5
0
 protected function canonicalize($xml)
 {
     $xml = SoapUtils::toXml($xml)->C14N();
     return $xml;
 }