diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php | 2 | ||||
-rw-r--r-- | tests/lib/SimpleSAML/Metadata/SAMLParserTest.php | 39 |
2 files changed, 40 insertions, 1 deletions
diff --git a/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php b/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php index 48caa5e..8f0fddd 100644 --- a/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php +++ b/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php @@ -8,7 +8,7 @@ class SimpleSAML_Metadata_SAMLBuilderTest extends PHPUnit_Framework_TestCase { /** - * Test the requeste attributes are valued correctly. + * Test the requested attributes are valued correctly. */ public function testAttributes() { diff --git a/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php b/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php new file mode 100644 index 0000000..9587431 --- /dev/null +++ b/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php @@ -0,0 +1,39 @@ +<?php +namespace SimpleSAML\Metadata; + +/** + * Test SAML parsing + */ +class SAMLParserTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Test Registration Info is parsed + */ + public function testRegistrationInfo() + { + $expected = array( + 'registrationAuthority' => 'https://incommon.org', + ); + + $document = \SAML2_DOMDocumentFactory::fromString( + <<<XML +<EntityDescriptor entityID="theEntityID" + xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi"> + <Extensions> + <mdrpi:RegistrationInfo registrationAuthority="https://incommon.org"/> + </Extensions> + <SPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"> + </SPSSODescriptor> +</EntityDescriptor> +XML + ); + + + $entities = \SimpleSAML_Metadata_SAMLParser::parseDescriptorsElement($document->documentElement); + $this->assertArrayHasKey('theEntityID', $entities); + // RegistrationInfo is accessible in the SP or IDP metadata accessors + $this->assertEquals($expected, $entities['theEntityID']->getMetadata20SP()['RegistrationInfo']); + + } +} |