MDL-57409 tool_mobile: Return mobileapp settings in get_config WS
authorJuan Leyva <juanleyvadelgado@gmail.com>
Tue, 27 Dec 2016 13:02:20 +0000 (14:02 +0100)
committerJuan Leyva <juanleyvadelgado@gmail.com>
Mon, 9 Jan 2017 11:19:29 +0000 (12:19 +0100)
admin/tool/mobile/classes/api.php
admin/tool/mobile/tests/externallib_test.php

index f10fb60..4366823 100644 (file)
@@ -202,6 +202,10 @@ class api {
             $settings->mygradesurl = user_mygrades_url()->out(false);
         }
 
+        if (empty($section) or $section == 'mobileapp') {
+            $settings->tool_mobile_forcelogout = get_config('tool_mobile', 'forcelogout');
+        }
+
         return $settings;
     }
 
index f145cd0..bed4eb0 100644 (file)
@@ -144,6 +144,7 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
             array('name' => 'commentsperpage', 'value' => $CFG->commentsperpage),
             array('name' => 'disableuserimages', 'value' => $CFG->disableuserimages),
             array('name' => 'mygradesurl', 'value' => user_mygrades_url()->out(false)),
+            array('name' => 'tool_mobile_forcelogout', 'value' => 0),
         );
         $this->assertCount(0, $result['warnings']);
         $this->assertEquals($expected, $result['settings']);
@@ -151,8 +152,8 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
         // Change a value and retrieve filtering by section.
         set_config('commentsperpage', 1);
         $expected[10]['value'] = 1;
-        unset($expected[11]);
-        unset($expected[12]);
+        // Remove not expected elements.
+        array_splice($expected, 11);
 
         $result = external::get_config('frontpagesettings');
         $result = external_api::clean_returnvalue(external::get_config_returns(), $result);