/** * @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; }
/** * 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"); }
public function testSeeXmlIncludesWithBuilder() { $dom = new DOMDocument(); $this->module->xmlResponse = $dom; $dom->loadXML('<?xml version="1.0" encoding="UTF-8"?>' . "\n" . ' <doc><a a2="2" a1="1" >123</a></doc>'); $xml = SoapUtil::request()->doc->a->attr('a2', '2')->attr('a1', '1')->val('123'); $this->module->seeSoapResponseIncludes($xml); }
/** * 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"); }
protected function canonicalize($xml) { return SoapUtils::toXml($xml)->C14N(); }
protected function canonicalize($xml) { $xml = SoapUtils::toXml($xml)->C14N(); return $xml; }