Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 29... Línea 29...
29
class api_test extends \advanced_testcase {
29
class api_test extends \advanced_testcase {
Línea 30... Línea 30...
30
 
30
 
31
    /**
31
    /**
32
     * Test the common operations with a policy document and its versions.
32
     * Test the common operations with a policy document and its versions.
33
     */
33
     */
34
    public function test_policy_document_life_cycle() {
34
    public function test_policy_document_life_cycle(): void {
35
        $this->resetAfterTest();
35
        $this->resetAfterTest();
Línea 36... Línea 36...
36
        $this->setAdminUser();
36
        $this->setAdminUser();
37
 
37
 
Línea 132... Línea 132...
132
    }
132
    }
Línea 133... Línea 133...
133
 
133
 
134
    /**
134
    /**
135
     * Test changing the sort order of the policy documents.
135
     * Test changing the sort order of the policy documents.
136
     */
136
     */
137
    public function test_policy_sortorder() {
137
    public function test_policy_sortorder(): void {
138
        global $DB;
138
        global $DB;
139
        $this->resetAfterTest();
139
        $this->resetAfterTest();
Línea 140... Línea 140...
140
        $this->setAdminUser();
140
        $this->setAdminUser();
Línea 191... Línea 191...
191
    }
191
    }
Línea 192... Línea 192...
192
 
192
 
193
    /**
193
    /**
194
     * Test that list of policies can be filtered by audience
194
     * Test that list of policies can be filtered by audience
195
     */
195
     */
196
    public function test_list_policies_audience() {
196
    public function test_list_policies_audience(): void {
197
        $this->resetAfterTest();
197
        $this->resetAfterTest();
Línea 198... Línea 198...
198
        $this->setAdminUser();
198
        $this->setAdminUser();
199
 
199
 
Línea 233... Línea 233...
233
    }
233
    }
Línea 234... Línea 234...
234
 
234
 
235
    /**
235
    /**
236
     * Test behaviour of the {@link api::can_user_view_policy_version()} method.
236
     * Test behaviour of the {@link api::can_user_view_policy_version()} method.
237
     */
237
     */
238
    public function test_can_user_view_policy_version() {
238
    public function test_can_user_view_policy_version(): void {
239
        global $CFG;
239
        global $CFG;
240
        $this->resetAfterTest();
240
        $this->resetAfterTest();
Línea 241... Línea 241...
241
        $this->setAdminUser();
241
        $this->setAdminUser();
Línea 311... Línea 311...
311
    }
311
    }
Línea 312... Línea 312...
312
 
312
 
313
    /**
313
    /**
314
     * Test behaviour of the {@link api::can_accept_policies()} method.
314
     * Test behaviour of the {@link api::can_accept_policies()} method.
315
     */
315
     */
316
    public function test_can_accept_policies() {
316
    public function test_can_accept_policies(): void {
Línea 317... Línea 317...
317
        global $CFG;
317
        global $CFG;
318
 
318
 
Línea 387... Línea 387...
387
    }
387
    }
Línea 388... Línea 388...
388
 
388
 
389
    /**
389
    /**
390
     * Test behaviour of the {@link api::can_decline_policies()} method.
390
     * Test behaviour of the {@link api::can_decline_policies()} method.
391
     */
391
     */
392
    public function test_can_decline_policies() {
392
    public function test_can_decline_policies(): void {
Línea 393... Línea 393...
393
        global $CFG;
393
        global $CFG;
394
 
394
 
Línea 469... Línea 469...
469
    }
469
    }
Línea 470... Línea 470...
470
 
470
 
471
    /**
471
    /**
472
     * Test behaviour of the {@link api::can_revoke_policies()} method.
472
     * Test behaviour of the {@link api::can_revoke_policies()} method.
473
     */
473
     */
474
    public function test_can_revoke_policies() {
474
    public function test_can_revoke_policies(): void {
Línea 475... Línea 475...
475
        global $CFG;
475
        global $CFG;
476
 
476
 
Línea 551... Línea 551...
551
    }
551
    }
Línea 552... Línea 552...
552
 
552
 
553
    /**
553
    /**
554
     * Test {@link api::fix_revision_values()} behaviour.
554
     * Test {@link api::fix_revision_values()} behaviour.
555
     */
555
     */
556
    public function test_fix_revision_values() {
556
    public function test_fix_revision_values(): void {
557
        $this->resetAfterTest();
557
        $this->resetAfterTest();
Línea 558... Línea 558...
558
        $this->setAdminUser();
558
        $this->setAdminUser();
559
 
559
 
Línea 576... Línea 576...
576
    }
576
    }
Línea 577... Línea 577...
577
 
577
 
578
    /**
578
    /**
579
     * Test that accepting policy updates 'policyagreed'
579
     * Test that accepting policy updates 'policyagreed'
580
     */
580
     */
581
    public function test_accept_policies() {
581
    public function test_accept_policies(): void {
582
        global $DB, $USER;
582
        global $DB, $USER;
583
        $this->resetAfterTest();
583
        $this->resetAfterTest();
Línea 584... Línea 584...
584
        $this->setAdminUser();
584
        $this->setAdminUser();
Línea 632... Línea 632...
632
    }
632
    }
Línea 633... Línea 633...
633
 
633
 
634
    /**
634
    /**
635
     * Test that activating a new policy resets everybody's policyagreed flag in the database.
635
     * Test that activating a new policy resets everybody's policyagreed flag in the database.
636
     */
636
     */
637
    public function test_reset_policyagreed() {
637
    public function test_reset_policyagreed(): void {
638
        global $DB;
638
        global $DB;
639
        $this->resetAfterTest();
639
        $this->resetAfterTest();
Línea 640... Línea 640...
640
        $this->setAdminUser();
640
        $this->setAdminUser();
Línea 676... Línea 676...
676
    }
676
    }
Línea 677... Línea 677...
677
 
677
 
678
    /**
678
    /**
679
     * Test behaviour of the {@link api::get_user_minors()} method.
679
     * Test behaviour of the {@link api::get_user_minors()} method.
680
     */
680
     */
681
    public function test_get_user_minors() {
681
    public function test_get_user_minors(): void {
Línea 682... Línea 682...
682
        $this->resetAfterTest();
682
        $this->resetAfterTest();
683
 
683
 
684
        // A mother having two children, each child having own father.
684
        // A mother having two children, each child having own father.
Línea 725... Línea 725...
725
    }
725
    }
Línea 726... Línea 726...
726
 
726
 
727
    /**
727
    /**
728
     * Test behaviour of the {@link api::create_acceptances_user_created()} method.
728
     * Test behaviour of the {@link api::create_acceptances_user_created()} method.
729
     */
729
     */
730
    public function test_create_acceptances_user_created() {
730
    public function test_create_acceptances_user_created(): void {
731
        global $CFG, $DB;
731
        global $CFG, $DB;
732
        $this->resetAfterTest();
732
        $this->resetAfterTest();
Línea 733... Línea 733...
733
        $this->setAdminUser();
733
        $this->setAdminUser();
Línea 754... Línea 754...
754
    }
754
    }
Línea 755... Línea 755...
755
 
755
 
756
    /**
756
    /**
757
     * Test that user can login if sitepolicyhandler is set but there are no policies.
757
     * Test that user can login if sitepolicyhandler is set but there are no policies.
758
     */
758
     */
759
    public function test_login_with_handler_without_policies() {
759
    public function test_login_with_handler_without_policies(): void {
Línea 760... Línea 760...
760
        global $CFG;
760
        global $CFG;
761
 
761
 
762
        $this->resetAfterTest();
762
        $this->resetAfterTest();
Línea 769... Línea 769...
769
    }
769
    }
Línea 770... Línea 770...
770
 
770
 
771
    /**
771
    /**
772
     * Test the three-state logic of the value returned by {@link api::is_user_version_accepted()}.
772
     * Test the three-state logic of the value returned by {@link api::is_user_version_accepted()}.
773
     */
773
     */
Línea 774... Línea 774...
774
    public function test_is_user_version_accepted() {
774
    public function test_is_user_version_accepted(): void {
775
 
775
 
776
        $preloadedacceptances = [
776
        $preloadedacceptances = [
777
            4 => (object) [
777
            4 => (object) [
Línea 792... Línea 792...
792
    }
792
    }
Línea 793... Línea 793...
793
 
793
 
794
    /**
794
    /**
795
     * Test the functionality of {@link api::get_agreement_optional()}.
795
     * Test the functionality of {@link api::get_agreement_optional()}.
796
     */
796
     */
797
    public function test_get_agreement_optional() {
797
    public function test_get_agreement_optional(): void {
798
        global $DB;
798
        global $DB;
799
        $this->resetAfterTest();
799
        $this->resetAfterTest();
Línea 800... Línea 800...
800
        $this->setAdminUser();
800
        $this->setAdminUser();