2 require_once
'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMembers.php';
3 require_once
'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMember.php';
4 require_once
'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMembersStorageDB.php';
5 require_once
'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentSettings.php';
6 require_once
'Modules/IndividualAssessment/interfaces/AccessControl/interface.IndividualAssessmentAccessHandler.php';
7 require_once
'Modules/IndividualAssessment/interfaces/Notification/interface.ilIndividualAssessmentNotificator.php';
24 public static $created_users = array();
28 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
29 ilUnitUtil::performInitialisation();
35 $user->setFirstname(
'iass_test_firstname' . (
count(self::$created_users) + time()));
36 $user->setLastname(
'iass_test_lastname' . (
count(self::$created_users) + time()));
37 $user->setLogin(
'iass_tesst_login' . (
count(self::$created_users) + time()));
40 self::$created_users[] =
$user;
49 foreach ($members as $member_id => $member_data) {
51 $usr_it[] = $member_id;
52 $this->assertTrue(isset($usr_list[$member_id]));
55 foreach ($usr_list as $usr_id => $usr) {
56 $this->assertTrue($members->userAllreadyMember($usr));
58 $this->assertEquals(
count($usr_it),
count($usr_list));
63 return $this->createMock(
'IndividualAssessmentAccessHandler');
68 return $this->createMock(
'ilIndividualAssessmentNotificator');
74 $iass ->setTitle(
"iass_test");
75 $iass ->setDescription(
"iass_test_desc");
76 $iass ->setId(100000000);
79 return array(
$iass,$storage);
89 $members = $storage->loadMembers(
$iass);
91 $usr_1 = $this->createUser();
92 $usr_2 = $this->createUser();
94 $usrs = array($usr_1->getId() => $usr_1,$usr_2->getId() => $usr_2);
95 $members = $members->withAdditionalUser($usr_1)->withAdditionalUser($usr_2);
96 $members->updateStorageAndRBAC($storage, $this->rbacHandlerMock());
97 $this->compareMembersUsrList($members, $usrs);
99 return array($usrs,
$iass,$storage);
110 $members = $storage->loadMembers(
$iass);
111 $this->compareMembersUsrList($members, $usrs);
112 return array($usrs,
$iass,$storage);
123 foreach ($usrs as $usr_id => $usr) {
124 $member = $storage->loadMember(
$iass, $usr);
125 $this->assertEquals($usr_id, $member->id());
127 $this->assertEquals($member->lastname(), $usr->getLastname());
128 $member = $member->withRecord(
"record_of" . $usr_id);
129 $storage->updateMember($member);
131 return array($usrs,
$iass,$storage);
142 foreach ($usrs as $usr_id => $usr) {
143 $member = $storage->loadMember(
$iass, $usr);
144 $this->assertEquals($usr_id, $member->id());
145 $this->assertEquals($member->record(),
"record_of" . $usr_id);
146 $this->assertEquals($member->lastname(), $usr->getLastname());
148 $storage->updateMember($member);
150 return array($usrs,
$iass,$storage);
161 $new_usr = $this->createUser();
162 $members = $storage->loadMembers(
$iass)->withAdditionalUser($new_usr);
163 $members->updateStorageAndRBAC($storage, $this->rbacHandlerMock());
164 $members = $storage->loadMembers(
$iass);
165 $usrs[$new_usr->getId()] = $new_usr;
166 $this->compareMembersUsrList($members, $usrs);
167 $members->withoutPresentUser($new_usr)->updateStorageAndRBAC($storage, $this->rbacHandlerMock());
168 $members = $storage->loadMembers(
$iass);
169 unset($usrs[$new_usr->getId()]);
170 $this->compareMembersUsrList($members, $usrs);
171 return array($usrs,
$iass,$storage);
183 $member = $storage->loadMember(
$iass,
current($usrs))->withFinalized();
196 $this->assertTrue($storage->loadMember(
$iass,
current($usrs))->finalized());
197 return array($usrs,
$iass,$storage);
221 $storage->loadMember(
$iass,
current($usrs))->withFinalized();
227 ->getMockBuilder(\ilObjIndividualAssessment::class)
228 ->disableOriginalConstructor()
233 $records = [1 => 1, 2 => 2, 3 => 3, 23 => 23, 42 => 42, 1337 => 1337];
235 $members->setMemberRecords(
$records);
237 $members = $members->withOnlyUsersByIds([3,42]);
239 $this->assertEquals([3, 42], $members->membersIds());
245 ->getMockBuilder(\ilOrgUnitPositionAndRBACAccessHandler::class)
246 ->setMethods([
"filterUserIdsByRbacOrPositionOfCurrentUser",
"checkRbacOrPositionPermissionAccess"])
250 ->getMockBuilder(\ilObjIndividualAssessment::class)
251 ->disableOriginalConstructor()
252 ->setMethods([
"getRefId"])
256 ->getMockBuilder(\ilIndividualAssessmentMembers::class)
257 ->setMethods([
"withOnlyUsersByIds",
"membersIds",
"referencedObject"])
258 ->disableOriginalConstructor()
263 $obj->method(
"getRefId")->willReturn($ref_id);
265 $user_ids = [1,2,3,23,42,1337];
266 $keep_user_ids = [3, 23];
269 ->expects($this->
once())
270 ->method(
"membersIds")
271 ->willReturn($user_ids);
274 ->expects($this->
once())
275 ->method(
"referencedObject")
279 ->expects($this->
once())
280 ->method(
"filterUserIdsByRbacOrPositionOfCurrentUser")
281 ->with(
"read_learning_progress",
"read_learning_progress", $ref_id, $user_ids)
282 ->willReturn($keep_user_ids);
285 ->expects($this->
once())
286 ->method(
"withOnlyUsersByIds")
287 ->with($keep_user_ids);
289 $members->withAccessHandling($ah);
295 foreach (self::$created_users as
$user) {
297 $ilDB->manipulate(
'DELETE FROM iass_settings WHERE obj_id = 100000000');
298 $ilDB->manipulate(
'DELETE FROM iass_info_settings WHERE obj_id = 100000000');
299 $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.
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
const DEF_RECORD_TEMPLATE
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