OneLogin_Saml2_Auth::setStrict PHP Method

setStrict() public method

Set the strict mode active/disable
public setStrict ( boolean $value ) : array
$value boolean Strict parameter
return array The settings data.
    public function setStrict($value)
    {
        if (!is_bool($value)) {
            throw new Exception('Invalid value passed to setStrict()');
        }
        $this->_settings->setStrict($value);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Tests the setStrict method of the OneLogin_Saml2_Auth
  *
  * @covers OneLogin_Saml2_Auth::setStrict
  */
 public function testSetStrict()
 {
     $settingsDir = TEST_ROOT . '/settings/';
     include $settingsDir . 'settings1.php';
     $settingsInfo['strict'] = false;
     $auth = new OneLogin_Saml2_Auth($settingsInfo);
     $settings = $auth->getSettings();
     $this->assertFalse($settings->isStrict());
     $auth->setStrict(true);
     $settings = $auth->getSettings();
     $this->assertTrue($settings->isStrict());
     $auth->setStrict(false);
     $settings = $auth->getSettings();
     $this->assertFalse($settings->isStrict());
     try {
         $auth->setStrict('a');
         $this->assertTrue(false);
     } catch (Exception $e) {
         $this->assertContains('Assertion "is_bool($value)" failed', $e->getMessage());
     }
 }