Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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.

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

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.