See Release Notes
Long Term Support Release
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 declare(strict_types=1); 18 19 namespace core\output; 20 21 /** 22 * Unit tests for the mustache_clean_string_helper class. 23 * 24 * @package core 25 * @category test 26 * @copyright 2021 Shamim Rezaie <shamim@moodle.com> 27 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 28 * @coversDefaultClass \core\output\mustache_clean_string_helper 29 */ 30 class mustache_clean_string_helper_test extends \basic_testcase { 31 32 /** 33 * Test the get_lang_menu 34 * 35 * @covers ::cleanstr 36 */ 37 function test_cleanstr() { 38 $engine = new \Mustache_Engine(); 39 $context = new \Mustache_Context(); 40 $lambdahelper = new \Mustache_LambdaHelper($engine, $context); 41 42 $cleanstringhelper = new mustache_clean_string_helper(); 43 44 // Simple string. 45 $this->assertEquals('Log in', $cleanstringhelper->cleanstr('login, core', $lambdahelper)); 46 47 // Quotes in string. 48 $this->assertEquals('Today's logs', $cleanstringhelper->cleanstr('todaylogs, core', $lambdahelper)); 49 50 // Quotes in string with parameter. 51 $this->assertEquals('After "test"', $cleanstringhelper->cleanstr('movecontentafter, core, test', $lambdahelper)); 52 53 // Quotes in parameter. 54 $this->assertEquals('Add a new "'&', $cleanstringhelper->cleanstr('addnew, core, "\'&', $lambdahelper)); 55 } 56 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body