Esempio n. 1
0
 public function testMarshalling()
 {
     $attribute = new SAML2_XML_saml_Attribute();
     $attribute->Name = 'TheName';
     $attribute->NameFormat = 'TheNameFormat';
     $attribute->FriendlyName = 'TheFriendlyName';
     $attribute->AttributeValue = array(new SAML2_XML_saml_AttributeValue('FirstValue'), new SAML2_XML_saml_AttributeValue('SecondValue'));
     $document = SAML2_DOMDocumentFactory::fromString('<root />');
     $attributeElement = $attribute->toXML($document->firstChild);
     $attributeElements = SAML2_Utils::xpQuery($attributeElement, '/root/saml_assertion:Attribute');
     $this->assertCount(1, $attributeElements);
     $attributeElement = $attributeElements[0];
     $this->assertEquals('TheName', $attributeElement->getAttribute('Name'));
     $this->assertEquals('TheNameFormat', $attributeElement->getAttribute('NameFormat'));
     $this->assertEquals('TheFriendlyName', $attributeElement->getAttribute('FriendlyName'));
 }
Esempio n. 2
0
 /**
  * Initialize an RequestedAttribute.
  *
  * @param DOMElement|NULL $xml The XML element we should load.
  */
 public function __construct(DOMElement $xml = NULL)
 {
     parent::__construct($xml);
     if ($xml === NULL) {
         return;
     }
     $this->isRequired = SAML2_Utils::parseBoolean($xml, 'isRequired', NULL);
 }