Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Class: user_favourite_service_test  - X-Ref

Test class covering the user_favourite_service within the service layer of favourites.

setUp()   X-Ref
No description

setup_users_and_courses()   X-Ref
No description

get_mock_repository(array $mockstore)   X-Ref
Generates an in-memory repository for testing, using an array store for CRUD stuff.

param: array $mockstore
return: \PHPUnit\Framework\MockObject\MockObject

test_get_service_for_user_context()   X-Ref
Test getting a user_favourite_service from the static locator.


test_create_favourite_basic()   X-Ref
Test confirming an item can be favourited only once.


test_create_favourite_nonexistent_component()   X-Ref
Test confirming that an exception is thrown if trying to favourite an item for a non-existent component.


test_find_favourites_by_type_single_user()   X-Ref
Test fetching favourites for single user, by area.


test_find_all_favourites()   X-Ref
Test fetching favourites for single user, by area.


test_find_favourites_by_type_multiple_users()   X-Ref
Make sure the find_favourites_by_type() method only returns favourites for the scoped user.


test_find_favourites_by_type_nonexistent_component()   X-Ref
Test confirming that an exception is thrown if trying to get favourites for a non-existent component.


test_find_favourites_by_type_pagination()   X-Ref
Test confirming the pagination support for the find_favourites_by_type() method.


test_delete_favourite_basic()   X-Ref
Test confirming the basic deletion behaviour.


test_favourite_exists()   X-Ref
Test confirming the behaviour of the favourite_exists() method.


test_get_favourite()   X-Ref
Test confirming the behaviour of the get_favourite() method.


test_count_favourites_by_type()   X-Ref
Test confirming the behaviour of the count_favourites_by_type() method.


test_get_join_sql_by_type()   X-Ref
Verify that the join sql generated by get_join_sql_by_type is valid and can be used to include favourite information.