Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 25... Línea 25...
25
 *
25
 *
26
 * @package    mod_h5pactivity
26
 * @package    mod_h5pactivity
27
 * @copyright  2021 Ilya Tregubov <ilya@moodle.com>
27
 * @copyright  2021 Ilya Tregubov <ilya@moodle.com>
28
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 */
29
 */
30
class lib_test extends advanced_testcase {
30
final class lib_test extends advanced_testcase {
Línea 31... Línea 31...
31
 
31
 
32
    /**
32
    /**
33
     * Load required test libraries
33
     * Load required test libraries
34
     */
34
     */
Línea 40... Línea 40...
40
    /**
40
    /**
41
     * Test that h5pactivity_delete_instance removes data.
41
     * Test that h5pactivity_delete_instance removes data.
42
     *
42
     *
43
     * @covers ::h5pactivity_delete_instance
43
     * @covers ::h5pactivity_delete_instance
44
     */
44
     */
45
    public function test_h5pactivity_delete_instance() {
45
    public function test_h5pactivity_delete_instance(): void {
46
        global $DB;
46
        global $DB;
47
        $this->resetAfterTest();
47
        $this->resetAfterTest();
48
        $this->setAdminUser();
48
        $this->setAdminUser();
Línea 49... Línea 49...
49
 
49
 
Línea 77... Línea 77...
77
            'contextid' => \context_module::instance($activity->cmid)->id,
77
            'contextid' => \context_module::instance($activity->cmid)->id,
78
            'component' => 'mod_h5pactivity',
78
            'component' => 'mod_h5pactivity',
79
            'filearea' => 'package',
79
            'filearea' => 'package',
80
            'itemid' => 0,
80
            'itemid' => 0,
81
            'filepath' => '/',
81
            'filepath' => '/',
82
            'filepath' => '/',
-
 
83
            'filename' => 'dummy.h5p',
82
            'filename' => 'dummy.h5p',
84
            'addxapistate' => true,
83
            'addxapistate' => true,
85
        ];
84
        ];
86
        $h5pgenerator->generate_h5p_data(false, $filerecord);
85
        $h5pgenerator->generate_h5p_data(false, $filerecord);
Línea 109... Línea 108...
109
    /**
108
    /**
110
     * Test that assign_print_recent_activity shows ungraded submitted assignments.
109
     * Test that assign_print_recent_activity shows ungraded submitted assignments.
111
     *
110
     *
112
     * @covers ::h5pactivity_print_recent_activity
111
     * @covers ::h5pactivity_print_recent_activity
113
     */
112
     */
114
    public function test_print_recent_activity() {
113
    public function test_print_recent_activity(): void {
115
        $this->resetAfterTest();
114
        $this->resetAfterTest();
116
        $this->setAdminUser();
115
        $this->setAdminUser();
Línea 117... Línea 116...
117
 
116
 
118
        $course = $this->getDataGenerator()->create_course();
117
        $course = $this->getDataGenerator()->create_course();
Línea 136... Línea 135...
136
    /**
135
    /**
137
     * Test that h5pactivity_print_recent_activity does not display any warnings when a custom fullname has been configured.
136
     * Test that h5pactivity_print_recent_activity does not display any warnings when a custom fullname has been configured.
138
     *
137
     *
139
     * @covers ::h5pactivity_print_recent_activity
138
     * @covers ::h5pactivity_print_recent_activity
140
     */
139
     */
141
    public function test_print_recent_activity_fullname() {
140
    public function test_print_recent_activity_fullname(): void {
142
        $this->resetAfterTest();
141
        $this->resetAfterTest();
143
        $this->setAdminUser();
142
        $this->setAdminUser();
Línea 144... Línea 143...
144
 
143
 
145
        $course = $this->getDataGenerator()->create_course();
144
        $course = $this->getDataGenerator()->create_course();
Línea 167... Línea 166...
167
    /**
166
    /**
168
     * Test that h5pactivity_get_recent_mod_activity fetches the h5pactivity correctly.
167
     * Test that h5pactivity_get_recent_mod_activity fetches the h5pactivity correctly.
169
     *
168
     *
170
     * @covers ::h5pactivity_get_recent_mod_activity
169
     * @covers ::h5pactivity_get_recent_mod_activity
171
     */
170
     */
172
    public function test_h5pactivity_get_recent_mod_activity() {
171
    public function test_h5pactivity_get_recent_mod_activity(): void {
173
        $this->resetAfterTest();
172
        $this->resetAfterTest();
174
        $this->setAdminUser();
173
        $this->setAdminUser();
Línea 175... Línea 174...
175
 
174
 
176
        $course = $this->getDataGenerator()->create_course();
175
        $course = $this->getDataGenerator()->create_course();
Línea 207... Línea 206...
207
    /**
206
    /**
208
     * Test that h5pactivity_get_recent_mod_activity fetches activity correctly.
207
     * Test that h5pactivity_get_recent_mod_activity fetches activity correctly.
209
     *
208
     *
210
     * @covers ::h5pactivity_fetch_recent_activity
209
     * @covers ::h5pactivity_fetch_recent_activity
211
     */
210
     */
212
    public function test_h5pactivity_fetch_recent_activity() {
211
    public function test_h5pactivity_fetch_recent_activity(): void {
213
        global $DB;
212
        global $DB;
Línea 214... Línea 213...
214
 
213
 
215
        $this->resetAfterTest();
214
        $this->resetAfterTest();
Línea 334... Línea 333...
334
    /**
333
    /**
335
     * Test that h5pactivity_reset_userdata reset user data.
334
     * Test that h5pactivity_reset_userdata reset user data.
336
     *
335
     *
337
     * @covers ::h5pactivity_reset_userdata
336
     * @covers ::h5pactivity_reset_userdata
338
     */
337
     */
339
    public function test_h5pactivity_reset_userdata() {
338
    public function test_h5pactivity_reset_userdata(): void {
340
        global $DB;
339
        global $DB;
341
        $this->resetAfterTest();
340
        $this->resetAfterTest();
342
        $this->setAdminUser();
341
        $this->setAdminUser();
Línea 343... Línea 342...
343
 
342
 
Línea 371... Línea 370...
371
            'contextid' => \context_module::instance($activity->cmid)->id,
370
            'contextid' => \context_module::instance($activity->cmid)->id,
372
            'component' => 'mod_h5pactivity',
371
            'component' => 'mod_h5pactivity',
373
            'filearea' => 'package',
372
            'filearea' => 'package',
374
            'itemid' => 0,
373
            'itemid' => 0,
375
            'filepath' => '/',
374
            'filepath' => '/',
376
            'filepath' => '/',
-
 
377
            'filename' => 'dummy.h5p',
375
            'filename' => 'dummy.h5p',
378
            'addxapistate' => true,
376
            'addxapistate' => true,
379
        ];
377
        ];
380
        $h5pgenerator->generate_h5p_data(false, $filerecord);
378
        $h5pgenerator->generate_h5p_data(false, $filerecord);