diff options
author | Patrick Radtke <patrick@cirrusidentity.com> | 2016-02-23 13:11:32 -0800 |
---|---|---|
committer | Patrick Radtke <patrick@cirrusidentity.com> | 2016-02-23 15:01:15 -0800 |
commit | d718ebc34ef9b6fd30c6d5fcf6bd296430e3c560 (patch) | |
tree | a454d21da7a9b64d35fe56cd60e684cff87d02ab /tests/lib/SimpleSAML | |
parent | 1e7c1113036be64fcf202d5a22861f4785eb8a7d (diff) | |
download | simplesamlphp-d718ebc34ef9b6fd30c6d5fcf6bd296430e3c560.zip simplesamlphp-d718ebc34ef9b6fd30c6d5fcf6bd296430e3c560.tar.gz simplesamlphp-d718ebc34ef9b6fd30c6d5fcf6bd296430e3c560.tar.bz2 |
Expose RegistrationInfo in parsed metadata
- Add test case
- Fix .gitignore since it ignored all metadata folders
Diffstat (limited to 'tests/lib/SimpleSAML')
-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']); + + } +} |