3 declare(strict_types=1);
    33         $this->member_records = $arr;
    57     protected function setUp(): void
    59         $this->iass = $this->createMock(ilObjIndividualAssessment::class);
    65         $this->assertInstanceOf(ilIndividualAssessmentMembers::class, $obj);
    70         $obj = 
new TestObj($this->iass);
    71         $obj->initMemberRecords([1,2,3,4,5]);
    72         $this->assertEquals(5, $obj->count());
    77         $obj = 
new TestObj($this->iass);
    78         $obj->initMemberRecords([1,2,3,4,5]);
    79         $this->assertEquals(1, $obj->current());
    80         $obj->initMemberRecords([21,324,53,54,55]);
    81         $this->assertEquals(21, $obj->current());
    83         $this->assertEquals(324, $obj->current());
    88         $obj = 
new TestObj($this->iass);
    89         $obj->initMemberRecords([1]);
    91         $this->assertFalse($obj->current());
    96         $obj = 
new TestObj($this->iass);
    97         $obj->initMemberRecords([1,2,3,4]);
    98         $this->assertEquals(0, $obj->key());
   100         $this->assertEquals(1, $obj->key());
   105         $obj = 
new TestObj($this->iass);
   106         $obj->initMemberRecords([]);
   107         $this->assertNull($obj->key());
   112         $obj = 
new TestObj($this->iass);
   113         $obj->initMemberRecords([
"test" => 
"foo", 
"bar" => 
"boo"]);
   114         $this->assertEquals(
"test", $obj->key());
   116         $this->assertEquals(
"bar", $obj->key());
   121         $obj = 
new TestObj($this->iass);
   122         $obj->initMemberRecords([1,2,3,4,5]);
   126         $this->assertEquals(4, $obj->current());
   131         $obj = 
new TestObj($this->iass);
   132         $obj->initMemberRecords([1,2,3,4,5]);
   136         $this->assertEquals(4, $obj->current());
   138         $this->assertEquals(1, $obj->current());
   143         $obj = 
new TestObj($this->iass);
   144         $obj->initMemberRecords([1,2,3,4,5]);
   145         $this->assertTrue($obj->valid());
   150         $obj = 
new TestObj($this->iass);
   151         $obj->initMemberRecords([1]);
   152         $this->assertTrue($obj->valid());
   154         $this->assertFalse($obj->valid());
   159         $usr = $this->createMock(ilObjUser::class);
   161             ->expects($this->once())
   166             ->expects($this->once())
   167             ->method(
"getFirstname")
   168             ->willReturn(
"Firstname")
   171             ->expects($this->once())
   172             ->method(
"getLastname")
   173             ->willReturn(
"Lastname")
   176             ->expects($this->once())
   178             ->willReturn(
"Firstname Lastname")
   181         $obj = 
new TestObj($this->iass);
   182         $record = $obj->buildNewRecordOfUserWrapper($usr);
   184         $this->assertFalse($obj->recordOK($record));
   189         $usr = $this->getRecordOKUserMock();
   191         $obj = 
new TestObj($this->iass);
   193         $obj->initMemberRecords([23 => 
"already_member"]);
   194         $record = $obj->buildNewRecordOfUserWrapper($usr);
   196         $this->assertFalse($obj->recordOK($record));
   201         $usr = $this->getRecordOKUserMock();
   203         $obj = 
new TestObj($this->iass);
   205         $record = $obj->buildNewRecordOfUserWrapper($usr);
   208         $this->assertFalse($obj->recordOK($record));
   213         $usr = $this->getRecordOKUserMock();
   215         $obj = 
new TestObj($this->iass);
   217         $record = $obj->buildNewRecordOfUserWrapper($usr);
   219         $this->assertTrue($obj->recordOK($record));
   227         $usr = $this->createMock(ilObjUser::class);
   229             ->expects($this->once())
   234             ->expects($this->once())
   235             ->method(
"getFirstname")
   236             ->willReturn(
"Firstname")
   239             ->expects($this->once())
   240             ->method(
"getLastname")
   241             ->willReturn(
"Lastname")
   244             ->expects($this->once())
   246             ->willReturn(
"Firstname Lastname")
   254         $obj = 
new TestObj($this->iass);
   255         $obj->initMemberRecords([22 => 
"is_set"]);
   256         $this->assertTrue($obj->userAllreadyMemberByUsrId(22));
   261         $obj = 
new TestObj($this->iass);
   262         $obj->initMemberRecords([23 => 
"is_set"]);
   263         $this->assertFalse($obj->userAllreadyMemberByUsrId(22));
   268         $usr = $this->createMock(ilObjUser::class);
   270             ->expects($this->once())
   275         $obj = 
new TestObj($this->iass);
   276         $obj->initMemberRecords([22 => 
"is_set"]);
   277         $this->assertTrue($obj->userAllreadyMember($usr));
   282         $usr = $this->createMock(ilObjUser::class);
   284             ->expects($this->once())
   289         $obj = 
