Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 70... Línea 70...
70
    }
70
    }
Línea 71... Línea 71...
71
 
71
 
72
    /**
72
    /**
73
     * Passing non-existent tool ID.
73
     * Passing non-existent tool ID.
74
     */
74
     */
75
    public function test_constructor_with_non_existent_tool() {
75
    public function test_constructor_with_non_existent_tool(): void {
76
        $this->expectException('dml_exception');
76
        $this->expectException('dml_exception');
77
        new tool_provider(-1);
77
        new tool_provider(-1);
Línea 78... Línea 78...
78
    }
78
    }
79
 
79
 
80
    /**
80
    /**
81
     * Constructor test.
81
     * Constructor test.
82
     */
82
     */
Línea 83... Línea 83...
83
    public function test_constructor() {
83
    public function test_constructor(): void {
84
        global $CFG, $SITE;
84
        global $CFG, $SITE;
Línea 119... Línea 119...
119
    }
119
    }
Línea 120... Línea 120...
120
 
120
 
121
    /**
121
    /**
122
     * Test for handle request.
122
     * Test for handle request.
123
     */
123
     */
124
    public function test_handle_request_no_request_data() {
124
    public function test_handle_request_no_request_data(): void {
125
        $tool = $this->tool;
125
        $tool = $this->tool;
Línea 126... Línea 126...
126
        $tp = new tool_provider($tool->id);
126
        $tp = new tool_provider($tool->id);
127
 
127
 
Línea 138... Línea 138...
138
    }
138
    }
Línea 139... Línea 139...
139
 
139
 
140
    /**
140
    /**
141
     * Test for tool_provider::onError().
141
     * Test for tool_provider::onError().
142
     */
142
     */
143
    public function test_on_error() {
143
    public function test_on_error(): void {
144
        $tool = $this->tool;
144
        $tool = $this->tool;
145
        $tp = new dummy_tool_provider($tool->id);
145
        $tp = new dummy_tool_provider($tool->id);
146
        $message = "THIS IS AN ERROR!";
146
        $message = "THIS IS AN ERROR!";
147
        $tp->message = $message;
147
        $tp->message = $message;
Línea 151... Línea 151...
151
    }
151
    }
Línea 152... Línea 152...
152
 
152
 
153
    /**
153
    /**
154
     * Test for tool_provider::onRegister() with no tool consumer set.
154
     * Test for tool_provider::onRegister() with no tool consumer set.
155
     */
155
     */
156
    public function test_on_register_no_consumer() {
156
    public function test_on_register_no_consumer(): void {
Línea 157... Línea 157...
157
        $tool = $this->tool;
157
        $tool = $this->tool;
158
 
158
 
Línea 164... Línea 164...
164
    }
164
    }
Línea 165... Línea 165...
165
 
165
 
166
    /**
166
    /**
167
     * Test for tool_provider::onRegister() without return URL.
167
     * Test for tool_provider::onRegister() without return URL.
168
     */
168
     */
169
    public function test_on_register_no_return_url() {
169
    public function test_on_register_no_return_url(): void {
Línea 170... Línea 170...
170
        $tool = $this->tool;
170
        $tool = $this->tool;
171
 
171
 
172
        $dataconnector = new data_connector();
172
        $dataconnector = new data_connector();
Línea 190... Línea 190...
190
    }
190
    }
Línea 191... Línea 191...
191
 
191
 
192
    /**
192
    /**
193
     * Test for tool_provider::onRegister() when registration fails.
193
     * Test for tool_provider::onRegister() when registration fails.
194
     */
194
     */
195
    public function test_on_register_failed() {
195
    public function test_on_register_failed(): void {
196
        global $CFG;
196
        global $CFG;
Línea 197... Línea 197...
197
        $tool = $this->tool;
197
        $tool = $this->tool;
198
 
198
 
Línea 223... Línea 223...
223
    }
223
    }
Línea 224... Línea 224...
224
 
224
 
225
    /**
225
    /**
226
     * Test for tool_provider::onRegister() when registration succeeds.
226
     * Test for tool_provider::onRegister() when registration succeeds.
227
     */
227
     */
228
    public function test_on_register() {
228
    public function test_on_register(): void {
229
        global $CFG, $DB;
229
        global $CFG, $DB;
Línea 230... Línea 230...
230
        $tool = $this->tool;
230
        $tool = $this->tool;
231
 
231
 
Línea 273... Línea 273...
273
    }
273
    }
Línea 274... Línea 274...
274
 
274
 
275
    /**
275
    /**
276
     * Test for tool_provider::onLaunch().
276
     * Test for tool_provider::onLaunch().
277
     */
277
     */
278
    public function test_on_launch_no_frame_embedding() {
278
    public function test_on_launch_no_frame_embedding(): void {
Línea 279... Línea 279...
279
        $tp = $this->build_dummy_tp();
279
        $tp = $this->build_dummy_tp();
280
 
280
 
281
        // Capture output of onLaunch() method and save it as a string.
281
        // Capture output of onLaunch() method and save it as a string.
Línea 288... Línea 288...
288
    }
288
    }
Línea 289... Línea 289...
289
 
289
 
290
    /**
290
    /**
291
     * Test for tool_provider::onLaunch().
291
     * Test for tool_provider::onLaunch().
292
     */
292
     */
293
    public function test_on_launch_with_frame_embedding() {
293
    public function test_on_launch_with_frame_embedding(): void {
294
        global $CFG;
294
        global $CFG;
Línea 295... Línea 295...
295
        $CFG->allowframembedding = true;
295
        $CFG->allowframembedding = true;
Línea 305... Línea 305...
305
    }
305
    }
Línea 306... Línea 306...
306
 
306
 
307
    /**
307
    /**
308
     * Test for tool_provider::onLaunch() with invalid secret and no tool proxy (for LTI 1 launches).
308
     * Test for tool_provider::onLaunch() with invalid secret and no tool proxy (for LTI 1 launches).
309
     */
309
     */
310
    public function test_on_launch_with_invalid_secret_and_no_proxy() {
310
    public function test_on_launch_with_invalid_secret_and_no_proxy(): void {
Línea 311... Línea 311...
311
        $tp = $this->build_dummy_tp('badsecret');
311
        $tp = $this->build_dummy_tp('badsecret');
312
 
312
 
313
        // Suppress session header errors.
313
        // Suppress session header errors.
Línea 317... Línea 317...
317
    }
317
    }
Línea 318... Línea 318...
318
 
318
 
319
    /**
319
    /**
320
     * Test for tool_provider::onLaunch() with invalid launch URL.
320
     * Test for tool_provider::onLaunch() with invalid launch URL.
321
     */
321
     */
