| Línea 22... |
Línea 22... |
| 22 |
* @package core
|
22 |
* @package core
|
| 23 |
* @copyright 2019 Ryan Wyllie <ryan@moodle.com>
|
23 |
* @copyright 2019 Ryan Wyllie <ryan@moodle.com>
|
| 24 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
24 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| 25 |
* @covers \core\output\mustache_helper_collection
|
25 |
* @covers \core\output\mustache_helper_collection
|
| 26 |
*/
|
26 |
*/
|
| 27 |
class mustache_helper_collection_test extends \advanced_testcase {
|
27 |
final class mustache_helper_collection_test extends \advanced_testcase {
|
| Línea 28... |
Línea 28... |
| 28 |
|
28 |
|
| 29 |
/**
|
29 |
/**
|
| 30 |
* Test cases to confirm that disallowed helpers are stripped from the source
|
30 |
* Test cases to confirm that disallowed helpers are stripped from the source
|
| 31 |
* text by the helper before being passed to other another helper. This prevents
|
31 |
* text by the helper before being passed to other another helper. This prevents
|
| 32 |
* nested calls to helpers.
|
32 |
* nested calls to helpers.
|
| 33 |
*/
|
33 |
*/
|
| 34 |
public function get_strip_disallowed_helpers_testcases() {
|
34 |
public static function get_strip_disallowed_helpers_testcases(): array {
|
| 35 |
return [
|
35 |
return [
|
| 36 |
'no disallowed' => [
|
36 |
'no disallowed' => [
|
| 37 |
'disallowed' => [],
|
37 |
'disallowed' => [],
|
| 38 |
'input' => 'core, move, {{#js}} some nasty JS {{/js}}',
|
38 |
'input' => 'core, move, {{#js}} some nasty JS {{/js}}',
|
| Línea 121... |
Línea 121... |
| 121 |
];
|
121 |
];
|
| 122 |
}
|
122 |
}
|
| Línea 123... |
Línea 123... |
| 123 |
|
123 |
|
| 124 |
/**
|
124 |
/**
|
| 125 |
* Test that the mustache_helper_collection class correctly strips
|
125 |
* Test that the mustache_helper_collection class correctly strips
|
| 126 |
* @dataProvider get_strip_disallowed_helpers_testcases()
|
126 |
* @dataProvider get_strip_disallowed_helpers_testcases
|
| 127 |
* @param string[] $disallowed The list of helpers to strip
|
127 |
* @param string[] $disallowed The list of helpers to strip
|
| 128 |
* @param string $input The input string for the helper
|
128 |
* @param string $input The input string for the helper
|
| 129 |
* @param string $expected The expected output of the string after disallowed strip
|
129 |
* @param string $expected The expected output of the string after disallowed strip
|
| 130 |
*/
|
130 |
*/
|