Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 26... Línea 26...
26
 * @covers     \mod_h5pactivity\local\manager
26
 * @covers     \mod_h5pactivity\local\manager
27
 * @category   test
27
 * @category   test
28
 * @copyright  2020 Ferran Recio <ferran@moodle.com>
28
 * @copyright  2020 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
 */
30
 */
31
class manager_test extends \advanced_testcase {
31
final class manager_test extends \advanced_testcase {
Línea 32... Línea 32...
32
 
32
 
33
    /**
33
    /**
34
     * Test for static create methods.
34
     * Test for static create methods.
35
     */
35
     */
Línea 98... Línea 98...
98
    /**
98
    /**
99
     * Data provider for test_is_tracking_enabled_and_can_submit.
99
     * Data provider for test_is_tracking_enabled_and_can_submit.
100
     *
100
     *
101
     * @return array
101
     * @return array
102
     */
102
     */
103
    public function is_tracking_enabled_data(): array {
103
    public static function is_tracking_enabled_data(): array {
104
        return [
104
        return [
105
            'Logged student, tracking enabled' => [
105
            'Logged student, tracking enabled' => [
106
                true, 'student', 1, true, true,
106
                true, 'student', 1, true, true,
107
            ],
107
            ],
108
            'Logged student, tracking disabled' => [
108
            'Logged student, tracking disabled' => [
Línea 212... Línea 212...
212
    /**
212
    /**
213
     * Data provider for get_users_scaled_score.
213
     * Data provider for get_users_scaled_score.
214
     *
214
     *
215
     * @return array
215
     * @return array
216
     */
216
     */
217
    public function get_users_scaled_score_data(): array {
217
    public static function get_users_scaled_score_data(): array {
218
        return [
218
        return [
219
            'Tracking with max attempt method' => [
219
            'Tracking with max attempt method' => [
220
                1, manager::GRADEHIGHESTATTEMPT, [1.00000, 31, 2], [0.66667, 32, 2]
220
                1, manager::GRADEHIGHESTATTEMPT, [1.00000, 31, 2], [0.66667, 32, 2]
221
            ],
221
            ],
222
            'Tracking with average attempt method' => [
222
            'Tracking with average attempt method' => [
Línea 289... Línea 289...
289
    /**
289
    /**
290
     * Data provider for get_users_scaled_score.
290
     * Data provider for get_users_scaled_score.
291
     *
291
     *
292
     * @return array
292
     * @return array
293
     */
293
     */
294
    public function get_selected_attempt_data(): array {
294
    public static function get_selected_attempt_data(): array {
295
        return [
295
        return [
296
            'Tracking with max attempt method' => [
296
            'Tracking with max attempt method' => [
297
                1, manager::GRADEHIGHESTATTEMPT, manager::GRADEHIGHESTATTEMPT
297
                1, manager::GRADEHIGHESTATTEMPT, manager::GRADEHIGHESTATTEMPT
298
            ],
298
            ],
299
            'Tracking with average attempt method' => [
299
            'Tracking with average attempt method' => [
Línea 398... Línea 398...
398
    /**
398
    /**
399
     * Data provider for test_can_view_all_attempts.
399
     * Data provider for test_can_view_all_attempts.
400
     *
400
     *
401
     * @return array
401
     * @return array
402
     */
402
     */
403
    public function can_view_all_attempts_data(): array {
403
    public static function can_view_all_attempts_data(): array {
404
        return [
404
        return [
405
            // No tracking cases.
405
            // No tracking cases.
406
            'No tracking with admin using $USER' => [
406
            'No tracking with admin using $USER' => [
407
                0, false, false, false
407
                0, false, false, false
408
            ],
408
            ],
Línea 470... Línea 470...
470
    /**
470
    /**
471
     * Data provider for test_can_view_own_attempts.
471
     * Data provider for test_can_view_own_attempts.
472
     *
472
     *
473
     * @return array
473
     * @return array
474
     */
474
     */
475
    public function can_view_own_attempts_data(): array {
475
    public static function can_view_own_attempts_data(): array {
476
        return [
476
        return [
477
            // No tracking cases.
477
            // No tracking cases.
478
            'No tracking, review none, using $USER, without attempts' => [
478
            'No tracking, review none, using $USER, without attempts' => [
479
                0, manager::REVIEWNONE, false, false, false
479
                0, manager::REVIEWNONE, false, false, false
480
            ],
480
            ],
Línea 609... Línea 609...
609
    /**
609
    /**
610
     * Data provider for test_count_attempts_all.
610
     * Data provider for test_count_attempts_all.
611
     *
611
     *
612
     * @return array
612
     * @return array
613
     */
613
     */
614
    public function count_attempts_all_data(): array {
614
    public static function count_attempts_all_data(): array {
615
        return [
615
        return [
616
            'Students with both view and submit capability' => [true, true, false, 6],
616
            'Students with both view and submit capability' => [true, true, false, 6],
617
            'Students without view but with submit capability' => [false, true, false, 0],
617
            'Students without view but with submit capability' => [false, true, false, 0],
618
            'Students with view but without submit capability' => [true, false, false, 6],
618
            'Students with view but without submit capability' => [true, false, false, 6],
619
            'Students without both view and submit capability' => [false, false, false, 0],
619
            'Students without both view and submit capability' => [false, false, false, 0],
Línea 675... Línea 675...
675
    /**
675
    /**
676
     * Data provider for test_get_active_users_join.
676
     * Data provider for test_get_active_users_join.
677
     *
677
     *
678
     * @return array
678
     * @return array
679
     */
679
     */
680
    public function get_active_users_join_data(): array {
680
    public static function get_active_users_join_data(): array {
681
        return [
681
        return [
682
            'All potential users' => [
682
            'All potential users' => [
683
                'allpotentialusers' => true,
683
                'allpotentialusers' => true,
684
                'result' => 3,
684
                'result' => 3,
685
            ],
685
            ],
Línea 920... Línea 920...
920
    /**
920
    /**
921
     * Data provider for test_get_report.
921
     * Data provider for test_get_report.
922
     *
922
     *
923
     * @return array
923
     * @return array
924
     */
924
     */
925
    public function get_report_data(): array {
925
    public static function get_report_data(): array {
926
        return [
926
        return [
927
            // No tracking scenarios.
927
            // No tracking scenarios.
928
            'No tracking, review none, no attempts, teacher' => [
928
            'No tracking, review none, no attempts, teacher' => [
929
                0, manager::REVIEWNONE, false, 'editingteacher', [null, null, null]
929
                0, manager::REVIEWNONE, false, 'editingteacher', [null, null, null]
930
            ],
930
            ],
Línea 1055... Línea 1055...
1055
    /**
1055
    /**
1056
     * Data provider for test_get_report_groupmode.
1056
     * Data provider for test_get_report_groupmode.
1057
     *
1057
     *
1058
     * @return array
1058
     * @return array
1059
     */
1059
     */
1060
    public function get_report_data_groupmode(): array {
1060
    public static function get_report_data_groupmode(): array {
1061
        return [
1061
        return [
1062
            // No tracking scenarios.
1062
            // No tracking scenarios.
1063
            'course groupmode is SEPARATEGROUPS' => [false],
1063
            'course groupmode is SEPARATEGROUPS' => [false],
1064
            'course groupmode is NOGROUPS, activity groupmode is SEPARATEGROUPS' => [true],
1064
            'course groupmode is NOGROUPS, activity groupmode is SEPARATEGROUPS' => [true],
1065
        ];
1065
        ];
Línea 1113... Línea 1113...
1113
    /**
1113
    /**
1114
     * Data provider for test_get_attempt.
1114
     * Data provider for test_get_attempt.
1115
     *
1115
     *
1116
     * @return array
1116
     * @return array
1117
     */
1117
     */
1118
    public function get_attempt_data(): array {
1118
    public static function get_attempt_data(): array {
1119
        return [
1119
        return [
1120
            'Get the current activity attempt' => [
1120
            'Get the current activity attempt' => [
1121
                'current', 'current'
1121
                'current', 'current'
1122
            ],
1122
            ],
1123
            'Try to get another activity attempt' => [
1123
            'Try to get another activity attempt' => [