/** * Test we can filter by a string. */ public function test_list_templates_with_filter() { $result = external::list_templates('tool_templatelibrary', 'page'); $count = count($result); // Should be only one matching template. $this->assertEquals(1, $count); $this->assertEquals($result[0], "tool_templatelibrary/list_templates_page"); }
public function test_load_canonical_template() { global $CFG; $originaltheme = $CFG->theme; // Change the theme to 'base' because it overrides these templates. $CFG->theme = 'base'; $template = external::load_canonical_template('core', 'notification_problem'); // Only the base template should contain the docs. $this->assertContains('@template core/notification_problem', $template); // Restore the original theme. $CFG->theme = $originaltheme; }