See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 39 and 401]
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 /** 18 * Unit tests for tool_moodlenet lib 19 * 20 * @package tool_moodlenet 21 * @copyright 2020 Peter Dias 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 namespace tool_moodlenet; 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 global $CFG; 29 require_once($CFG->dirroot . '/admin/tool/moodlenet/lib.php'); 30 31 /** 32 * Test moodlenet functions 33 */ 34 class lib_test extends \advanced_testcase { 35 36 /** 37 * Test the generate_mnet_endpoint function 38 * 39 * @dataProvider get_endpoints_provider 40 * @param string $profileurl 41 * @param int $course 42 * @param int $section 43 * @param string $expected 44 */ 45 public function test_generate_mnet_endpoint($profileurl, $course, $section, $expected) { 46 $endpoint = generate_mnet_endpoint($profileurl, $course, $section); 47 $this->assertEquals($expected, $endpoint); 48 } 49 50 /** 51 * Dataprovider for test_generate_mnet_endpoint 52 * 53 * @return array 54 */ 55 public function get_endpoints_provider() { 56 global $CFG; 57 return [ 58 [ 59 '@name@domain.name', 60 1, 61 2, 62 'https://domain.name/' . MOODLENET_DEFAULT_ENDPOINT . '?site=' . urlencode($CFG->wwwroot) 63 . '&course=1§ion=2' 64 ], 65 [ 66 '@profile@name@domain.name', 67 1, 68 2, 69 'https://domain.name/' . MOODLENET_DEFAULT_ENDPOINT . '?site=' . urlencode($CFG->wwwroot) 70 . '&course=1§ion=2' 71 ], 72 [ 73 'https://domain.name', 74 1, 75 2, 76 'https://domain.name/' . MOODLENET_DEFAULT_ENDPOINT . '?site=' . urlencode($CFG->wwwroot) 77 . '&course=1§ion=2' 78 ] 79 ]; 80 } 81 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body