Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 39... Línea 39...
39
 
39
 
40
    /**
40
    /**
41
     * Test get_plugins_supporting_mobile.
41
     * Test get_plugins_supporting_mobile.
42
     * This is a very basic test because currently there aren't plugins supporting Mobile in core.
42
     * This is a very basic test because currently there aren't plugins supporting Mobile in core.
43
     */
43
     */
44
    public function test_get_plugins_supporting_mobile() {
44
    public function test_get_plugins_supporting_mobile(): void {
45
        $result = external::get_plugins_supporting_mobile();
45
        $result = external::get_plugins_supporting_mobile();
46
        $result = external_api::clean_returnvalue(external::get_plugins_supporting_mobile_returns(), $result);
46
        $result = external_api::clean_returnvalue(external::get_plugins_supporting_mobile_returns(), $result);
47
        $this->assertCount(0, $result['warnings']);
47
        $this->assertCount(0, $result['warnings']);
48
        $this->assertArrayHasKey('plugins', $result);
48
        $this->assertArrayHasKey('plugins', $result);
49
        $this->assertTrue(is_array($result['plugins']));
49
        $this->assertTrue(is_array($result['plugins']));
Línea 50... Línea 50...
50
    }
50
    }
51
 
51
 
Línea 52... Línea 52...
52
    public function test_get_public_config() {
52
    public function test_get_public_config(): void {
53
        global $CFG, $SITE, $OUTPUT;
53
        global $CFG, $SITE, $OUTPUT;
54
 
54
 
Línea 303... Línea 303...
303
    }
303
    }
Línea 304... Línea 304...
304
 
304
 
305
    /*
305
    /*
306
     * Test get_autologin_key.
306
     * Test get_autologin_key.
307
     */
307
     */
308
    public function test_get_autologin_key() {
308
    public function test_get_autologin_key(): void {
Línea 309... Línea 309...
309
        global $DB, $CFG, $USER;
309
        global $DB, $CFG, $USER;
Línea 310... Línea 310...
310
 
310
 
Línea 347... Línea 347...
347
    }
347
    }
Línea 348... Línea 348...
348
 
348
 
349
    /**
349
    /**
350
     * Test get_autologin_key missing ws.
350
     * Test get_autologin_key missing ws.
351
     */
351
     */
352
    public function test_get_autologin_key_missing_ws() {
352
    public function test_get_autologin_key_missing_ws(): void {
353
        global $CFG;
353
        global $CFG;
Línea 354... Línea 354...
354
        $this->resetAfterTest(true);
354
        $this->resetAfterTest(true);
355
 
355
 
Línea 368... Línea 368...
368
    }
368
    }
Línea 369... Línea 369...
369
 
369
 
370
    /**
370
    /**
371
     * Test get_autologin_key missing https.
371
     * Test get_autologin_key missing https.
372
     */
372
     */
373
    public function test_get_autologin_key_missing_https() {
373
    public function test_get_autologin_key_missing_https(): void {
Línea 374... Línea 374...
374
        global $CFG;
374
        global $CFG;
375
 
375
 
376
        // Fake the app.
376
        // Fake the app.
Línea 389... Línea 389...
389
    }
389
    }
Línea 390... Línea 390...
390
 
390
 
391
    /**
391
    /**
392
     * Test get_autologin_key missing admin.
392
     * Test get_autologin_key missing admin.
393
     */
393
     */
394
    public function test_get_autologin_key_missing_admin() {
394
    public function test_get_autologin_key_missing_admin(): void {
Línea 395... Línea 395...
395
        global $CFG;
395
        global $CFG;
396
 
396
 
Línea 407... Línea 407...
407
    }
407
    }
Línea 408... Línea 408...
408
 
408
 
409
    /**
409
    /**
410
     * Test get_autologin_key locked.
410
     * Test get_autologin_key locked.
411
     */
411
     */
412
    public function test_get_autologin_key_missing_locked() {
412
    public function test_get_autologin_key_missing_locked(): void {
Línea 413... Línea 413...
413
        global $CFG, $DB, $USER;
413
        global $CFG, $DB, $USER;
414
 
414
 
415
        $this->resetAfterTest(true);
415
        $this->resetAfterTest(true);
Línea 450... Línea 450...
450
    }
450
    }
Línea 451... Línea 451...
451
 
451
 
452
    /**
452
    /**
453
     * Test get_autologin_key missing app_request.
453
     * Test get_autologin_key missing app_request.
454
     */
454
     */
455
    public function test_get_autologin_key_missing_app_request() {
455
    public function test_get_autologin_key_missing_app_request(): void {
Línea 456... Línea 456...
456
        global $CFG;
456
        global $CFG;
457
 
457
 
Línea 464... Línea 464...
464
    }
464
    }
Línea 465... Línea 465...
465
 
465
 
466
    /**
466
    /**
467
     * Test get_content.
467
     * Test get_content.
468
     */
468
     */
