1818
1919use coding_exception ;
2020use mod_ratingallocate_generator ;
21+ use PHPUnit \Framework \Attributes \CoversClass ;
22+ use PHPUnit \Framework \Attributes \CoversFunction ;
23+ use PHPUnit \Framework \Attributes \CoversMethod ;
2124use stdClass ;
2225
2326defined ('MOODLE_INTERNAL ' ) || die ();
3639 * @author Philipp Memmel
3740 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3841 */
42+ #[CoversClass(ratingallocate::class)]
43+ #[CoversFunction('get_choice_groups ' )]
44+ #[CoversFunction('get_all_groups_of_choices ' )]
45+ #[CoversFunction('get_user_groupids ' )]
46+ #[CoversFunction('get_undistributed_users_with_groupscount ' )]
47+ #[CoversFunction('get_undistributed_users ' )]
48+ #[CoversFunction('get_choices_with_allocationcount ' )]
49+ #[CoversFunction('get_allocations_for_user ' )]
3950final class mod_ratingallocate_allocate_unrated_test extends \advanced_testcase {
4051
4152 /** @var stdClass Course object. */
@@ -91,6 +102,7 @@ protected function setUp(): void {
91102 * Asserts that there is no allocation violating the group restrictions. This should be called after the algorithms have been
92103 * run to assert that the algorithm did respect the group restrictions when allocating.
93104 *
105+ * @covers ::get_choice_groups
94106 * @return void
95107 */
96108 private function test_group_memberships (): void {
@@ -322,6 +334,7 @@ public function test_get_undistributed_users(): void {
322334 * Helper method to retrieve the choice id by the title.
323335 *
324336 * @param string $title title of the choice to get the id
337+ * @covers ::get_rateable_choices
325338 * @return int the id of the choice object
326339 */
327340 private function get_choice_id_by_title (string $ title ): int {
@@ -395,6 +408,7 @@ private function assert_allocation_of_random_users(): void {
395408 * Test distribution without groups.
396409 *
397410 * @return void
411+ * @covers ::queue_distribution_of_users_without_choice
398412 * @throws coding_exception
399413 */
400414 public function test_distribution_without_groups (): void {
@@ -464,6 +478,7 @@ public function test_allocation_with_groups_common_features(): void {
464478 * test_allocation_with_groups function.
465479 *
466480 * @param string $algorithm the algorithm to use for running this test function
481+ * @covers ::queue_distribution_of_users_without_choice
467482 * @return void
468483 */
469484 private function test_allocation_with_groups_with_algorithm (string $ algorithm ): void {
@@ -524,6 +539,7 @@ private function test_allocation_with_groups_with_algorithm(string $algorithm):
524539 /**
525540 * Test the distribution of users to choices with group restrictions, using both algorithms.
526541 *
542+ * @covers ::queue_distribution_of_users_without_choice
527543 * @return void
528544 * @throws coding_exception
529545 */
@@ -538,6 +554,7 @@ public function test_allocation_without_groups_common_features(): void {
538554 * This is a private method because she is being called twice to test both algorithms.
539555 *
540556 * @param string $algorithm the algorithm to use for the distribution
557+ * @covers ::queue_distribution_of_users_without_choice
541558 * @return void
542559 * @throws coding_exception
543560 */
@@ -586,6 +603,7 @@ private function test_allocation_without_groups_with_algorithm(string $algorithm
586603 * Test the EQUALLY algorithm without groups. The algorithm tries to distribute the users so that each choice has equal places
587604 * left or at most there is a difference of one user for the left places per choice.
588605 *
606+ * @covers ::queue_distribution_of_users_without_choice
589607 * @return void
590608 * @throws dml_exception
591609 */
@@ -638,6 +656,7 @@ public function test_distribute_equally_without_groups(): void {
638656 * Test the FILL algorithm without groups. This algorithm just fills up every choice. Choices with least places left are
639657 * being filled up first.
640658 *
659+ * @covers ::queue_distribution_of_users_without_choice
641660 * @return void
642661 */
643662 public function test_distribute_fill_without_groups (): void {
0 commit comments