See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 namespace mod_lti\external; 18 19 defined('MOODLE_INTERNAL') || die(); 20 21 global $CFG; 22 23 require_once($CFG->dirroot . '/mod/lti/tests/mod_lti_testcase.php'); 24 25 /** 26 * PHPUnit tests for get_tool_types_and_proxies_count external function. 27 * 28 * @package mod_lti 29 * @author Andrew Madden <andrewmadden@catalyst-au.net> 30 * @copyright 2021 Catalyst IT 31 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 32 */ 33 class get_tool_types_and_proxies_count_test extends \mod_lti_testcase { 34 35 /** 36 * This method runs before every test. 37 */ 38 public function setUp(): void { 39 $this->resetAfterTest(); 40 $this->setAdminUser(); 41 } 42 43 /** 44 * Test get_tool_types_and_proxies_count returns the correct number. 45 */ 46 public function test_mod_lti_get_tool_types_and_proxies_count() { 47 for ($i = 0; $i < 10; $i++) { 48 $proxy = $this->generate_tool_proxy($i); 49 $this->generate_tool_type($i, $proxy->id); 50 } 51 52 $data = \mod_lti\external\get_tool_types_and_proxies_count::execute(0, false); 53 $data = \external_api::clean_returnvalue(\mod_lti\external\get_tool_types_and_proxies_count::execute_returns(), $data); 54 55 $this->assertEquals(20, $data['count']); 56 } 57 58 /** 59 * Test get_tool_types_and_proxies_count returns the correct number. 60 */ 61 public function test_mod_lti_get_tool_types_and_proxies_count_with_no_tools_configured() { 62 $data = \mod_lti\external\get_tool_types_and_proxies_count::execute(0, false); 63 $data = \external_api::clean_returnvalue(\mod_lti\external\get_tool_types_and_proxies_count::execute_returns(), $data); 64 65 $this->assertEquals(0, $data['count']); 66 } 67 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body