Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 49... Línea 49...
49
    }
49
    }
Línea 50... Línea 50...
50
 
50
 
51
    /**
51
    /**
52
     * Test for data_connector::loadToolConsumer().
52
     * Test for data_connector::loadToolConsumer().
53
     */
53
     */
54
    public function test_load_consumer() {
54
    public function test_load_consumer(): void {
55
        $consumer = new ToolConsumer();
55
        $consumer = new ToolConsumer();
Línea 56... Línea 56...
56
        $dc = new data_connector();
56
        $dc = new data_connector();
57
 
57
 
Línea 112... Línea 112...
112
    }
112
    }
Línea 113... Línea 113...
113
 
113
 
114
    /**
114
    /**
115
     * Test for data_connector::saveToolConsumer().
115
     * Test for data_connector::saveToolConsumer().
116
     */
116
     */
117
    public function test_save_consumer() {
117
    public function test_save_consumer(): void {
Línea 118... Línea 118...
118
        $dc = new data_connector();
118
        $dc = new data_connector();
119
 
119
 
120
        $time = time();
120
        $time = time();
Línea 209... Línea 209...
209
    }
209
    }
Línea 210... Línea 210...
210
 
210
 
211
    /**
211
    /**
212
     * Test for data_connector::deleteToolConsumer().
212
     * Test for data_connector::deleteToolConsumer().
213
     */
213
     */
