ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ExcPeerReviewTest.php
Go to the documentation of this file.
1 <?php
2 
4 
10 class ExcPeerReviewTest extends TestCase
11 {
12  //protected $backupGlobals = false;
13 
14  protected function setUp() : void
15  {
16  parent::setUp();
17  }
18 
19  protected function tearDown() : void
20  {
21  }
22 
23  protected function getDistribution($user_ids, $num_assignments)
24  {
25  include_once("./Modules/Exercise/PeerReview/class.ExcPeerReviewDistribution.php");
26  return new \ILIAS\Exercise\PeerReview\ExcPeerReviewDistribution($user_ids, $num_assignments);
27  }
28 
33  {
34  $user_ids = [100,200,300,400,500];
35  $num_assignments = 3;
36 
37  $distribution = $this->getDistribution($user_ids, $num_assignments);
38 
39  foreach ($user_ids as $user_id) {
40  $this->assertEquals(count($distribution->getPeersOfRater($user_id)), $num_assignments);
41  }
42  }
43 
48  {
49  $user_ids = [10,20,30,40,50];
50  $num_assignments = 4;
51 
52  $distribution = $this->getDistribution($user_ids, $num_assignments);
53 
54  $peer_raters = [];
55  foreach ($user_ids as $user_id) {
56  foreach ($distribution->getPeersOfRater($user_id) as $peer) {
57  $peer_raters[$peer][$user_id] = $user_id;
58  }
59  }
60 
61  $this->assertEquals(count($peer_raters), count($user_ids));
62 
63  foreach ($peer_raters as $peer => $raters) {
64  $this->assertEquals(count($raters), $num_assignments);
65  }
66  }
67 
72  {
73  $user_ids = [10,20,30,40,50];
74  $num_assignments = 4;
75 
76  $distribution = $this->getDistribution($user_ids, $num_assignments);
77 
78  foreach ($user_ids as $user_id) {
79  foreach ($distribution->getPeersOfRater($user_id) as $peer) {
80  $this->assertNotEquals($user_id, $peer);
81  }
82  }
83  }
84 }
getDistribution($user_ids, $num_assignments)
testDistributionNoSelfAssignment()
Test if raters are not assigned as peers to themselves.
testDistributionNumberOfPeers()
Test if each rater has $num_assignments peers.
Test peer reviews.
testDistributionNumberOfRaters()
Test if each peer is assigned to $num_assignments raters.