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: filterset_test  - X-Ref

Unit tests for core_table\local\filter\filterset.

test_set_join_type()   X-Ref
Ensure that it is possibly to set the join type.


test_set_join_type_invalid_low()   X-Ref
Ensure that it is not possible to provide a value out of bounds when setting the join type.


test_set_join_type_invalid_high()   X-Ref
Ensure that it is not possible to provide a value out of bounds when setting the join type.


test_add_filter_value()   X-Ref
Ensure that adding filter values works as expected.


test_add_filter_validated_type()   X-Ref
Ensure that it is possible to add a filter of a validated filter type.


test_add_filter_unexpected_key()   X-Ref
Ensure that it is not possible to add a type which is not expected.


test_add_filter_validated_type_incorrect()   X-Ref
Ensure that it is not possible to add a validated type where the type is incorrect.


test_add_filter_from_params()   X-Ref
Ensure that a filter can be added from parameters provided to a web service.


test_add_filter_from_params_unable_to_autoload()   X-Ref
Ensure that an unknown filter is not added.


test_add_filter_from_params_invalid()   X-Ref
Ensure that an unknown filter is not added.


test_duplicate_filter_value()   X-Ref
Ensure that adding a different filter with a different object throws an Exception.


test_check_validity_optional_filters_not_specified()   X-Ref
Ensure that validating a filterset correctly compares filter types.


test_check_validity_required_filter()   X-Ref
Ensure that validating a filterset correctly requires required filters.


test_check_validity_filter_missing_required()   X-Ref
Ensure that validating a filterset excepts correctly when a required fieldset is missing.


test_get_filters()   X-Ref
Ensure that getting the filters returns a sorted list of filters.


test_get_filter()   X-Ref
Ensure that getting a singlel filter returns the correct filter.


test_get_filter_unknown()   X-Ref
Ensure that it is not possible to retrieve an unknown filter.


test_get_filter_not_yet_added()   X-Ref
Ensure that it is not possible to retrieve a valid filter before it is created.


test_get_all_filtertypes()   X-Ref
Ensure that the get_all_filtertypes function correctly returns the combined filterset.


test_get_all_filtertypes_conflict()   X-Ref
Ensure that the get_all_filtertypes function correctly returns the combined filterset.


test_has_filter()   X-Ref
Ensure that the has_filter function works as expected.


get_mocked_filterset(array $mockedmethods = [])   X-Ref
Get a mocked copy of the filterset, mocking the specified methods.

param: array $mockedmethods anonymous array containing the list of mocked methods
return: filterset Mock of the filterset