mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-53661_master' of https://github.com/sam-moodle/moodle
This commit is contained in:
commit
a5a70e33f7
@ -1404,10 +1404,8 @@ function lti_prepare_type_for_save($type, $config) {
|
||||
$type->secureicon = $config->lti_secureicon;
|
||||
}
|
||||
|
||||
if (isset($config->lti_forcessl)) {
|
||||
$type->forcessl = !empty($config->lti_forcessl) ? $config->lti_forcessl : 0;
|
||||
$config->lti_forcessl = $type->forcessl;
|
||||
}
|
||||
$type->forcessl = !empty($config->lti_forcessl) ? $config->lti_forcessl : 0;
|
||||
$config->lti_forcessl = $type->forcessl;
|
||||
|
||||
$type->timemodified = time();
|
||||
|
||||
|
@ -264,4 +264,32 @@ class mod_lti_locallib_testcase extends advanced_testcase {
|
||||
|
||||
$this->assertEquals($ncount, $rncount, 'All newline characters should be a combination of \r\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests lti_prepare_type_for_save's handling of the "Force SSL" configuration.
|
||||
*/
|
||||
public function test_lti_prepare_type_for_save_forcessl() {
|
||||
$type = new stdClass();
|
||||
$config = new stdClass();
|
||||
|
||||
// Try when the forcessl config property is not set.
|
||||
lti_prepare_type_for_save($type, $config);
|
||||
$this->assertObjectHasAttribute('lti_forcessl', $config);
|
||||
$this->assertEquals(0, $config->lti_forcessl);
|
||||
$this->assertEquals(0, $type->forcessl);
|
||||
|
||||
// Try when forcessl config property is set.
|
||||
$config->lti_forcessl = 1;
|
||||
lti_prepare_type_for_save($type, $config);
|
||||
$this->assertObjectHasAttribute('lti_forcessl', $config);
|
||||
$this->assertEquals(1, $config->lti_forcessl);
|
||||
$this->assertEquals(1, $type->forcessl);
|
||||
|
||||
// Try when forcessl config property is set to 0.
|
||||
$config->lti_forcessl = 0;
|
||||
lti_prepare_type_for_save($type, $config);
|
||||
$this->assertObjectHasAttribute('lti_forcessl', $config);
|
||||
$this->assertEquals(0, $config->lti_forcessl);
|
||||
$this->assertEquals(0, $type->forcessl);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user