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]

Testing the service layer within core_favourites.

Copyright: 2018 Jake Dallimore <jrhdallimore@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 517 lines (25 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: user_favourite_service_testcase  - 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.