Línea 469... Línea 469...
469
    public function test_get_content() {
469
    public function test_get_content(): void {
470
 
470
 
471
        $paramval = 16;
471
        $paramval = 16;
472
        $result = external::get_content('tool_mobile', 'test_view', array(array('name' => 'param1', 'value' => $paramval)));
472
        $result = external::get_content('tool_mobile', 'test_view', array(array('name' => 'param1', 'value' => $paramval)));
Línea 487... Línea 487...
487
    }
487
    }
Línea 488... Línea 488...
488
 
488
 
489
    /**
489
    /**
490
     * Test get_content disabled.
490
     * Test get_content disabled.
491
     */
491
     */
Línea 492... Línea 492...
492
    public function test_get_content_disabled() {
492
    public function test_get_content_disabled(): void {
493
 
493
 
494
        $paramval = 16;
494
        $paramval = 16;
495
        $result = external::get_content('tool_mobile', 'test_view_disabled',
495
        $result = external::get_content('tool_mobile', 'test_view_disabled',
Línea 499... Línea 499...
499
    }
499
    }
Línea 500... Línea 500...
500
 
500
 
501
    /**
501
    /**
502
     * Test get_content non existent function in valid component.
502
     * Test get_content non existent function in valid component.
503
     */
503
     */
Línea 504... Línea 504...
504
    public function test_get_content_non_existent_function() {
504
    public function test_get_content_non_existent_function(): void {
505
 
505
 
506
        $this->expectException('coding_exception');
506
        $this->expectException('coding_exception');
Línea 507... Línea 507...
507
        $result = external::get_content('tool_mobile', 'test_blahblah');
507
        $result = external::get_content('tool_mobile', 'test_blahblah');
508
    }
508
    }
509
 
509
 
510
    /**
510
    /**
Línea 511... Línea 511...
511
     * Test get_content incorrect component.
511
     * Test get_content incorrect component.
512
     */
512
     */
513
    public function test_get_content_invalid_component() {
513
    public function test_get_content_invalid_component(): void {
Línea 514... Línea 514...
514
 
514
 
515
        $this->expectException('moodle_exception');
515
        $this->expectException('moodle_exception');
516
        $result = external::get_content('tool_mobile\hack', 'test_view');
516
        $result = external::get_content('tool_mobile\hack', 'test_view');
517
    }
517
    }
Línea 518... Línea 518...
518
 
518
 
519
    /**
519
    /**
520
     * Test get_content non existent component.
520
     * Test get_content non existent component.
Línea 521... Línea 521...
521
     */
521
     */
522
    public function test_get_content_non_existent_component() {
522
    public function test_get_content_non_existent_component(): void {
Línea 523... Línea 523...
523
 
523
 
Línea 524... Línea 524...
524
        $this->expectException('moodle_exception');
524
        $this->expectException('moodle_exception');
Línea 668... Línea 668...
668
    }
668
    }
Línea 669... Línea 669...
669
 
669
 
670
    /*
670
    /*
671
     * Test get_tokens_for_qr_login.
671
     * Test get_tokens_for_qr_login.
672
     */
672
     */
673
    public function test_get_tokens_for_qr_login() {
673
    public function test_get_tokens_for_qr_login(): void {
Línea 674... Línea 674...
674
        global $DB, $CFG, $USER;
674
        global $DB, $CFG, $USER;
Línea 675... Línea 675...
675
 
675
 
Línea 704... Línea 704...
704
    }
704
    }
Línea 705... Línea 705...
705
 
705
 
706
    /*
706
    /*
707
     * Test get_tokens_for_qr_login ignore ip check.
707
     * Test get_tokens_for_qr_login ignore ip check.
708
     */
708
     */
709
    public function test_get_tokens_for_qr_login_ignore_ip_check() {
709
    public function test_get_tokens_for_qr_login_ignore_ip_check(): void {
Línea 710... Línea 710...
710
        global $DB, $CFG, $USER;
710
        global $DB, $CFG, $USER;
Línea 711... Línea 711...
711
 
711
 
Línea 743... Línea 743...
743
    }
743
    }
Línea 744... Línea 744...
744
 
744
 
745
    /*
745
    /*
746
     * Test get_tokens_for_qr_login ip check fails.
746
     * Test get_tokens_for_qr_login ip check fails.
747
     */
747
     */
748
    public function test_get_tokens_for_qr_login_ip_check_mismatch() {
748
    public function test_get_tokens_for_qr_login_ip_check_mismatch(): void {
Línea 749... Línea 749...
749
        global $DB, $CFG, $USER;
749
        global $DB, $CFG, $USER;
Línea 750... Línea 750...
750
 
750
 
Línea 774... Línea 774...
774
    }
774
    }
Línea 775... Línea 775...
775
 
775
 
776
    /**
776
    /**
777
     * Test get_tokens_for_qr_login missing QR code enabled.
777
     * Test get_tokens_for_qr_login missing QR code enabled.
778
     */
778
     */
779
    public function test_get_tokens_for_qr_login_missing_enableqr() {
779
    public function test_get_tokens_for_qr_login_missing_enableqr(): void {
780
        global $CFG, $USER;
780
        global $CFG, $USER;
781
        $this->resetAfterTest(true);
781
        $this->resetAfterTest(true);
Línea 782... Línea 782...
782
        $this->setAdminUser();
782
        $this->setAdminUser();
Línea 788... Línea 788...
788
    }
788
    }
Línea 789... Línea 789...
789
 
789
 
790
    /**
790
    /**
791
     * Test get_tokens_for_qr_login missing ws.
791
     * Test get_tokens_for_qr_login missing ws.
792
     */
792
     */
793
    public function test_get_tokens_for_qr_login_missing_ws() {
793
    public function test_get_tokens_for_qr_login_missing_ws(): void {
794
        global $CFG;
794
        global $CFG;
Línea 795... Línea 795...
795
        $this->resetAfterTest(true);
795
        $this->resetAfterTest(true);
796
 
796
 
Línea 812... Línea 812...
812
    }
812
    }
Línea 813... Línea 813...
813
 
813
 
814
    /**
814
    /**
815
     * Test get_tokens_for_qr_login missing https.
815
     * Test get_tokens_for_qr_login missing https.
816
     */
816
     */
817
    public function test_get_tokens_for_qr_login_missing_https() {
817
    public function test_get_tokens_for_qr_login_missing_https(): void {
Línea 818... Línea 818...
818
        global $CFG, $USER;
818
        global $CFG, $USER;
819
 
819
 
820
        // Fake the app.
820
        // Fake the app.
Línea 833... Línea 833...
833
    }
833
    }
Línea 834... Línea 834...
834
 
834
 
835
    /**
835
    /**
836
     * Test get_tokens_for_qr_login missing admin.
836
     * Test get_tokens_for_qr_login missing admin.
837
     */
837
     */
838
    public function test_get_tokens_for_qr_login_missing_admin() {
838
    public function test_get_tokens_for_qr_login_missing_admin(): void {
Línea 839... Línea 839...
839
        global $CFG, $USER;
839
        global $CFG, $USER;
840
 
840
 
Línea 851... Línea 851...
851
    }
851
    }
Línea 852... Línea 852...
852
 
852
 
853
    /**
853
    /**
854
     * Test get_tokens_for_qr_login missing app_request.
854
     * Test get_tokens_for_qr_login missing app_request.
855
     */
855
     */
856
    public function test_get_tokens_for_qr_login_missing_app_request() {
856
    public function test_get_tokens_for_qr_login_missing_app_request(): void {
Línea 857... Línea 857...
857
        global $CFG, $USER;
857
        global $CFG, $USER;
858
 
858
 
Línea 865... Línea 865...
865
    }
865
    }
Línea 866... Línea 866...
866
 
866
 
867
    /**
867
    /**
868
     * Test validate subscription key.
868
     * Test validate subscription key.
869
     */
869
     */
870
    public function test_validate_subscription_key_valid() {
870
    public function test_validate_subscription_key_valid(): void {
Línea 871... Línea 871...
871
        $this->resetAfterTest(true);
871
        $this->resetAfterTest(true);
872
 
872
 
Línea 880... Línea 880...
880
    }
880
    }
Línea 881... Línea 881...
881
 
881
 
882
    /**
882
    /**
883
     * Test validate subscription key invalid first and then a valid one.
883
     * Test validate subscription key invalid first and then a valid one.
884
     */
884
     */
885
    public function test_validate_subscription_key_invalid_key_first() {
885
    public function test_validate_subscription_key_invalid_key_first(): void {
Línea 886... Línea 886...
886
        $this->resetAfterTest(true);
886
        $this->resetAfterTest(true);
887
 
887
 
Línea 901... Línea 901...
901
    }
901
    }
Línea 902... Línea 902...
902
 
902
 
903
    /**
903
    /**
904
     * Test validate subscription key invalid.
904
     * Test validate subscription key invalid.
905
     */
905
     */
906
    public function test_validate_subscription_key_invalid_key() {
906
    public function test_validate_subscription_key_invalid_key(): void {
Línea 907... Línea 907...
907
        $this->resetAfterTest(true);
907
        $this->resetAfterTest(true);
908
 
908
 
909
        $result = external::validate_subscription_key('fakekey');
909
        $result = external::validate_subscription_key('fakekey');
Línea 913... Línea 913...
913
    }
913
    }
Línea 914... Línea 914...
914
 
914
 
915
    /**
915
    /**
916
     * Test validate subscription key invalid.
916
     * Test validate subscription key invalid.
917
     */
917
     */
918
    public function test_validate_subscription_key_outdated() {
918
    public function test_validate_subscription_key_outdated(): void {
Línea 919... Línea 919...
919
        $this->resetAfterTest(true);
919
        $this->resetAfterTest(true);
920
 
920