Skip to content

Commit 04232b7

Browse files
author
Zhangqi Chen
committed
Fix style error and add another test for my changes
1 parent 655a3cf commit 04232b7

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

lib/Saml2/Auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class OneLogin_Saml2_Auth
148148
*
149149
* @throws OneLogin_Saml2_Error
150150
*/
151-
public function __construct($oldSettings = null , $spValidationOnly = true)
151+
public function __construct($oldSettings = null , $spValidationOnly = false)
152152
{
153153
$this->_settings = new OneLogin_Saml2_Settings($oldSettings, $spValidationOnly);
154154
}

tests/src/OneLogin/Saml2/SettingsTest.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ public function testIsDebugActive()
11651165
$this->assertTrue($settings3->isDebugActive());
11661166
}
11671167
/**
1168-
* Tests the checkSettings method of the OneLogin_Saml2_Settings
1168+
* Tests the checkSettings method of the OneLogin_Saml2_Settings when SpValidateOnly is false and IdP is not defined
11691169
*
11701170
* @covers OneLogin_Saml2_Settings::checkSettings
11711171
*/
@@ -1174,7 +1174,25 @@ public function testSpValidateOnlyIsTrue()
11741174
$settingsDir = TEST_ROOT .'/settings/';
11751175
include $settingsDir.'settings2.php';
11761176
unset($settingsInfo['idp']);
1177-
$settings = new OneLogin_Saml2_Settings($settingsInfo,true);
1177+
$settings = new OneLogin_Saml2_Settings($settingsInfo, true);
11781178
$this->assertEmpty($settings->getErrors());
11791179
}
1180+
1181+
/**
1182+
* Tests the checkSettings method of the OneLogin_Saml2_Settings when SpValidateOnly is false and IdP is not defined
1183+
*
1184+
* @covers OneLogin_Saml2_Settings::checkSettings
1185+
*/
1186+
public function testSpValidateOnlyIsFalse()
1187+
{
1188+
$settingsDir = TEST_ROOT .'/settings/';
1189+
include $settingsDir.'settings2.php';
1190+
unset($settingsInfo['idp']);
1191+
try {
1192+
$settings = new OneLogin_Saml2_Settings($settingsInfo);
1193+
}catch (OneLogin_Saml2_Error $e) {
1194+
$this->assertContains('idp_not_found', $e->getMessage());
1195+
}
1196+
$this->assertEmpty($settings);
1197+
}
11801198
}

0 commit comments

Comments
 (0)