ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ExcPeerReviewTest Class Reference

Test peer reviews. More...

+ Inheritance diagram for ExcPeerReviewTest:
+ Collaboration diagram for ExcPeerReviewTest:

Public Member Functions

 testDistributionNumberOfPeers ()
 Test if each rater has $num_assignments peers. More...
 
 testDistributionNumberOfRaters ()
 Test if each peer is assigned to $num_assignments raters. More...
 
 testDistributionNoSelfAssignment ()
 Test if raters are not assigned as peers to themselves. More...
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 getDistribution ($user_ids, $num_assignments)
 

Detailed Description

Test peer reviews.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 10 of file ExcPeerReviewTest.php.

Member Function Documentation

◆ getDistribution()

ExcPeerReviewTest::getDistribution (   $user_ids,
  $num_assignments 
)
protected

Definition at line 23 of file ExcPeerReviewTest.php.

Referenced by testDistributionNoSelfAssignment(), testDistributionNumberOfPeers(), and testDistributionNumberOfRaters().

24  {
25  include_once("./Modules/Exercise/PeerReview/class.ExcPeerReviewDistribution.php");
26  return new \ILIAS\Exercise\PeerReview\ExcPeerReviewDistribution($user_ids, $num_assignments);
27  }
+ Here is the caller graph for this function:

◆ setUp()

ExcPeerReviewTest::setUp ( )
protected

Definition at line 14 of file ExcPeerReviewTest.php.

14  : void
15  {
16  parent::setUp();
17  }

◆ tearDown()

ExcPeerReviewTest::tearDown ( )
protected

Definition at line 19 of file ExcPeerReviewTest.php.

19  : void
20  {
21  }

◆ testDistributionNoSelfAssignment()

ExcPeerReviewTest::testDistributionNoSelfAssignment ( )

Test if raters are not assigned as peers to themselves.

Definition at line 71 of file ExcPeerReviewTest.php.

References getDistribution().

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  }
getDistribution($user_ids, $num_assignments)
+ Here is the call graph for this function:

◆ testDistributionNumberOfPeers()

ExcPeerReviewTest::testDistributionNumberOfPeers ( )

Test if each rater has $num_assignments peers.

Definition at line 32 of file ExcPeerReviewTest.php.

References getDistribution().

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  }
getDistribution($user_ids, $num_assignments)
+ Here is the call graph for this function:

◆ testDistributionNumberOfRaters()

ExcPeerReviewTest::testDistributionNumberOfRaters ( )

Test if each peer is assigned to $num_assignments raters.

Definition at line 47 of file ExcPeerReviewTest.php.

References getDistribution().

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  }
getDistribution($user_ids, $num_assignments)
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: