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.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 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: 1034 lines (41 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: lib_test  - 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 | FILE_REFERENCE when no system account is connected.
FILE_INTERNAL | FILE_CONTROLLED_LINK | FILE_REFERENCE when a system account is connected.


test_reference_file_selected_error()   X-Ref
The reference_file_selected() method 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.


sync_reference_provider()   X-Ref
This function provides the data for test_sync_reference

return: array[]

test_sync_reference(array $storedfileargs, $storedfilemethodsmock, bool $expectedresult)   X-Ref
Testing sync_reference

param: array $storedfileargs
param: array $storedfilemethodsmock
param: bool $expectedresult
return: void

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.