SAML2\AssertionTest::testSubjectMustHaveNameIDorSubjectConfirmation PHP Method

testSubjectMustHaveNameIDorSubjectConfirmation() public method

A wtthout both NameID and SubjectConfirmation throws exception.
    public function testSubjectMustHaveNameIDorSubjectConfirmation()
    {
        $xml = <<<XML
<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                ID="_593e33ddf86449ce4d4c22b60ac48e067d98a0b2bf"
                Version="2.0"
                IssueInstant="2010-03-05T13:34:28Z"
>
  <saml:Issuer>testIssuer</saml:Issuer>
  <saml:Subject>
    <Something>not a nameid or subject confirmation</Something>
  </saml:Subject>
  <saml:AuthnStatement AuthnInstant="2010-03-05T13:34:28Z">
    <saml:AuthnContext>
      <saml:AuthnContextClassRef>someAuthnContext</saml:AuthnContextClassRef>
      <saml:AuthnContextDeclRef>/relative/path/to/document.xml</saml:AuthnContextDeclRef>
    </saml:AuthnContext>
  </saml:AuthnStatement>
</saml:Assertion>
XML;
        $document = DOMDocumentFactory::fromString($xml);
        $this->setExpectedException('Exception', 'Missing <saml:SubjectConfirmation> in <saml:Subject>');
        $assertion = new Assertion($document->documentElement);
    }
AssertionTest