Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 27... Línea 27...
27
 * @category   test
27
 * @category   test
28
 * @copyright  2022 Ferran Recio <ferran@moodle.com>
28
 * @copyright  2022 Ferran Recio <ferran@moodle.com>
29
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30
 * @coversDefaultClass \mod_data\template
30
 * @coversDefaultClass \mod_data\template
31
 */
31
 */
32
class template_test extends \advanced_testcase {
32
final class template_test extends \advanced_testcase {
33
    /**
33
    /**
34
     * Setup to ensure that fixtures are loaded.
34
     * Setup to ensure that fixtures are loaded.
35
     */
35
     */
36
    public static function setupBeforeClass(): void {
36
    public static function setupBeforeClass(): void {
37
        global $CFG;
37
        global $CFG;
Línea 171... Línea 171...
171
    /**
171
    /**
172
     * Data provider for test_parse_entries().
172
     * Data provider for test_parse_entries().
173
     *
173
     *
174
     * @return array of scenarios
174
     * @return array of scenarios
175
     */
175
     */
176
    public function parse_entries_provider(): array {
176
    public static function parse_entries_provider(): array {
177
        return [
177
        return [
178
            // Teacher scenarios.
178
            // Teacher scenarios.
179
            'Teacher id tag' => [
179
            'Teacher id tag' => [
180
                'templatecontent' => 'Some ##id## tag',
180
                'templatecontent' => 'Some ##id## tag',
181
                'expected' => '|Some {entryid} tag|',
181
                'expected' => '|Some {entryid} tag|',
Línea 405... Línea 405...
405
                'enableratings' => true,
405
                'enableratings' => true,
406
                'options' => ['ratings' => true],
406
                'options' => ['ratings' => true],
407
            ],
407
            ],
408
            'Teacher actionsmenu tag with default options' => [
408
            'Teacher actionsmenu tag with default options' => [
409
                'templatecontent' => 'Some ##actionsmenu## tag',
409
                'templatecontent' => 'Some ##actionsmenu## tag',
410
                'expected' => '|Some .*edit.*{entryid}.*sesskey.*Edit.* .*delete.*{entryid}.*sesskey.*Delete.* tag|',
410
                'expected' => '|Some .*edit.*{entryid}.*Edit.* .*delete.*{entryid}.*Delete.* tag|',
411
                'rolename' => 'editingteacher',
411
                'rolename' => 'editingteacher',
412
            ],
412
            ],
413
            'Teacher actionsmenu tag with default options (check Show more is not there)' => [
413
            'Teacher actionsmenu tag with default options (check Show more is not there)' => [
414
                'templatecontent' => 'Some ##actionsmenu## tag',
414
                'templatecontent' => 'Some ##actionsmenu## tag',
415
                'expected' => '|^Some((?!Show more).)*tag$|',
415
                'expected' => '|^Some((?!Show more).)*tag$|',
Línea 721... Línea 721...
721
                'enableratings' => true,
721
                'enableratings' => true,
722
                'options' => ['ratings' => true]
722
                'options' => ['ratings' => true]
723
            ],
723
            ],
724
            'Student actionsmenu tag with default options' => [
724
            'Student actionsmenu tag with default options' => [
725
                'templatecontent' => 'Some ##actionsmenu## tag',
725
                'templatecontent' => 'Some ##actionsmenu## tag',
726
                'expected' => '|Some .*edit.*{entryid}.*sesskey.*Edit.* .*delete.*{entryid}.*sesskey.*Delete.* tag|',
726
                'expected' => '|Some .*edit.*{entryid}.*Edit.* .*delete.*{entryid}.*Delete.* tag|',
727
                'rolename' => 'student',
727
                'rolename' => 'student',
728
            ],
728
            ],
729
            'Student actionsmenu tag with default options (check Show more is not there)' => [
729
            'Student actionsmenu tag with default options (check Show more is not there)' => [
730
                'templatecontent' => 'Some ##actionsmenu## tag',
730
                'templatecontent' => 'Some ##actionsmenu## tag',
731
                'expected' => '|^Some((?!Show more).)*tag$|',
731
                'expected' => '|^Some((?!Show more).)*tag$|',
Línea 926... Línea 926...
926
    /**
926
    /**
927
     * Data provider for test_parse_add_entry().
927
     * Data provider for test_parse_add_entry().
928
     *
928
     *
929
     * @return array of scenarios
929
     * @return array of scenarios
930
     */
930
     */
931
    public function parse_add_entry_provider(): array {
931
    public static function parse_add_entry_provider(): array {
932
        return [
932
        return [
933
            // Editing an entry.
933
            // Editing an entry.
934
            'Teacher editing entry tags tag' => [
934
            'Teacher editing entry tags tag' => [
935
                'templatecontent' => 'Some ##tags## tag',
935
                'templatecontent' => 'Some ##tags## tag',
936
                'expected' => '|GENERAL.*Some .*select .*tags.*Cats.* tag|',
936
                'expected' => '|GENERAL.*Some .*select .*tags.*Cats.* tag|',