Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 310] [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

This file contains tests for the repository_nextcloud class.

Copyright: 2017 Project seminar (Learnweb, University of Münster)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 884 lines (35 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: repository_nextcloud_lib_testcase  - X-Ref

Class repository_nextcloud_lib_testcase

setUp()   X-Ref
SetUp to create an repository instance.


test_is_visible_parent_false()   X-Ref
Checks the is_visible method in case the repository is set to hidden in the database.


test_repo_creation()   X-Ref
Test whether the repo is disabled.


get_endpoint_id($endpointname)   X-Ref
Returns an array of endpoints or null.

param: string $endpointname
return: array|null

test_issuer_webdav()   X-Ref
Test if repository is disabled when webdav_endpoint is deleted.


test_issuer_ocs()   X-Ref
Test if repository is disabled when ocs_endpoint is deleted.


test_issuer_userinfo()   X-Ref
Test if repository is disabled when userinfo_endpoint is deleted.


test_issuer_token()   X-Ref
Test if repository is disabled when token_endpoint is deleted.


test_issuer_authorization()   X-Ref
Test if repository is disabled when auth_endpoint is deleted.


test_parse_endpoint_url_error()   X-Ref
Test if repository throws an error when endpoint does not exist.


test_get_listing_error()   X-Ref
Test get_listing method with an example directory. Tests error cases.


test_get_listing_root()   X-Ref
Test get_listing method with an example directory. Tests the root directory.


test_get_listing_directory()   X-Ref
Test get_listing method with an example directory. Tests a different directory than the root
directory.


test_get_link_success()   X-Ref
Test the get_link method.


test_get_link_failure()   X-Ref
get_link can get OCS failure responses. Test that this is handled appropriately.


test_get_link_problem()   X-Ref
get_link can get OCS responses that are not actually XML. Test that this is handled appropriately.


test_get_file_reference_withoutoptionalparam()   X-Ref
Test get_file reference, merely returns the input if no optional_param is set.


test_logout()   X-Ref
Test logout.


test_get_file()   X-Ref
Test for the get_file method from the repository_nextcloud class.


test_callback()   X-Ref
Test callback.


test_check_login()   X-Ref
Test check_login.


test_print_login()   X-Ref
Test print_login.


test_initiate_webdavclient()   X-Ref
Test the initiate_webdavclient function.


test_supported_returntypes()   X-Ref
Test supported_returntypes.
FILE_INTERNAL when no system account is connected.
FILE_INTERNAL | FILE_CONTROLLED_LINK when a system account is connected.


test_reference_file_selected_error()   X-Ref
The reference_file_selected() methode is called every time a FILE_CONTROLLED_LINK is chosen for upload.
Since the function is very long the private function are tested separately, and merely the abortion of the
function are tested.


test_send_file_errors()   X-Ref
Test the send_file function for access controlled links.


set_private_property($value, $propertyname)   X-Ref
Helper method, which inserts a given mock value into the repository_nextcloud object.

param: mixed $value mock value that will be inserted.
param: string $propertyname name of the private property.
return: ReflectionProperty the resulting reflection property.

get_initialised_return_array()   X-Ref
Helper method to set required return parameters for get_listing.

return: array array, which contains the parameters.