Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Class: api_test  - X-Ref

Tests for the Dropbox API (v2).

has_additional_results_provider()   X-Ref
Data provider for has_additional_results.

return: array

test_has_additional_results($result, $expected)   X-Ref
Tests for the has_additional_results API function.

param: object      $result     The data to test
param: bool        $expected   The expected result

check_and_handle_api_errors_provider()   X-Ref
Data provider for check_and_handle_api_errors.

return: array

test_check_and_handle_api_errors($info, $data, $exception, $exceptionmessage)   X-Ref
Tests for check_and_handle_api_errors.

param: object      $info       The response to test
param: string      $data       The contented returned by the curl call
param: string      $exception  The name of the expected exception
param: string      $exceptionmessage  The expected message in the exception

supports_thumbnail_provider()   X-Ref
Data provider for the supports_thumbnail function.

return: array

test_supports_thumbnail($entry, $expected)   X-Ref
Test the supports_thumbnail function.

param: object      $entry      The entry to test
param: bool        $expected   Whether this entry supports thumbnail generation

test_logout_revocation()   X-Ref
Test that the logout makes a call to the correct revocation endpoint.


test_logout_revocation_catch_auth_exception()   X-Ref
Test that the logout function catches authentication_exception exceptions and discards them.


test_logout_revocation_does_not_catch_other_exceptions()   X-Ref
Test that the logout function does not catch any other exception.


test_fetch_dropbox_data_endpoint()   X-Ref
Test basic fetch_dropbox_data function.


test_fetch_dropbox_data_postfields_null()   X-Ref
Some Dropbox endpoints require that the POSTFIELDS be set to null exactly.


test_fetch_dropbox_data_postfields_data()   X-Ref
When data is specified, it should be json_encoded in POSTFIELDS.


test_fetch_dropbox_data_recurse_on_additional_records()   X-Ref
When more results are available, these should be fetched until there are no more.


test_fetch_dropbox_content()   X-Ref
Base tests for the fetch_dropbox_content function.


test_get_file_share_info_existing()   X-Ref
Test that the get_file_share_info function returns an existing link if one is available.


test_get_file_share_info_new()   X-Ref
Test that the get_file_share_info function creates a new link if one is not available.


test_get_file_share_info_new_failure()   X-Ref
Test failure behaviour with get_file_share_info fails to create a new link.