Exemplo n.º 1
0
 function testGetCommentators()
 {
     $c1 = new MockTracker_Artifact_Changeset();
     $c2 = new MockTracker_Artifact_Changeset();
     $c3 = new MockTracker_Artifact_Changeset();
     $c4 = new MockTracker_Artifact_Changeset();
     $u1 = mock('PFUser');
     $u1->setReturnValue('getUserName', 'sandrae');
     $u2 = mock('PFUser');
     $u2->setReturnValue('getUserName', 'marc');
     $um = new MockUserManager();
     $um->setReturnReference('getUserById', $u1, array(101));
     $um->setReturnReference('getUserById', $u2, array(102));
     $artifact = new Tracker_ArtifactTestVersion();
     $artifact->setReturnValue('getChangesets', array($c1, $c2, $c3, $c4));
     $artifact->setReturnValue('getUserManager', $um);
     $c1->setReturnValue('getSubmittedBy', 101);
     $c2->setReturnValue('getSubmittedBy', 102);
     $c2->setReturnValue('getEmail', '*****@*****.**');
     $c3->setReturnValue('getSubmittedBy', null);
     $c3->setReturnValue('getEmail', '*****@*****.**');
     $c4->setReturnValue('getSubmittedBy', null);
     $c4->setReturnValue('getEmail', '');
     $this->assertEqual($artifact->getCommentators(), array('sandrae', 'marc', '*****@*****.**'));
 }