new TestObj($this->iass);
   290         $obj->initMemberRecords([23 => 
"is_set"]);
   291         $this->assertFalse($obj->userAllreadyMember($usr));
   296         $usr = $this->getRecordOKUserMock();
   298         $obj = 
new TestObj($this->iass);
   300         $record = $obj->buildNewRecordOfUserWrapper($usr);
   301         $new_obj = $obj->withAdditionalRecord($record);
   303         $records = $obj->getMemberRecords();
   304         $this->assertEmpty($records);
   306         $records = $new_obj->getMemberRecords();
   307         $record = $records[23];
   330         $obj = 
new TestObj($this->iass);
   332         $this->expectException(ilIndividualAssessmentException::class);
   333         $this->expectExceptionMessage(
"Ill defined record.");
   339         $usr = $this->createMock(ilObjUser::class);
   341             ->expects($this->any())
   346             ->expects($this->once())
   347             ->method(
"getFirstname")
   348             ->willReturn(
"Firstname")
   351             ->expects($this->once())
   352             ->method(
"getLastname")
   353             ->willReturn(
"Lastname")
   356             ->expects($this->once())
   358             ->willReturn(
"Firstname Lastname")
   361         $obj = 
new TestObj($this->iass);
   363         $new_obj = $obj->withAdditionalUser($usr);
   364         $record = $obj->getMemberRecords();
   365         $this->assertFalse(isset($record[23]));
   368         $record = $new_obj->getMemberRecords();
   369         $this->assertTrue(isset($record[23]));
   374         $usr = $this->createMock(ilObjUser::class);
   376             ->expects($this->any())
   381         $obj = 
new TestObj($this->iass);
   382         $obj->initMemberRecords([23 => 
"test"]);
   384         $this->expectException(ilIndividualAssessmentException::class);
   385         $this->expectExceptionMessage(
"User allready member");
   386         $obj->withAdditionalUser($usr);
   391         $usr = $this->createMock(ilObjUser::class);
   393             ->expects($this->any())
   398         $obj = 
new TestObj($this->iass);
   401         $new_obj = $obj->withoutPresentUser($usr);
   402         $record = $obj->getMemberRecords();
   403         $this->assertTrue(isset($record[23]));
   405         $record = $new_obj->getMemberRecords();
   406         $this->assertFalse(isset($record[23]));
   411         $usr = $this->createMock(ilObjUser::class);
   413             ->expects($this->any())
   418         $obj = 
new TestObj($this->iass);
   420         $this->expectException(ilIndividualAssessmentException::class);
   421         $this->expectExceptionMessage(
"User not member or allready finished");
   422         $obj->withoutPresentUser($usr);
   427         $usr = $this->createMock(ilObjUser::class);
   429             ->expects($this->any())
   434         $obj = 
new TestObj($this->iass);
   437         $this->expectException(ilIndividualAssessmentException::class);
   438         $this->expectExceptionMessage(
"User not member or allready finished");
   439         $obj->withoutPresentUser($usr);
   444         $keep_usr_ids = [18, 22];
   446         $obj = 
new TestObj($this->iass);
   447         $obj->initMemberRecords([
   457         $new_obj = $obj->withOnlyUsersByIds($keep_usr_ids);
   458         $this->assertEmpty(array_diff([23, 44, 365, 18, 44, 22, 16], array_keys($obj->getMemberRecords())));
   460         $this->assertEmpty(array_diff([18, 22], array_keys($new_obj->getMemberRecords())));
 test_userAllreadyMember()
 
test_userAllreadyMemberByUsrId()
 
test_withAdditionalRecord_exceptio()
 
const FIELD_INTERNAL_NOTE
 
test_withoutPresentUser_without_existing_user()
 
test_recordOK_with_non_existing_user()
 
test_withoutPresentUser()
 
const FIELD_LEARNING_PROGRESS
 
test_recordOK_with_already_existing_user()
 
initMemberRecords(array $arr)
 
buildNewRecordOfUser(ilObjUser $usr)
 
const FIELD_CHANGER_FIRSTNAME
 
test_withAdditionalRecord()
 
const FIELD_USER_VIEW_FILE
 
test_userAllreadyMember_false()
 
test_withAdditionalUser()
 
test_withoutPresentUser_already_finalized()
 
test_recordOK_with_wrong_lp_status()
 
const FIELD_EXAMINER_FIRSTNAME
 
test_userAllreadyMemberByUsrId_false()
 
buildNewRecordOfUserWrapper(ilObjUser $user)
 
const FIELD_EXAMINER_LASTNAME
 
const FIELD_CHANGER_LASTNAME
 
test_withOnlyUsersByIds()
 
Member administration related logic, add and remove members, get the list of all members, etc ... 
 
test_withAdditionalUser_exception()