See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 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 /** 18 * Check API unit tests 19 * 20 * @package core 21 * @category check 22 * @copyright 2020 Brendan Heywood <brendan@catalyst-au.net> 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 use core\check\result; 29 30 /** 31 * Example unit tests for check API 32 * 33 * @package core 34 * @category check 35 * @copyright 2020 Brendan Heywood <brendan@catalyst-au.net> 36 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 37 */ 38 class check_testcase extends advanced_testcase { 39 40 /** 41 * A simple example showing how a check and result object works 42 * 43 * Conceptually a check is analgous to a unit test except at runtime 44 * instead of build time so many checks in real life such as testing 45 * an API is connecting aren't viable to unit test. 46 */ 47 public function test_passwordpolicy() { 48 global $CFG; 49 $prior = $CFG->passwordpolicy; 50 51 $check = new core\check\security\passwordpolicy(); 52 53 $CFG->passwordpolicy = false; 54 $result = $check->get_result(); 55 $this->assertEquals($result->status, result::WARNING); 56 57 $CFG->passwordpolicy = true; 58 $result = $check->get_result(); 59 $this->assertEquals($result->status, result::OK); 60 61 $CFG->passwordpolicy = $prior; 62 } 63 } 64
title
Description
Body
title
Description
Body
title
Description
Body
title
Body