toXML() public method

Convert this Scope to XML.
public toXML ( DOMElement $parent ) : DOMElement
$parent DOMElement The element we should append this Scope to.
return DOMElement
Example #1
0
 /**
  * Marshalling a scope which is in regexp form.
  */
 public function testMarshallingRegexp()
 {
     $scope = new Scope();
     $scope->scope = "^(.*\\.)?example\\.edu\$";
     $scope->regexp = TRUE;
     $document = DOMDocumentFactory::fromString('<root />');
     $scopeElement = $scope->toXML($document->firstChild);
     $scopeElements = Utils::xpQuery($scopeElement, '/root/shibmd:Scope');
     $this->assertCount(1, $scopeElements);
     $scopeElement = $scopeElements[0];
     $this->assertEquals('^(.*\\.)?example\\.edu$', $scopeElement->nodeValue);
     $this->assertEquals('urn:mace:shibboleth:metadata:1.0', $scopeElement->namespaceURI);
     $this->assertEquals('true', $scopeElement->getAttribute('regexp'));
 }