Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 29... Línea 29...
29
 * @package    core
29
 * @package    core
30
 * @category   test
30
 * @category   test
31
 * @copyright  2012 Tyler Bannister
31
 * @copyright  2012 Tyler Bannister
32
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
33
 */
33
 */
34
class statslib_test extends \advanced_testcase {
34
final class statslib_test extends \advanced_testcase {
35
    /** The day to use for testing **/
35
    /** The day to use for testing **/
36
    const DAY = 1272672000;
36
    const DAY = 1272672000;
Línea 37... Línea 37...
37
 
37
 
38
    /** The timezone to use for testing **/
38
    /** The timezone to use for testing **/
Línea 184... Línea 184...
184
    /**
184
    /**
185
     * Provides the log data for test_statslib_cron_daily.
185
     * Provides the log data for test_statslib_cron_daily.
186
     *
186
     *
187
     * @return array of fixture XML log file names.
187
     * @return array of fixture XML log file names.
188
     */
188
     */
189
    public function daily_log_provider() {
189
    public static function daily_log_provider(): array {
190
        $logfiles = array();
190
        $logfiles = array();
191
        $fileno = array('00', '01', '02', '03', '04', '05', '06', '07', '08');
191
        $fileno = array('00', '01', '02', '03', '04', '05', '06', '07', '08');
Línea 192... Línea 192...
192
 
192
 
193
        foreach ($fileno as $no) {
193
        foreach ($fileno as $no) {
Línea 200... Línea 200...
200
    /**
200
    /**
201
     * Set of data for test_statlibs_get_base_weekly
201
     * Set of data for test_statlibs_get_base_weekly
202
     *
202
     *
203
     * @return array Dates and timezones for which the first day of the week will be calculated
203
     * @return array Dates and timezones for which the first day of the week will be calculated
204
     */
204
     */
205
    public function get_base_weekly_provider() {
205
    public static function get_base_weekly_provider(): array {
206
        return [
206
        return [
207
            [
207
            [
208
                "startwday" => 0,
208
                "startwday" => 0,
209
                "timezone" => 'America/Chicago',
209
                "timezone" => 'America/Chicago',
210
                "timestart" => '18-03-2017 22:00',
210
                "timestart" => '18-03-2017 22:00',
211
                "expected" => '12-03-2017 00:00:00'
211
                "expected" => '12-03-2017 00:00:00'
212
            ],
212
            ],
213
            [
213
            [
214
                "startwday" => 0,
214
                "startwday" => 0,
215
                "timezone" => 'America/Chicago',
215
                "timezone" => 'America/Chicago',
216
                "date" => '25-03-2017 22:00',
216
                "timestart" => '25-03-2017 22:00',
217
                "expected" => '19-03-2017 00:00:00'
217
                "expected" => '19-03-2017 00:00:00'
218
            ],
218
            ],
219
            [
219
            [
220
                "startwday" => 1,
220
                "startwday" => 1,
221
                "timezone" => 'Atlantic/Canary',
221
                "timezone" => 'Atlantic/Canary',
222
                "date" => '06-08-2018 22:00',
222
                "timestart" => '06-08-2018 22:00',
223
                "expected" => '06-08-2018 00:00:00'
223
                "expected" => '06-08-2018 00:00:00'
224
            ],
224
            ],
225
        ];
225
        ];
226
    }
226
    }
Línea 452... Línea 452...
452
     *
452
     *
453
     * Note: The function results depend on installed modules.  The hard coded lists are the
453
     * Note: The function results depend on installed modules.  The hard coded lists are the
454
     *       defaults for a new Moodle 2.3 install.
454
     *       defaults for a new Moodle 2.3 install.
455
     */
455
     */
456
    public function test_statslib_get_action_names(): void {
456
    public function test_statslib_get_action_names(): void {
457
        $basepostactions = array (
457
        $basepostactions = [
458
            0 => 'add',
458
            'add',
459
            1 => 'delete',
459
            'delete',
460
            2 => 'edit',
460
            'edit',
461
            3 => 'add mod',
461
            'add mod',
462
            4 => 'delete mod',
462
            'delete mod',
463
            5 => 'edit sectionenrol',
463
            'edit section',
464
            6 => 'loginas',
464
            'loginas',
465
            7 => 'new',
465
            'new',
466
            8 => 'unenrol',
466
            'unenrol',
467
            9 => 'update',
467
            'update',
468
            10 => 'update mod',
468
            'update mod',
469
            11 => 'upload',
469
            'upload',
470
            12 => 'submit',
470
            'submit',
471
            13 => 'submit for grading',
471
            'submit for grading',
472
            14 => 'talk',
-
 
473
            15 => 'choose',
472
            'choose',
474
            16 => 'choose again',
473
            'choose again',
475
            17 => 'record delete',
474
            'record delete',
476
            18 => 'add discussion',
475
            'add discussion',
477
            19 => 'add post',
476
            'add post',
478
            20 => 'delete discussion',
477
            'delete discussion',
479
            21 => 'delete post',
478
            'delete post',
480
            22 => 'move discussion',
479
            'move discussion',
481
            23 => 'prune post',
480
            'prune post',
482
            24 => 'update post',
481
            'update post',
483
            25 => 'add category',
482
            'add category',
484
            26 => 'add entry',
483
            'add entry',
485
            27 => 'approve entry',
484
            'approve entry',
486
            28 => 'delete category',
485
            'delete category',
487
            29 => 'delete entry',
486
            'delete entry',
488
            30 => 'edit category',
487
            'edit category',
489
            31 => 'update entry',
488
            'update entry',
490
            32 => 'end',
489
            'end',
491
            33 => 'start',
490
            'start',
492
            34 => 'attempt',
491
            'attempt',
493
            35 => 'close attempt',
492
            'close attempt',
494
            36 => 'preview',
493
            'preview',
495
            37 => 'editquestions',
494
            'editquestions',
496
            38 => 'delete attempt',
495
            'delete attempt',
497
            39 => 'manualgrade',
496
            'manualgrade',
-
 
497
            'enrol',
498
        );
498
        ];
Línea 499... Línea 499...
499
 
499
 
500
         $baseviewactions = array (
500
        $baseviewactions = [
501
            0 => 'view',
501
            'view',
502
            1 => 'view all',
502
            'view all',
503
            2 => 'history',
503
            'history',
504
            3 => 'view submission',
504
            'view submission',
505
            4 => 'view feedback',
505
            'view feedback',
506
            5 => 'print',
506
            'print',
507
            6 => 'report',
507
            'report',
508
            7 => 'view discussion',
508
            'view discussion',
509
            8 => 'search',
509
            'search',
510
            9 => 'forum',
510
            'forum',
511
            10 => 'forums',
511
            'forums',
512
            11 => 'subscribers',
512
            'subscribers',
513
            12 => 'view forum',
513
            'view forum',
514
            13 => 'view entry',
514
            'view entry',
515
            14 => 'review',
515
            'review',
516
            15 => 'pre-view',
-
 
517
            16 => 'download',
-
 
518
            17 => 'view form',
-
 
519
            18 => 'view graph',
-
 
520
            19 => 'view report',
516
            'pre-view',
Línea 521... Línea 517...
521
        );
517
        ];
Línea 522... Línea 518...
522
 
518
 
523
        $postactions = stats_get_action_names('post');
519
        $postactions = stats_get_action_names('post');