5 require_once
'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMembers.php';
6 require_once
'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMember.php';
7 require_once
'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMembersStorageDB.php';
8 require_once
'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentSettings.php';
9 require_once
'Modules/IndividualAssessment/interfaces/AccessControl/interface.IndividualAssessmentAccessHandler.php';
10 require_once
'Modules/IndividualAssessment/interfaces/Notification/interface.ilIndividualAssessmentNotificator.php';
16 $this->member_records = $records;
27 public static $created_users = array();
31 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
32 ilUnitUtil::performInitialisation();
38 $user->setFirstname(
'iass_test_firstname' . (
count(self::$created_users) + time()));
39 $user->setLastname(
'iass_test_lastname' . (
count(self::$created_users) + time()));
40 $user->setLogin(
'iass_tesst_login' . (
count(self::$created_users) + time()));
43 self::$created_users[] = $user;
52 foreach ($members as $member_id => $member_data) {
54 $usr_it[] = $member_id;
55 $this->assertTrue(isset($usr_list[$member_id]));
58 foreach ($usr_list as $usr_id => $usr) {
59 $this->assertTrue($members->userAllreadyMember($usr));
61 $this->assertEquals(
count($usr_it),
count($usr_list));
66 return $this->createMock(
'IndividualAssessmentAccessHandler');
71 return $this->createMock(
'ilIndividualAssessmentNotificator');
77 $iass ->setTitle(
"iass_test");
78 $iass ->setDescription(
"iass_test_desc");
79 $iass ->setId(100000000);
82 return array(
$iass,$storage);
92 $members = $storage->loadMembers(
$iass);
94 $usr_1 = $this->createUser();
95 $usr_2 = $this->createUser();
97 $usrs = array($usr_1->getId() => $usr_1,$usr_2->getId() => $usr_2);
98 $members = $members->withAdditionalUser($usr_1)->withAdditionalUser($usr_2);
99 $members->updateStorageAndRBAC($storage, $this->rbacHandlerMock());
100 $this->compareMembersUsrList($members, $usrs);
102 return array($usrs,
$iass,$storage);
113 $members = $storage->loadMembers(
$iass);
114 $this->compareMembersUsrList($members, $usrs);
115 return array($usrs,
$iass,$storage);
126 foreach ($usrs as $usr_id => $usr) {
127 $member = $storage->loadMember(
$iass, $usr);
128 $this->assertEquals($usr_id, $member->id());
129 $this->assertEquals($member->record(), ilIndividualAssessmentSettings::DEF_RECORD_TEMPLATE);
130 $this->assertEquals($member->lastname(), $usr->getLastname());
131 $member = $member->withRecord(
"record_of" . $usr_id);
132 $storage->updateMember($member);
134 return array($usrs,
$iass,$storage);
145 foreach ($usrs as $usr_id => $usr) {
146 $member = $storage->loadMember(
$iass, $usr);
147 $this->assertEquals($usr_id, $member->id());
148 $this->assertEquals($member->record(),
"record_of" . $usr_id);
149 $this->assertEquals($member->lastname(), $usr->getLastname());
150 $member = $member->withRecord(ilIndividualAssessmentSettings::DEF_RECORD_TEMPLATE);
151 $storage->updateMember($member);
153 return array($usrs,
$iass,$storage);
164 $new_usr = $this->createUser();
165 $members = $storage->loadMembers(
$iass)->withAdditionalUser($new_usr);
166 $members->updateStorageAndRBAC($storage, $this->rbacHandlerMock());
167 $members = $storage->loadMembers(
$iass);
168 $usrs[$new_usr->getId()] = $new_usr;
169 $this->compareMembersUsrList($members, $usrs);
170 $members->withoutPresentUser($new_usr)->updateStorageAndRBAC($storage, $this->rbacHandlerMock());
171 $members = $storage->loadMembers(
$iass);
172 unset($usrs[$new_usr->getId()]);
173 $this->compareMembersUsrList($members, $usrs);
174 return array($usrs,
$iass,$storage);
186 $member = $storage->loadMember(
$iass,
current($usrs))->withFinalized();
199 $this->assertTrue($storage->loadMember(
$iass,
current($usrs))->finalized());
200 return array($usrs,
$iass,$storage);
224 $storage->loadMember(
$iass,
current($usrs))->withFinalized();
230 ->getMockBuilder(\ilObjIndividualAssessment::class)
231 ->disableOriginalConstructor()
236 $records = [1 => 1, 2 => 2, 3 => 3, 23 => 23, 42 => 42, 1337 => 1337];
238 $members->setMemberRecords($records);
240 $members = $members->withOnlyUsersByIds([3,42]);
242 $this->assertEquals([3, 42], $members->membersIds());
248 ->getMockBuilder(\ilOrgUnitPositionAndRBACAccessHandler::class)
249 ->setMethods([
"filterUserIdsByRbacOrPositionOfCurrentUser",
"checkRbacOrPositionPermissionAccess"])
253 ->getMockBuilder(\ilObjIndividualAssessment::class)
254 ->disableOriginalConstructor()
255 ->setMethods([
"getRefId"])
259 ->getMockBuilder(\ilIndividualAssessmentMembers::class)
260 ->setMethods([
"withOnlyUsersByIds",
"membersIds",
"referencedObject"])
261 ->disableOriginalConstructor()
266 $obj->method(
"getRefId")->willReturn($ref_id);
268 $user_ids = [1,2,3,23,42,1337];
269 $keep_user_ids = [3, 23];
272 ->expects($this->once())
273 ->method(
"membersIds")
274 ->willReturn($user_ids);
277 ->expects($this->once())
278 ->method(
"referencedObject")
282 ->expects($this->once())
283 ->method(
"filterUserIdsByRbacOrPositionOfCurrentUser")
284 ->with(
"read_learning_progress",
"read_learning_progress", $ref_id, $user_ids)
285 ->willReturn($keep_user_ids);
288 ->expects($this->once())
289 ->method(
"withOnlyUsersByIds")
290 ->with($keep_user_ids);
292 $members->withAccessHandling($ah);
298 foreach (self::$created_users as $user) {
300 $ilDB->manipulate(
'DELETE FROM iass_settings WHERE obj_id = 100000000');
301 $ilDB->manipulate(
'DELETE FROM iass_info_settings WHERE obj_id = 100000000');
302 $ilDB->manipulate(
'DELETE FROM iass_members WHERE obj_id = 100000000');
For the purpose of streamlining the grading and learning-process status definition outside of tests...
static tearDownAfterClass()
current()
Iterator Methods.
test_reload_member($args)
test_load_member
test_finalize_graded($args)
test_remove_members
test_withAccessHandling()
compareMembersUsrList($members, $usr_list)
test_finalize_nongraded($args)
test_remove_members ilIndividualAssessmentException
test_load_member($args)
test_load_members
setMemberRecords(array $records)
disabled needsInstalledILIAS
count()
Countable Methods.
test_load_members($args)
test_create_members
test_re_grade($args)
test_finalize_graded ilIndividualAssessmentException
test_withOnlyUsersByIds()
test_remove_members($args)
test_reload_member
test_create_members($args)
test_init_iass
Member administration related logic, add and remove members, get the list of all members, etc.
test_re_finalize($args)
test_finalize_graded ilIndividualAssessmentException