Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 34... Línea 34...
34
class externallib_test extends externallib_advanced_testcase {
34
class externallib_test extends externallib_advanced_testcase {
Línea 35... Línea 35...
35
 
35
 
36
    /**
36
    /**
37
     * Test list all.
37
     * Test list all.
38
     */
38
     */
39
    public function test_list_templates() {
39
    public function test_list_templates(): void {
40
        $result = external::list_templates('', '');
40
        $result = external::list_templates('', '');
41
        $count = count($result);
41
        $count = count($result);
42
        // We have 3 templates in this tool - and there must be more else where.
42
        // We have 3 templates in this tool - and there must be more else where.
43
        $this->assertGreaterThan(3, $count);
43
        $this->assertGreaterThan(3, $count);
Línea 44... Línea 44...
44
    }
44
    }
45
 
45
 
46
    /**
46
    /**
47
     * Test we can filter by component.
47
     * Test we can filter by component.
48
     */
48
     */
49
    public function test_list_templates_for_component() {
49
    public function test_list_templates_for_component(): void {
50
        $result = external::list_templates('tool_templatelibrary', '');
50
        $result = external::list_templates('tool_templatelibrary', '');
Línea 51... Línea 51...
51
        $count = count($result);
51
        $count = count($result);
Línea 57... Línea 57...
57
    }
57
    }
Línea 58... Línea 58...
58
 
58
 
59
    /**
59
    /**
60
     * Test we can filter by a string.
60
     * Test we can filter by a string.
61
     */
61
     */
62
    public function test_list_templates_with_filter() {
62
    public function test_list_templates_with_filter(): void {
63
        $result = external::list_templates('tool_templatelibrary', 'page');
63
        $result = external::list_templates('tool_templatelibrary', 'page');
64
        $count = count($result);
64
        $count = count($result);
65
        // Should be only one matching template.
65
        // Should be only one matching template.
66
        $this->assertEquals(1, $count);
66
        $this->assertEquals(1, $count);
67
        $this->assertEquals($result[0], "tool_templatelibrary/list_templates_page");
67
        $this->assertEquals($result[0], "tool_templatelibrary/list_templates_page");
Línea 68... Línea 68...
68
    }
68
    }
69
 
69
 
Línea 70... Línea 70...
70
    public function test_load_canonical_template() {
70
    public function test_load_canonical_template(): void {
71
        global $CFG;
71
        global $CFG;
72
 
72