SAML2\AssertionTest::testSetAuthnContextDecl PHP Method

testSetAuthnContextDecl() public method

Test setting an AuthnContextDecl chunk.
    public function testSetAuthnContextDecl()
    {
        $xml = <<<XML
<samlac:AuthenticationContextDeclaration xmlns:samlac="urn:oasis:names:tc:SAML:2.0:ac">
</samlac:AuthenticationContextDeclaration>
XML;
        $document = DOMDocumentFactory::fromString($xml);
        $assertion = new Assertion();
        $assertion->setAuthnContextDecl(new Chunk($document->documentElement));
        $documentParent = DOMDocumentFactory::fromString("<root />");
        $assertionElement = $assertion->toXML($documentParent->firstChild);
        $acElements = Utils::xpQuery($assertionElement, './saml_assertion:AuthnStatement/saml_assertion:AuthnContext');
        $this->assertCount(1, $acElements);
        $this->assertEquals('samlac:AuthenticationContextDeclaration', $acElements[0]->firstChild->tagName);
        $this->assertEquals('urn:oasis:names:tc:SAML:2.0:ac', $acElements[0]->firstChild->namespaceURI);
    }
AssertionTest