/**
* Try to verify a signed assertion.
*/
public function testVerifySignedAssertion()
{
$doc = new \DOMDocument();
$doc->load(__DIR__ . '/signedassertion.xml');
$publicKey = CertificatesMock::getPublicKeySha1();
$assertion = new Assertion($doc->firstChild);
$result = $assertion->validate($publicKey);
$this->assertTrue($result);
// Double-check that we can actually retrieve some basics.
$this->assertEquals("_d908a49b8b63665738430d1c5b655f297b91331864", $assertion->getId());
$this->assertEquals("https://thki-sid.pt-48.utr.surfcloud.nl/ssp/saml2/idp/metadata.php", $assertion->getIssuer());
$this->assertEquals("1457707995", $assertion->getIssueInstant());
$certs = $assertion->getCertificates();
$this->assertCount(1, $certs);
$this->assertEquals(CertificatesMock::getPlainPublicKeyContents(), $certs[0]);
// Was signed
$this->assertTrue($assertion->getWasSignedAtConstruction());
}