Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 68... Línea 68...
68
    }
68
    }
Línea 69... Línea 69...
69
 
69
 
70
    /**
70
    /**
71
     * Test update question flag
71
     * Test update question flag
72
     */
72
     */
Línea 73... Línea 73...
73
    public function test_core_question_update_flag() {
73
    public function test_core_question_update_flag(): void {
Línea 74... Línea 74...
74
 
74
 
75
        $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
75
        $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
Línea 193... Línea 193...
193
    public function test_get_random_question_summaries_variations(
193
    public function test_get_random_question_summaries_variations(
194
        $categoryindex,
194
        $categoryindex,
195
        $includesubcategories,
195
        $includesubcategories,
196
        $usetagnames,
196
        $usetagnames,
197
        $expectedquestionindexes
197
        $expectedquestionindexes
198
    ) {
198
    ): void {
199
        $this->resetAfterTest();
199
        $this->resetAfterTest();
Línea 200... Línea 200...
200
 
200
 
201
        $context = \context_system::instance();
201
        $context = \context_system::instance();
202
        $categories = [];
202
        $categories = [];
Línea 255... Línea 255...
255
 
255
 
256
    /**
256
    /**
257
     * get_random_question_summaries should throw an invalid_parameter_exception if not
257
     * get_random_question_summaries should throw an invalid_parameter_exception if not
258
     * given an integer for the category id.
258
     * given an integer for the category id.
259
     */
259
     */
260
    public function test_get_random_question_summaries_invalid_category_id_param() {
260
    public function test_get_random_question_summaries_invalid_category_id_param(): void {
Línea 261... Línea 261...
261
        $this->resetAfterTest();
261
        $this->resetAfterTest();
262
 
262
 
263
        $context = \context_system::instance();
263
        $context = \context_system::instance();
Línea 267... Línea 267...
267
 
267
 
268
    /**
268
    /**
269
     * get_random_question_summaries should throw an invalid_parameter_exception if not
269
     * get_random_question_summaries should throw an invalid_parameter_exception if not
270
     * given a boolean for the $includesubcategories parameter.
270
     * given a boolean for the $includesubcategories parameter.
271
     */
271
     */
272
    public function test_get_random_question_summaries_invalid_includesubcategories_param() {
272
    public function test_get_random_question_summaries_invalid_includesubcategories_param(): void {
Línea 273... Línea 273...
273
        $this->resetAfterTest();
273
        $this->resetAfterTest();
274
 
274
 
275
        $context = \context_system::instance();
275
        $context = \context_system::instance();
Línea 279... Línea 279...
279
 
279
 
280
    /**
280
    /**
281
     * get_random_question_summaries should throw an invalid_parameter_exception if not
281
     * get_random_question_summaries should throw an invalid_parameter_exception if not
282
     * given an array of integers for the tag ids parameter.
282
     * given an array of integers for the tag ids parameter.
283
     */
283
     */
284
    public function test_get_random_question_summaries_invalid_tagids_param() {
284
    public function test_get_random_question_summaries_invalid_tagids_param(): void {
Línea 285... Línea 285...
285
        $this->resetAfterTest();
285
        $this->resetAfterTest();
286
 
286
 
287
        $context = \context_system::instance();
287
        $context = \context_system::instance();
Línea 291... Línea 291...
291
 
291
 
292
    /**
292
    /**
293
     * get_random_question_summaries should throw an invalid_parameter_exception if not
293
     * get_random_question_summaries should throw an invalid_parameter_exception if not
294
     * given a context.
294
     * given a context.
295
     */
295
     */
296
    public function test_get_random_question_summaries_invalid_context() {
296
    public function test_get_random_question_summaries_invalid_context(): void {
Línea 297... Línea 297...
297
        $this->resetAfterTest();
297
        $this->resetAfterTest();
298
 
298
 
299
        $this->expectException('\invalid_parameter_exception');
299
        $this->expectException('\invalid_parameter_exception');
Línea 303... Línea 303...
303
    /**
303
    /**
304
     * get_random_question_summaries should throw an restricted_context_exception
304
     * get_random_question_summaries should throw an restricted_context_exception
305
     * if the given context is outside of the set of restricted contexts the user
305
     * if the given context is outside of the set of restricted contexts the user
306
     * is allowed to call external functions in.
306
     * is allowed to call external functions in.
307
     */
307
     */
308
    public function test_get_random_question_summaries_restricted_context() {
308
    public function test_get_random_question_summaries_restricted_context(): void {
309
        $this->resetAfterTest();
309
        $this->resetAfterTest();
Línea 310... Línea 310...
310
 
310
 
311
        $course = $this->getDataGenerator()->create_course();
311
        $course = $this->getDataGenerator()->create_course();
312
        $coursecontext = \context_course::instance($course->id);
312
        $coursecontext = \context_course::instance($course->id);
Línea 330... Línea 330...
330
    }
330
    }
Línea 331... Línea 331...
331
 
331
 
332
    /**
332
    /**
333
     * get_random_question_summaries should return a question that is formatted correctly.
333
     * get_random_question_summaries should return a question that is formatted correctly.
334
     */
334
     */
335
    public function test_get_random_question_summaries_formats_returned_questions() {
335
    public function test_get_random_question_summaries_formats_returned_questions(): void {
Línea 336... Línea 336...
336
        $this->resetAfterTest();
336
        $this->resetAfterTest();
337
 
337
 
338
        list($category, $questions) = $this->create_category_and_questions(1);
338
        list($category, $questions) = $this->create_category_and_questions(1);
Línea 363... Línea 363...
363
    }
363
    }
Línea 364... Línea 364...
364
 
364
 
365
    /**
365
    /**
366
     * get_random_question_summaries should allow limiting and offsetting of the result set.
366
     * get_random_question_summaries should allow limiting and offsetting of the result set.
367
     */
367
     */
368
    public function test_get_random_question_summaries_with_limit_and_offset() {
368
    public function test_get_random_question_summaries_with_limit_and_offset(): void {
369
        $this->resetAfterTest();
369
        $this->resetAfterTest();
370
        $numberofquestions = 5;
370
        $numberofquestions = 5;
371
        $includesubcategories = false;
371
        $includesubcategories = false;
372
        $tagids = [];
372
        $tagids = [];
Línea 410... Línea 410...
410
 
410
 
411
    /**
411
    /**
412
     * get_random_question_summaries should throw an exception if the user doesn't
412
     * get_random_question_summaries should throw an exception if the user doesn't
413
     * have the capability to use the questions in the requested category.
413
     * have the capability to use the questions in the requested category.
414
     */
414
     */
415
    public function test_get_random_question_summaries_without_capability() {
415
    public function test_get_random_question_summaries_without_capability(): void {
416
        $this->resetAfterTest();
416
        $this->resetAfterTest();
417
        $generator = $this->getDataGenerator();
417
        $generator = $this->getDataGenerator();
418
        $user = $generator->create_user();
418
        $user = $generator->create_user();
419
        $roleid = $generator->create_role();
419
        $roleid = $generator->create_role();