214
    public function test_delete_tool_consumer() {
214
    public function test_delete_tool_consumer(): void {
215
        $dc = new data_connector();
215
        $dc = new data_connector();
216
        $data = [
216
        $data = [
217
            'name' => 'TestName',
217
            'name' => 'TestName',
218
            'secret' => 'TestSecret',
218
            'secret' => 'TestSecret',
Línea 288... Línea 288...
288
    }
288
    }
Línea 289... Línea 289...
289
 
289
 
290
    /**
290
    /**
291
     * Test for data_connector::getToolConsumers().
291
     * Test for data_connector::getToolConsumers().
292
     */
292
     */
293
    public function test_get_tool_consumers() {
293
    public function test_get_tool_consumers(): void {
Línea 294... Línea 294...
294
        $dc = new data_connector();
294
        $dc = new data_connector();
295
 
295
 
296
        $consumers = $dc->getToolConsumers();
296
        $consumers = $dc->getToolConsumers();
Línea 329... Línea 329...
329
    }
329
    }
Línea 330... Línea 330...
330
 
330
 
331
    /**
331
    /**
332
     * Test for data_connector::loadToolProxy().
332
     * Test for data_connector::loadToolProxy().
333
     */
333
     */
334
    public function test_get_tool_proxy() {
334
    public function test_get_tool_proxy(): void {
335
        $dc = new data_connector();
335
        $dc = new data_connector();
336
        $toolproxy = new ToolProxy($dc);
336
        $toolproxy = new ToolProxy($dc);
337
        $this->assertFalse($dc->loadToolProxy($toolproxy));
337
        $this->assertFalse($dc->loadToolProxy($toolproxy));
Línea 338... Línea 338...
338
    }
338
    }
339
 
339
 
340
    /**
340
    /**
341
     * Test for data_connector::saveToolProxy().
341
     * Test for data_connector::saveToolProxy().
342
     */
342
     */
343
    public function test_save_tool_proxy() {
343
    public function test_save_tool_proxy(): void {
344
        $dc = new data_connector();
344
        $dc = new data_connector();
345
        $toolproxy = new ToolProxy($dc);
345
        $toolproxy = new ToolProxy($dc);
Línea 346... Línea 346...
346
        $this->assertFalse($dc->saveToolProxy($toolproxy));
346
        $this->assertFalse($dc->saveToolProxy($toolproxy));
347
    }
347
    }
348
 
348
 
349
    /**
349
    /**
350
     * Test for data_connector::deleteToolProxy().
350
     * Test for data_connector::deleteToolProxy().
351
     */
351
     */
352
    public function test_delete_tool_proxy() {
352
    public function test_delete_tool_proxy(): void {
353
        $dc = new data_connector();
353
        $dc = new data_connector();
Línea 354... Línea 354...
354
        $toolproxy = new ToolProxy($dc);
354
        $toolproxy = new ToolProxy($dc);
355
        $this->assertFalse($dc->deleteToolProxy($toolproxy));
355
        $this->assertFalse($dc->deleteToolProxy($toolproxy));
356
    }
356
    }
357
 
357
 
358
    /**
358
    /**
359
     * Test for data_connector::loadContext().
359
     * Test for data_connector::loadContext().
360
     */
360
     */
361
    public function test_load_context() {
361
    public function test_load_context(): void {
362
        $dc = new data_connector();
362
        $dc = new data_connector();
Línea 392... Línea 392...
392
    }
392
    }
Línea 393... Línea 393...
393
 
393
 
394
    /**
394
    /**
395
     * Test for data_connector::saveContext().
395
     * Test for data_connector::saveContext().
396
     */
396
     */
397
    public function test_save_context() {
397
    public function test_save_context(): void {
398
        $dc = new data_connector();
398
        $dc = new data_connector();
399
        $consumer = new ToolConsumer(null, $dc);
399
        $consumer = new ToolConsumer(null, $dc);
400
        $consumer->name = 'testconsumername';
400
        $consumer->name = 'testconsumername';
401
        $consumer->setKey('TestKey');
401
        $consumer->setKey('TestKey');
Línea 444... Línea 444...
444
    }
444
    }
Línea 445... Línea 445...
445
 
445
 
446
    /**
446
    /**
447
     * Test for data_connector::deleteContext().
447
     * Test for data_connector::deleteContext().
448
     */
448
     */
449
    public function test_delete_context() {
449
    public function test_delete_context(): void {
450
        $dc = new data_connector();
450
        $dc = new data_connector();
451
        $consumer = new ToolConsumer(null, $dc);
451
        $consumer = new ToolConsumer(null, $dc);
452
        $consumer->name = 'testconsumername';
452
        $consumer->name = 'testconsumername';
453
        $consumer->setKey('TestKey');
453
        $consumer->setKey('TestKey');
Línea 521... Línea 521...
521
    }
521
    }
Línea 522... Línea 522...
522
 
522
 
523
    /**
523
    /**
524
     * Test for data_connector::loadResourceLink().
524
     * Test for data_connector::loadResourceLink().
525
     */
525
     */
526
    public function test_load_resource_link() {
526
    public function test_load_resource_link(): void {
Línea 527... Línea 527...
527
        $dc = new data_connector();
527
        $dc = new data_connector();
528
 
528
 
529
        // Consumer for the resource link.
529
        // Consumer for the resource link.
Línea 580... Línea 580...
580
    }
580
    }
Línea 581... Línea 581...
581
 
581
 
582
    /**
582
    /**
583
     * Test for data_connector::saveResourceLink().
583
     * Test for data_connector::saveResourceLink().
584
     */
584
     */
585
    public function test_save_resource_link() {
585
    public function test_save_resource_link(): void {
Línea 586... Línea 586...
586
        $dc = new data_connector();
586
        $dc = new data_connector();
587
 
587
 
588
        // Consumer for the resource link.
588
        // Consumer for the resource link.
Línea 646... Línea 646...
646
    }
646
    }
Línea 647... Línea 647...
647
 
647
 
648
    /**
648
    /**
649
     * Test for data_connector::deleteResourceLink().
649
     * Test for data_connector::deleteResourceLink().
650
     */
650
     */
651
    public function test_delete_resource_link() {
651
    public function test_delete_resource_link(): void {
652
        $dc = new data_connector();
652
        $dc = new data_connector();
653
        $consumer = new ToolConsumer(null, $dc);
653
        $consumer = new ToolConsumer(null, $dc);
654
        $consumer->name = 'testconsumername';
654
        $consumer->name = 'testconsumername';
655
        $consumer->setKey('TestKey');
655
        $consumer->setKey('TestKey');
Línea 705... Línea 705...
705
    }
705
    }
Línea 706... Línea 706...
706
 
706
 
707
    /**
707
    /**
708
     * Test for data_connector::getUserResultSourcedIDsResourceLink().
708
     * Test for data_connector::getUserResultSourcedIDsResourceLink().
709
     */
709
     */
710
    public function test_get_user_result_sourced_ids_resource_link() {
710
    public function test_get_user_result_sourced_ids_resource_link(): void {
711
        $dc = new data_connector();
711
        $dc = new data_connector();
712
        $consumer = new ToolConsumer(null, $dc);
712
        $consumer = new ToolConsumer(null, $dc);
713
        $consumer->name = 'testconsumername';
713
        $consumer->name = 'testconsumername';
714
        $consumer->setKey('TestKey');
714
        $consumer->setKey('TestKey');
Línea 762... Línea 762...
762
    }
762
    }
Línea 763... Línea 763...
763
 
763
 
764
    /**
764
    /**
765
     * Test for data_connector::getSharesResourceLink().
765
     * Test for data_connector::getSharesResourceLink().
766
     */
766
     */
767
    public function test_get_shares_resource_link() {
767
    public function test_get_shares_resource_link(): void {
768
        $dc = new data_connector();
768
        $dc = new data_connector();
769
        $consumer = new ToolConsumer(null, $dc);
769
        $consumer = new ToolConsumer(null, $dc);
770
        $consumer->name = 'testconsumername';
770
        $consumer->name = 'testconsumername';
771
        $consumer->setKey('TestKey');
771
        $consumer->setKey('TestKey');
Línea 812... Línea 812...
812
    }
812
    }
Línea 813... Línea 813...
813
 
813
 
814
    /**
814
    /**
815
     * Test for data_connector::loadConsumerNonce().
815
     * Test for data_connector::loadConsumerNonce().
816
     */
816
     */
817
    public function test_load_consumer_nonce() {
817
    public function test_load_consumer_nonce(): void {
Línea 818... Línea 818...
818
        $dc = new data_connector();
818
        $dc = new data_connector();
819
 
819
 
820
        $consumer = new ToolConsumer(null, $dc);
820
        $consumer = new ToolConsumer(null, $dc);
Línea 833... Línea 833...
833
    }
833
    }
Línea 834... Línea 834...
834
 
834
 
835
    /**
835
    /**
836
     * Test for data_connector::loadConsumerNonce() for a nonce that has expired.
836
     * Test for data_connector::loadConsumerNonce() for a nonce that has expired.
837
     */
837
     */
838
    public function test_load_consumer_nonce_expired() {
838
    public function test_load_consumer_nonce_expired(): void {
Línea 839... Línea 839...
839
        $dc = new data_connector();
839
        $dc = new data_connector();
840
 
840
 
841
        $consumer = new ToolConsumer(null, $dc);
841
        $consumer = new ToolConsumer(null, $dc);
Línea 853... Línea 853...
853
    }
853
    }
Línea 854... Línea 854...
854
 
854
 
855
    /**
855
    /**
856
     * Test for data_connector::saveConsumerNonce().
856
     * Test for data_connector::saveConsumerNonce().
857
     */
857
     */
858
    public function test_save_consumer_nonce() {
858
    public function test_save_consumer_nonce(): void {
Línea 859... Línea 859...
859
        $dc = new data_connector();
859
        $dc = new data_connector();
860
 
860
 
861
        $consumer = new ToolConsumer(null, $dc);
861
        $consumer = new ToolConsumer(null, $dc);
Línea 871... Línea 871...
871
    }
871
    }
Línea 872... Línea 872...
872
 
872
 
873
    /**
873
    /**
874
     * Test for data_connector::loadResourceLinkShareKey().
874
     * Test for data_connector::loadResourceLinkShareKey().
875
     */
875
     */
876
    public function test_load_resource_link_share_key() {
876
    public function test_load_resource_link_share_key(): void {
Línea 877... Línea 877...
877
        $dc = new data_connector();
877
        $dc = new data_connector();
878
 
878
 
879
        $consumer = new ToolConsumer(null, $dc);
879
        $consumer = new ToolConsumer(null, $dc);
Línea 901... Línea 901...
901
    }
901
    }
Línea 902... Línea 902...
902
 
902
 
903
    /**
903
    /**
904
     * Test for data_connector::loadResourceLinkShareKey() with an expired share key.
904
     * Test for data_connector::loadResourceLinkShareKey() with an expired share key.
905
     */
905
     */
906
    public function test_load_resource_link_share_key_expired() {
906
    public function test_load_resource_link_share_key_expired(): void {
Línea 907... Línea 907...
907
        $dc = new data_connector();
907
        $dc = new data_connector();
908
 
908
 
909
        $consumer = new ToolConsumer(null, $dc);
909
        $consumer = new ToolConsumer(null, $dc);
Línea 925... Línea 925...
925
    }
925
    }
Línea 926... Línea 926...
926
 
926
 
927
    /**
927
    /**
928
     * Test for data_connector::saveResourceLinkShareKey().
928
     * Test for data_connector::saveResourceLinkShareKey().
929
     */
929
     */
930
    public function test_save_resource_link_share_key() {
930
    public function test_save_resource_link_share_key(): void {
Línea 931... Línea 931...
931
        $dc = new data_connector();
931
        $dc = new data_connector();
932
 
932
 
933
        $consumer = new ToolConsumer(null, $dc);
933
        $consumer = new ToolConsumer(null, $dc);
Línea 954... Línea 954...
954
    }
954
    }
Línea 955... Línea 955...
955
 
955
 
956
    /**
956
    /**
957
     * Test for data_connector::deleteResourceLinkShareKey().
957
     * Test for data_connector::deleteResourceLinkShareKey().
958
     */
958
     */
959
    public function test_delete_resource_link_share_key() {
959
    public function test_delete_resource_link_share_key(): void {
Línea 960... Línea 960...
960
        $dc = new data_connector();
960
        $dc = new data_connector();
961
 
961
 
962
        $consumer = new ToolConsumer(null, $dc);
962
        $consumer = new ToolConsumer(null, $dc);
Línea 982... Línea 982...
982
    }
982
    }
Línea 983... Línea 983...
983
 
983
 
984
    /**
984
    /**
985
     * Test for data_connector::loadUser().
985
     * Test for data_connector::loadUser().
986
     */
986
     */
987
    public function test_load_user() {
987
    public function test_load_user(): void {
988
        $dc = new data_connector();
988
        $dc = new data_connector();
989
        $consumer = new ToolConsumer(null, $dc);
989
        $consumer = new ToolConsumer(null, $dc);
990
        $consumer->name = 'TestName';
990
        $consumer->name = 'TestName';
991
        $consumer->setKey('TestKey');
991
        $consumer->setKey('TestKey');
Línea 1017... Línea 1017...
1017
    }
1017
    }
Línea 1018... Línea 1018...
1018
 
1018
 
1019
    /**
1019
    /**
1020
     * Test for data_connector::saveUser().
1020
     * Test for data_connector::saveUser().
1021
     */
1021
     */
1022
    public function test_save_user() {
1022
    public function test_save_user(): void {
1023
        $dc = new data_connector();
1023
        $dc = new data_connector();
1024
        $consumer = new ToolConsumer(null, $dc);
1024
        $consumer = new ToolConsumer(null, $dc);
1025
        $consumer->name = 'TestName';
1025
        $consumer->name = 'TestName';
1026
        $consumer->setKey('TestKey');
1026
        $consumer->setKey('TestKey');
Línea 1056... Línea 1056...
1056
    }
1056
    }
Línea 1057... Línea 1057...
1057
 
1057
 
1058
    /**
1058
    /**
1059
     * Test for data_connector::deleteUser().
1059
     * Test for data_connector::deleteUser().
1060
     */
1060
     */
1061
    public function test_delete_user() {
1061
    public function test_delete_user(): void {
1062
        $dc = new data_connector();
1062
        $dc = new data_connector();
1063
        $consumer = new ToolConsumer(null, $dc);
1063
        $consumer = new ToolConsumer(null, $dc);
1064
        $consumer->name = 'TestName';
1064
        $consumer->name = 'TestName';
1065
        $consumer->setKey('TestKey');
1065
        $consumer->setKey('TestKey');
Línea 1098... Línea 1098...
1098
    }
1098
    }
Línea 1099... Línea 1099...
1099
 
1099
 
1100
    /**
1100
    /**
1101
     * Test for data_connector::get_contexts_from_consumer().
1101
     * Test for data_connector::get_contexts_from_consumer().
1102
     */
1102
     */
1103
    public function test_get_contexts_from_consumer() {
1103
    public function test_get_contexts_from_consumer(): void {
1104
        $dc = new data_connector();
1104
        $dc = new data_connector();
1105
        $consumer = new ToolConsumer(null, $dc);
1105
        $consumer = new ToolConsumer(null, $dc);
1106
        $consumer->name = 'testconsumername';
1106
        $consumer->name = 'testconsumername';
1107
        $consumer->setKey('TestKey');
1107
        $consumer->setKey('TestKey');
Línea 1131... Línea 1131...
1131
    }
1131
    }
Línea 1132... Línea 1132...
1132
 
1132
 
1133
    /**
1133
    /**
1134
     * Test for data_connector::get_consumers_mapped_to_tool().
1134
     * Test for data_connector::get_consumers_mapped_to_tool().
1135
     */
1135
     */
1136
    public function test_get_consumers_mapped_to_tool() {
1136
    public function test_get_consumers_mapped_to_tool(): void {
1137
        $generator = $this->getDataGenerator();
1137
        $generator = $this->getDataGenerator();
1138
        // Create two tools belonging to the same course.
1138
        // Create two tools belonging to the same course.
1139
        $course1 = $generator->create_course();
1139
        $course1 = $generator->create_course();
1140
        $data = new \stdClass();
1140
        $data = new \stdClass();
Línea 1171... Línea 1171...
1171
    }
1171
    }
Línea 1172... Línea 1172...
1172
 
1172
 
1173
    /**
1173
    /**
1174
     * Test for data_connector::get_resourcelink_from_consumer()
1174
     * Test for data_connector::get_resourcelink_from_consumer()
1175
     */
1175
     */
1176
    public function test_get_resourcelink_from_consumer() {
1176
    public function test_get_resourcelink_from_consumer(): void {
Línea 1177... Línea 1177...
1177
        $dc = new data_connector();
1177
        $dc = new data_connector();
1178
 
1178
 
1179
        $consumer = new ToolConsumer(null, $dc);
1179
        $consumer = new ToolConsumer(null, $dc);
Línea 1195... Línea 1195...
1195
    }
1195
    }
Línea 1196... Línea 1196...
1196
 
1196
 
1197
    /**
1197
    /**
1198
     * Test for data_connector::get_resourcelink_from_context()
1198
     * Test for data_connector::get_resourcelink_from_context()
1199
     */
1199
     */
1200
    public function test_get_resourcelink_from_context() {
1200
    public function test_get_resourcelink_from_context(): void {
Línea 1201... Línea 1201...
1201
        $dc = new data_connector();
1201
        $dc = new data_connector();
1202
 
1202
 
1203
        $consumer = new ToolConsumer(null, $dc);
1203
        $consumer = new ToolConsumer(null, $dc);