Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 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.

Unit tests for the core_rating implementation of the Privacy API.

Copyright: 2018 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 436 lines (21 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

core_rating_privacy_testcase:: (7 methods):
  rate_as_user()
  test_get_sql_join()
  test_get_sql_join_inner()
  test_export_area_ratings()
  test_delete_ratings()
  test_delete_ratings_select()
  assert_has_rating()


Class: core_rating_privacy_testcase  - X-Ref

Unit tests for the core_rating implementation of the Privacy API.

rate_as_user($userid, $component, $ratingarea, $itemid, $context, $score)   X-Ref
Rate something as a user.

param: int         $userid
param: string      $component
param: string      $ratingarea
param: int         $itemid
param: \context    $context
param: string      $score

test_get_sql_join()   X-Ref
Ensure that the get_sql_join function returns valid SQL which returns the correct list of rated itemids.


test_get_sql_join_inner()   X-Ref
Ensure that the get_sql_join function returns valid SQL which returns the correct list of rated itemids.
This makes use of the optional inner join argument.


test_export_area_ratings()   X-Ref
Ensure that export_area_ratings exports all ratings that a user has made, and all ratings for a users own content.


test_delete_ratings()   X-Ref
Test delete_ratings() method.


test_delete_ratings_select()   X-Ref
Test delete_ratings_select() method.


assert_has_rating($author, $score, $actual)   X-Ref
Assert that a user has the correct rating.

param: \stdClass   $author The user with the rating
param: int         $score The rating that was given
param: \stdClass[] The ratings which were found