Skip to content
Snippets Groups Projects
Commit f4ff365c authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Add more tests for SimpleSAML_Configuration.

parent f7eacaf8
No related branches found
No related tags found
No related merge requests found
......@@ -641,6 +641,15 @@ class Test_SimpleSAML_Configuration extends PHPUnit_Framework_TestCase
}
// now make sure SingleSignOnService, SingleLogoutService and ArtifactResolutionService works fine
$a['metadata-set'] = 'shib13-idp-remote';
$c = SimpleSAML_Configuration::loadFromArray($a);
$this->assertEquals(
array(
'Location' => 'https://example.com/sso',
'Binding' => 'urn:mace:shibboleth:1.0:profiles:AuthnRequest',
),
$c->getDefaultEndpoint('SingleSignOnService')
);
$a['metadata-set'] = 'saml20-idp-remote';
$c = SimpleSAML_Configuration::loadFromArray($a);
$this->assertEquals(
......@@ -652,17 +661,22 @@ class Test_SimpleSAML_Configuration extends PHPUnit_Framework_TestCase
);
$this->assertEquals(
array(
'Location' => 'https://example.com/sso',
'Location' => 'https://example.com/slo',
'Binding' => SAML2_Const::BINDING_HTTP_REDIRECT,
),
$c->getDefaultEndpoint('SingleSignOnService')
$c->getDefaultEndpoint('SingleLogoutService')
);
// test for old shib1.3 AssertionConsumerService
$a['metadata-set'] = 'shib13-sp-remote';
$a['AssertionConsumerService'] = 'https://example.com/endpoint.php';
$c = SimpleSAML_Configuration::loadFromArray($a);
$this->assertEquals(
array(
'Location' => 'https://example.com/slo',
'Binding' => SAML2_Const::BINDING_HTTP_REDIRECT,
'Location' => 'https://example.com/endpoint.php',
'Binding' => 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post',
),
$c->getDefaultEndpoint('SingleLogoutService')
$c->getDefaultEndpoint('AssertionConsumerService')
);
// test for no valid endpoints specified
......@@ -675,13 +689,20 @@ class Test_SimpleSAML_Configuration extends PHPUnit_Framework_TestCase
);
$c = SimpleSAML_Configuration::loadFromArray($a);
try {
$c->getDefaultEndpoint('SingleLogoutService', $valid_bindings);
$this->fail('Failed to detect invalid endpoint binding.');
} catch (Exception $e) {
$this->assertEquals('[ARRAY][\'SingleLogoutService\']:Could not find a supported SingleLogoutService '.
'endpoint.', $e->getMessage());
}
$a['metadata-set'] = 'foo';
$c = SimpleSAML_Configuration::loadFromArray($a);
try {
$c->getDefaultEndpoint('SingleSignOnService');
$this->fail('No valid metadata set specified.');
} catch (Exception $e) {
$this->assertStringStartsWith('Missing default binding for', $e->getMessage());
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment