Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 72... Línea 72...
72
     *
72
     *
73
     * @dataProvider has_additional_results_provider
73
     * @dataProvider has_additional_results_provider
74
     * @param   object      $result     The data to test
74
     * @param   object      $result     The data to test
75
     * @param   bool        $expected   The expected result
75
     * @param   bool        $expected   The expected result
76
     */
76
     */
77
    public function test_has_additional_results($result, $expected) {
77
    public function test_has_additional_results($result, $expected): void {
78
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
78
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
79
            ->disableOriginalConstructor()
79
            ->disableOriginalConstructor()
80
            ->onlyMethods([])
80
            ->onlyMethods([])
81
            ->getMock();
81
            ->getMock();
Línea 148... Línea 148...
148
     * @param   object      $info       The response to test
148
     * @param   object      $info       The response to test
149
     * @param   string      $data       The contented returned by the curl call
149
     * @param   string      $data       The contented returned by the curl call
150
     * @param   string      $exception  The name of the expected exception
150
     * @param   string      $exception  The name of the expected exception
151
     * @param   string      $exceptionmessage  The expected message in the exception
151
     * @param   string      $exceptionmessage  The expected message in the exception
152
     */
152
     */
153
    public function test_check_and_handle_api_errors($info, $data, $exception, $exceptionmessage) {
153
    public function test_check_and_handle_api_errors($info, $data, $exception, $exceptionmessage): void {
154
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
154
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
155
            ->disableOriginalConstructor()
155
            ->disableOriginalConstructor()
156
            ->onlyMethods([])
156
            ->onlyMethods([])
157
            ->getMock();
157
            ->getMock();
Línea 242... Línea 242...
242
     *
242
     *
243
     * @dataProvider supports_thumbnail_provider
243
     * @dataProvider supports_thumbnail_provider
244
     * @param   object      $entry      The entry to test
244
     * @param   object      $entry      The entry to test
245
     * @param   bool        $expected   Whether this entry supports thumbnail generation
245
     * @param   bool        $expected   Whether this entry supports thumbnail generation
246
     */
246
     */
247
    public function test_supports_thumbnail($entry, $expected) {
247
    public function test_supports_thumbnail($entry, $expected): void {
248
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
248
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
249
            ->disableOriginalConstructor()
249
            ->disableOriginalConstructor()
250
            ->onlyMethods([])
250
            ->onlyMethods([])
251
            ->getMock();
251
            ->getMock();
Línea 254... Línea 254...
254
    }
254
    }
Línea 255... Línea 255...
255
 
255
 
256
    /**
256
    /**
257
     * Test that the logout makes a call to the correct revocation endpoint.
257
     * Test that the logout makes a call to the correct revocation endpoint.
258
     */
258
     */
259
    public function test_logout_revocation() {
259
    public function test_logout_revocation(): void {
260
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
260
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
261
            ->disableOriginalConstructor()
261
            ->disableOriginalConstructor()
262
            ->onlyMethods(['fetch_dropbox_data'])
262
            ->onlyMethods(['fetch_dropbox_data'])
Línea 270... Línea 270...
270
    }
270
    }
Línea 271... Línea 271...
271
 
271
 
272
    /**
272
    /**
273
     * Test that the logout function catches authentication_exception exceptions and discards them.
273
     * Test that the logout function catches authentication_exception exceptions and discards them.
274
     */
274
     */
275
    public function test_logout_revocation_catch_auth_exception() {
275
    public function test_logout_revocation_catch_auth_exception(): void {
276
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
276
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
277
            ->disableOriginalConstructor()
277
            ->disableOriginalConstructor()
278
            ->onlyMethods(['fetch_dropbox_data'])
278
            ->onlyMethods(['fetch_dropbox_data'])
Línea 286... Línea 286...
286
    }
286
    }
Línea 287... Línea 287...
287
 
287
 
288
    /**
288
    /**
289
     * Test that the logout function does not catch any other exception.
289
     * Test that the logout function does not catch any other exception.
290
     */
290
     */
291
    public function test_logout_revocation_does_not_catch_other_exceptions() {
291
    public function test_logout_revocation_does_not_catch_other_exceptions(): void {
292
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
292
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
293
            ->disableOriginalConstructor()
293
            ->disableOriginalConstructor()
294
            ->onlyMethods(['fetch_dropbox_data'])
294
            ->onlyMethods(['fetch_dropbox_data'])
Línea 303... Línea 303...
303
    }
303
    }
Línea 304... Línea 304...
304
 
304
 
305
    /**
305
    /**
306
     * Test basic fetch_dropbox_data function.
306
     * Test basic fetch_dropbox_data function.
307
     */
307
     */
308
    public function test_fetch_dropbox_data_endpoint() {
308
    public function test_fetch_dropbox_data_endpoint(): void {
309
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
309
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
310
            ->disableOriginalConstructor()
310
            ->disableOriginalConstructor()
311
            ->onlyMethods([
311
            ->onlyMethods([
312
                'request',
312
                'request',
Línea 337... Línea 337...
337
    }
337
    }
Línea 338... Línea 338...
338
 
338
 
339
    /**
339
    /**
340
     * Some Dropbox endpoints require that the POSTFIELDS be set to null exactly.
340
     * Some Dropbox endpoints require that the POSTFIELDS be set to null exactly.
341
     */
341
     */
342
    public function test_fetch_dropbox_data_postfields_null() {
342
    public function test_fetch_dropbox_data_postfields_null(): void {
343
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
343
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
344
            ->disableOriginalConstructor()
344
            ->disableOriginalConstructor()
345
            ->onlyMethods([
345
            ->onlyMethods([
346
                'request',
346
                'request',
Línea 363... Línea 363...
363
    }
363
    }
Línea 364... Línea 364...
364
 
364
 
365
    /**
365
    /**
366
     * When data is specified, it should be json_encoded in POSTFIELDS.
366
     * When data is specified, it should be json_encoded in POSTFIELDS.
367
     */
367
     */
368
    public function test_fetch_dropbox_data_postfields_data() {
368
    public function test_fetch_dropbox_data_postfields_data(): void {
369
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
369
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
370
            ->disableOriginalConstructor()
370
            ->disableOriginalConstructor()
371
            ->onlyMethods([
371
            ->onlyMethods([
372
                'request',
372
                'request',
Línea 390... Línea 390...
390
    }
390
    }
Línea 391... Línea 391...
391
 
391
 
392
    /**
392
    /**
393
     * When more results are available, these should be fetched until there are no more.
393
     * When more results are available, these should be fetched until there are no more.
394
     */
394
     */
395
    public function test_fetch_dropbox_data_recurse_on_additional_records() {
395
    public function test_fetch_dropbox_data_recurse_on_additional_records(): void {
396
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
396
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
397
            ->disableOriginalConstructor()
397
            ->disableOriginalConstructor()
398
            ->onlyMethods([
398
            ->onlyMethods([
399
                'request',
399
                'request',
Línea 440... Línea 440...
440
    }
440
    }
Línea 441... Línea 441...
441
 
441
 
442
    /**
442
    /**
443
     * Base tests for the fetch_dropbox_content function.
443
     * Base tests for the fetch_dropbox_content function.
444
     */
444
     */
445
    public function test_fetch_dropbox_content() {
445
    public function test_fetch_dropbox_content(): void {
446
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
446
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
447
            ->disableOriginalConstructor()
447
            ->disableOriginalConstructor()
448
            ->onlyMethods([
448
            ->onlyMethods([
449
                'request',
449
                'request',
Línea 497... Línea 497...
497
    }
497
    }
Línea 498... Línea 498...
498
 
498
 
499
    /**
499
    /**
500
     * Test that the get_file_share_info function returns an existing link if one is available.
500
     * Test that the get_file_share_info function returns an existing link if one is available.
501
     */
501
     */
502
    public function test_get_file_share_info_existing() {
502
    public function test_get_file_share_info_existing(): void {
503
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
503
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
504
            ->disableOriginalConstructor()
504
            ->disableOriginalConstructor()
505
            ->onlyMethods([
505
            ->onlyMethods([
506
                'fetch_dropbox_data',
506
                'fetch_dropbox_data',
Línea 530... Línea 530...
530
    }
530
    }
Línea 531... Línea 531...
531
 
531
 
532
    /**
532
    /**
533
     * Test that the get_file_share_info function creates a new link if one is not available.
533
     * Test that the get_file_share_info function creates a new link if one is not available.
534
     */
534
     */
535
    public function test_get_file_share_info_new() {
535
    public function test_get_file_share_info_new(): void {
536
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
536
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
537
            ->disableOriginalConstructor()
537
            ->disableOriginalConstructor()
538
            ->onlyMethods([
538
            ->onlyMethods([
539
                'fetch_dropbox_data',
539
                'fetch_dropbox_data',
Línea 571... Línea 571...
571
    }
571
    }
Línea 572... Línea 572...
572
 
572
 
573
    /**
573
    /**
574
     * Test failure behaviour with get_file_share_info fails to create a new link.
574
     * Test failure behaviour with get_file_share_info fails to create a new link.
575
     */
575
     */
576
    public function test_get_file_share_info_new_failure() {
576
    public function test_get_file_share_info_new_failure(): void {
577
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
577
        $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
578
            ->disableOriginalConstructor()
578
            ->disableOriginalConstructor()
579
            ->onlyMethods([
579
            ->onlyMethods([
580
                'fetch_dropbox_data',
580
                'fetch_dropbox_data',