Línea 27... |
Línea 27... |
27 |
*/
|
27 |
*/
|
28 |
class mustache_template_source_loader_test extends \advanced_testcase {
|
28 |
class mustache_template_source_loader_test extends \advanced_testcase {
|
29 |
/**
|
29 |
/**
|
30 |
* Ensure that stripping comments from templates does not mutilate the template body.
|
30 |
* Ensure that stripping comments from templates does not mutilate the template body.
|
31 |
*/
|
31 |
*/
|
32 |
public function test_strip_template_comments() {
|
32 |
public function test_strip_template_comments(): void {
|
Línea 33... |
Línea 33... |
33 |
|
33 |
|
34 |
$templatebody = <<<'TBD'
|
34 |
$templatebody = <<<'TBD'
|
35 |
<h1>{{# str }} pluginname, mod_lemmings {{/ str }}</h1>
|
35 |
<h1>{{# str }} pluginname, mod_lemmings {{/ str }}</h1>
|
36 |
<div>{{test}}</div>
|
36 |
<div>{{test}}</div>
|
Línea 168... |
Línea 168... |
168 |
* @param string $component The moodle component
|
168 |
* @param string $component The moodle component
|
169 |
* @param string $name The template name
|
169 |
* @param string $name The template name
|
170 |
* @param bool $includecomments Whether to strip comments
|
170 |
* @param bool $includecomments Whether to strip comments
|
171 |
* @param string $expected The expected output
|
171 |
* @param string $expected The expected output
|
172 |
*/
|
172 |
*/
|
173 |
public function test_load($loader, $component, $name, $includecomments, $expected) {
|
173 |
public function test_load($loader, $component, $name, $includecomments, $expected): void {
|
174 |
$this->assertEquals($expected, $loader->load($component, $name, 'boost', $includecomments));
|
174 |
$this->assertEquals($expected, $loader->load($component, $name, 'boost', $includecomments));
|
175 |
}
|
175 |
}
|
Línea 176... |
Línea 176... |
176 |
|
176 |
|
177 |
/**
|
177 |
/**
|
Línea 335... |
Línea 335... |
335 |
* @param string $component The moodle component
|
335 |
* @param string $component The moodle component
|
336 |
* @param string $name The template name
|
336 |
* @param string $name The template name
|
337 |
* @param bool $includecomments Whether to strip comments
|
337 |
* @param bool $includecomments Whether to strip comments
|
338 |
* @param string $expected The expected output
|
338 |
* @param string $expected The expected output
|
339 |
*/
|
339 |
*/
|
340 |
public function test_load_with_dependencies($loader, $component, $name, $includecomments, $expected) {
|
340 |
public function test_load_with_dependencies($loader, $component, $name, $includecomments, $expected): void {
|
341 |
$actual = $loader->load_with_dependencies($component, $name, 'boost', $includecomments);
|
341 |
$actual = $loader->load_with_dependencies($component, $name, 'boost', $includecomments);
|
342 |
$this->assertEquals($expected, $actual);
|
342 |
$this->assertEquals($expected, $actual);
|
343 |
}
|
343 |
}
|
344 |
/**
|
344 |
/**
|
345 |
* Data provider for the test_load function.
|
345 |
* Data provider for the test_load function.
|
Línea 491... |
Línea 491... |
491 |
* @dataProvider scan_template_source_for_dependencies_test_cases()
|
491 |
* @dataProvider scan_template_source_for_dependencies_test_cases()
|
492 |
* @param mustache_template_source_loader $loader The loader
|
492 |
* @param mustache_template_source_loader $loader The loader
|
493 |
* @param string $source The template to test
|
493 |
* @param string $source The template to test
|
494 |
* @param string $expected The expected output
|
494 |
* @param string $expected The expected output
|
495 |
*/
|
495 |
*/
|
496 |
public function test_scan_template_source_for_dependencies($loader, $source, $expected) {
|
496 |
public function test_scan_template_source_for_dependencies($loader, $source, $expected): void {
|
497 |
$actual = \phpunit_util::call_internal_method(
|
497 |
$actual = \phpunit_util::call_internal_method(
|
498 |
$loader,
|
498 |
$loader,
|
499 |
'scan_template_source_for_dependencies',
|
499 |
'scan_template_source_for_dependencies',
|
500 |
[$source],
|
500 |
[$source],
|
501 |
\core\output\mustache_template_source_loader::class
|
501 |
\core\output\mustache_template_source_loader::class
|