Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.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.