322
    public function test_on_launch_proxy_with_invalid_launch_url() {
322
    public function test_on_launch_proxy_with_invalid_launch_url(): void {
323
        $proxy = [
323
        $proxy = [
324
            'tool_profile' => [
324
            'tool_profile' => [
325
                'resource_handler' => [
325
                'resource_handler' => [
326
                    [
326
                    [
Línea 343... Línea 343...
343
    }
343
    }
Línea 344... Línea 344...
344
 
344
 
345
    /**
345
    /**
346
     * Test for tool_provider::onLaunch() with invalid launch URL.
346
     * Test for tool_provider::onLaunch() with invalid launch URL.
347
     */
347
     */
348
    public function test_on_launch_proxy_with_valid_launch_url() {
348
    public function test_on_launch_proxy_with_valid_launch_url(): void {
Línea 349... Línea 349...
349
        $tool = $this->tool;
349
        $tool = $this->tool;
350
 
350
 
351
        $proxy = [
351
        $proxy = [
Línea 376... Línea 376...
376
    }
376
    }
Línea 377... Línea 377...
377
 
377
 
378
    /**
378
    /**
379
     * Test for tool_provider::onLaunch() for a request with message type other than basic-lti-launch-request.
379
     * Test for tool_provider::onLaunch() for a request with message type other than basic-lti-launch-request.
380
     */
380
     */
381
    public function test_on_launch_proxy_with_invalid_message_type() {
381
    public function test_on_launch_proxy_with_invalid_message_type(): void {
Línea 382... Línea 382...
382
        $tool = $this->tool;
382
        $tool = $this->tool;
383
 
383
 
384
        $proxy = [
384
        $proxy = [
Línea 405... Línea 405...
405
    }
405
    }
Línea 406... Línea 406...
406
 
406
 
407
    /**
407
    /**
408
     * Test for tool_provider::onLaunch() to verify that a user image can be set from the resource link's custom_user_image setting.
408
     * Test for tool_provider::onLaunch() to verify that a user image can be set from the resource link's custom_user_image setting.
409
     */
409
     */
410
    public function test_on_launch_with_user_image_from_resource_link() {
410
    public function test_on_launch_with_user_image_from_resource_link(): void {
Línea 411... Línea 411...
411
        global $DB;
411
        global $DB;
412
 
412
 
413
        $userimageurl = $this->getExternalTestFileUrl('test.jpg');
413
        $userimageurl = $this->getExternalTestFileUrl('test.jpg');
Línea 432... Línea 432...
432
    }
432
    }
Línea 433... Línea 433...
433
 
433
 
434
    /**
434
    /**
435
     * Test for tool_provider::onLaunch() to verify that a LTI user has been enrolled.
435
     * Test for tool_provider::onLaunch() to verify that a LTI user has been enrolled.
436
     */
436
     */
437
    public function test_on_launch_user_enrolment() {
437
    public function test_on_launch_user_enrolment(): void {
Línea 438... Línea 438...
438
        global $DB;
438
        global $DB;
Línea 439... Línea 439...
439
 
439
 
Línea 457... Línea 457...
457
    }
457
    }
Línea 458... Línea 458...
458
 
458
 
459
    /**
459
    /**
460
     * Test for tool_provider::onLaunch() when the consumer object has not been set.
460
     * Test for tool_provider::onLaunch() when the consumer object has not been set.
461
     */
461
     */
462
    public function test_on_launch_no_consumer() {
462
    public function test_on_launch_no_consumer(): void {
Línea 463... Línea 463...
463
        global $DB;
463
        global $DB;
Línea 464... Línea 464...
464
 
464
 
Línea 477... Línea 477...
477
    }
477
    }
Línea 478... Línea 478...
478
 
478
 
479
    /**
479
    /**
480
     * Test for tool_provider::onLaunch() when we have a non-existent consumer data.
480
     * Test for tool_provider::onLaunch() when we have a non-existent consumer data.
481
     */
481
     */
482
    public function test_on_launch_invalid_consumer() {
482
    public function test_on_launch_invalid_consumer(): void {
Línea 483... Línea 483...
483
        $tool = $this->tool;
483
        $tool = $this->tool;
484
 
484
 
485
        $dataconnector = new data_connector();
485
        $dataconnector = new data_connector();
Línea 494... Línea 494...
494
    }
494
    }
Línea 495... Línea 495...
495
 
495
 
496
    /**
496
    /**
497
     * Test for tool_provider::map_tool_to_consumer().
497
     * Test for tool_provider::map_tool_to_consumer().
498
     */
498
     */
499
    public function test_map_tool_to_consumer() {
499
    public function test_map_tool_to_consumer(): void {
Línea 500... Línea 500...
500
        global $DB;
500
        global $DB;
501
 
501
 
Línea 511... Línea 511...
511
    }
511
    }
Línea 512... Línea 512...
512
 
512
 
513
    /**
513
    /**
514
     * Test for tool_provider::map_tool_to_consumer().
514
     * Test for tool_provider::map_tool_to_consumer().
515
     */
515
     */
516
    public function test_map_tool_to_consumer_no_consumer() {
516
    public function test_map_tool_to_consumer_no_consumer(): void {
517
        $tp = new dummy_tool_provider($this->tool->id);
517
        $tp = new dummy_tool_provider($this->tool->id);
518
        $this->expectException('moodle_exception');
518
        $this->expectException('moodle_exception');
519
        $tp->map_tool_to_consumer();
519
        $tp->map_tool_to_consumer();