Skip to content

Commit e335ce6

Browse files
author
Boy Baukema
committed
Fixed test
1 parent ceedf35 commit e335ce6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/src/OneLogin/Saml/ResponseTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,23 @@ public function testGetAttributes()
3333
$this->assertEquals($expectedAttributes, $response->getAttributes());
3434

3535
// An assertion that has no attributes should return an empty array when asked for the attributes
36-
$assertion = file_get_contents(TEST_ROOT . '/responses/wrapped_response_2.xml.base64');
36+
$assertion = file_get_contents(TEST_ROOT . '/responses/response2.xml.base64');
3737
$response = new OneLogin_Saml_Response($this->_settings, $assertion);
3838

3939
$this->assertEmpty($response->getAttributes());
4040
}
4141

42-
public function testOnlyRetreiveAssertionWithIDThatMatchesSignatureReference()
42+
public function testOnlyRetrieveAssertionWithIDThatMatchesSignatureReference()
4343
{
4444
$assertion = file_get_contents(TEST_ROOT . '/responses/wrapped_response_2.xml.base64');
4545
$response = new OneLogin_Saml_Response($this->_settings, $assertion);
46-
47-
$this->assertNotEquals('[email protected]', $response->getNameId());
46+
try {
47+
$nameId = $response->getNameId();
48+
$this->assertNotEquals('[email protected]', $nameId);
49+
}
50+
catch (Exception $e) {
51+
$this->assertNotEmpty($e->getMessage(), 'Trying to get NameId on an unsigned assertion fails');
52+
}
4853
}
4954

5055
public function testDoesNotAllowSignatureWrappingAttack()

0 commit comments

Comments
 (0)