Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
namespace format_theunittest\courseformat;
18
 
19
use core_courseformat\stateupdates;
20
use core_courseformat\stateactions as core_actions;
21
use stdClass;
22
 
23
/**
24
 * Fixture for fake course stateactions testing.
25
 *
26
 * @package    core_course
27
 * @copyright  2021 Sara Arjona (sara@moodle.com)
28
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 */
30
class stateactions extends core_actions {
31
 
32
    /**
33
     * Alternative cm_state state action for testing.
34
     *
35
     * @param stateupdates $updates the affected course elements track
36
     * @param stdClass $course the course object
37
     * @param int[] $ids the list of affected course module ids
38
     * @param int $targetsectionid optional target section id
39
     * @param int $targetcmid optional target cm id
40
     */
41
    public function cm_state(
42
        stateupdates $updates,
43
        stdClass $course,
44
        array $ids,
45
        ?int $targetsectionid = null,
46
        ?int $targetcmid = null
47
    ): void {
48
        $updates->add_cm_create(array_pop($ids));
49
    }
50
 
51
    /**
1441 ariadna 52
     * Alternative create_module state action for testing.
53
     *
54
     * @param stateupdates $updates the affected course elements track
55
     * @param stdClass $course the course object
56
     * @param string $modname the module name
57
     * @param int $targetsectionnum target section number
58
     * @param int|null $targetcmid optional target cm id
59
     */
60
    public function create_module(
61
        stateupdates $updates,
62
        stdClass $course,
63
        string $modname,
64
        int $targetsectionnum,
65
        ?int $targetcmid = null
66
    ): void {
67
    }
68
 
69
    /**
70
     * Alternative new_module state action for testing.
71
     *
72
     * @param stateupdates $updates the affected course elements track
73
     * @param stdClass $course the course object
74
     * @param string $modname the module name
75
     * @param int $targetsectionid target section id
76
     * @param int|null $targetcmid optional target cm id
77
     */
78
    public function new_module(
79
        stateupdates $updates,
80
        stdClass $course,
81
        string $modname,
82
        int $targetsectionid,
83
        ?int $targetcmid = null
84
    ): void {
85
    }
86
 
87
    /**
1 efrain 88
     * Course format custom state action.
89
     *
90
     * @param stateupdates $updates the affected course elements track
91
     * @param stdClass $course the course object
92
     * @param int[] $ids the list of affected course module ids
93
     * @param int $targetsectionid optional target section id
94
     * @param int $targetcmid optional target cm id
95
     */
96
    public function format_do_something(
97
        stateupdates $updates,
98
        stdClass $course,
99
        array $ids,
100
        ?int $targetsectionid = null,
101
        ?int $targetcmid = null
102
    ): void {
103
 
104
        $updates->add_cm_remove(array_pop($ids));
105
    }
106
 
107
    /**
108
     * Course format target section testing action.
109
     *
110
     * @param stateupdates $updates the affected course elements track
111
     * @param stdClass $course the course object
112
     * @param int[] $ids the list of affected course module ids
113
     * @param int $targetsectionid optional target section id
114
     * @param int $targetcmid optional target cm id
115
     */
116
    public function targetsection_test(
117
        stateupdates $updates,
118
        stdClass $course,
119
        array $ids,
120
        ?int $targetsectionid = null,
121
        ?int $targetcmid = null
122
    ): void {
123
 
124
        $updates->add_section_put($targetsectionid);
125
    }
126
 
127
    /**
128
     * Course format target cm testing action.
129
     *
130
     * @param stateupdates $updates the affected course elements track
131
     * @param stdClass $course the course object
132
     * @param int[] $ids the list of affected course module ids
133
     * @param int $targetsectionid optional target section id
134
     * @param int $targetcmid optional target cm id
135
     */
136
    public function targetcm_test(
137
        stateupdates $updates,
138
        stdClass $course,
139
        array $ids,
140
        ?int $targetsectionid = null,
141
        ?int $targetcmid = null
142
    ): void {
143
 
144
        $updates->add_cm_put($targetcmid);
145
    }
146
 
147
}