Merge branch 'MDL-38419' of https://github.com/moodlerooms/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 28 Oct 2013 04:33:39 +0000 (12:33 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 28 Oct 2013 04:33:39 +0000 (12:33 +0800)
mod/lti/locallib.php
mod/lti/tests/locallib_test.php

index 3f32ec1..f0fdcf6 100644 (file)
@@ -1168,7 +1168,7 @@ function lti_ensure_url_is_https($url) {
     } else {
         //If the URL starts with http, replace with https
         if (stripos($url, 'http://') === 0) {
-            $url = 'https://' . substr($url, 8);
+            $url = 'https://' . substr($url, 7);
         }
     }
 
index 2c3f392..33a2187 100644 (file)
@@ -139,4 +139,10 @@ class mod_lti_locallib_testcase extends basic_testcase {
 
         lti_verify_sourcedid($ltiinstance, $parsed);
     }
+
+    public function test_lti_ensure_url_is_https() {
+        $this->assertEquals('https://moodle.org', lti_ensure_url_is_https('http://moodle.org'));
+        $this->assertEquals('https://moodle.org', lti_ensure_url_is_https('moodle.org'));
+        $this->assertEquals('https://moodle.org', lti_ensure_url_is_https('https://moodle.org'));
+    }
 }