3 declare(strict_types=1);
34 $this->assignment_repo = $repo;
40 return \DateTimeImmutable::createFromFormat(
'Ymd',
'20221224');
43 protected function log(
string $msg): void
60 protected function setUp(): void
62 $this->events =
new ProgrammeEventsMock();
64 $this->settings_repo = $this->getMockBuilder(ilStudyProgrammeSettingsDBRepository::class)
65 ->disableOriginalConstructor()
66 ->onlyMethods([
'getProgrammeIdsWithReassignmentForExpiringValidity'])
69 $this->adapter = $this->getMockBuilder(ilPrgRestart::class)
70 ->setConstructorArgs([$this->settings_repo, $this->events])
73 $this->real_adapter =
new ilPrgRestart($this->settings_repo, $this->events);
75 $this->assignment_repo = $this->getMockBuilder(ilPRGAssignmentDBRepository::class)
76 ->disableOriginalConstructor()
77 ->onlyMethods([
'getAboutToExpire',
'store'])
80 $this->prg = $this->getMockBuilder(ilObjStudyProgramme::class)
81 ->disableOriginalConstructor()
82 ->onlyMethods([
'getApplicableMembershipSourceForUser',
'getSettings',
'assignUser',
'getRefIdFor'])
91 ->expects($this->once())
92 ->method(
'getRelevantProgrammeIds')
94 $this->assignment_repo
95 ->expects($this->never())
96 ->method(
'getAboutToExpire');
97 $this->assignment_repo
98 ->expects($this->never())
101 ->expects($this->never())
102 ->method(
'actOnSingleAssignment');
110 ->withProgressTree($pgs1)
111 ->withManuallyAssigned(
false);
113 ->withProgressTree($pgs1)
114 ->withManuallyAssigned(
true);
116 ->expects($this->once())
117 ->method(
'getRelevantProgrammeIds')
121 $this->assignment_repo
122 ->expects($this->once())
123 ->method(
'getAboutToExpire')
124 ->willReturn([$ass1, $ass2]);
126 $this->assignment_repo
127 ->expects($this->exactly(1))
130 $validity_settings = $this->getMockBuilder(ilStudyProgrammeValidityOfAchievedQualificationSettings::class)
131 ->disableOriginalConstructor()
132 ->onlyMethods([
'getRestartRecheck'])
136 ->expects($this->exactly(2))
137 ->method(
'getRestartRecheck')
140 $settings = $this->getMockBuilder(ilStudyProgrammeSettings::class)
141 ->disableOriginalConstructor()
142 ->onlyMethods([
'getValidityOfQualificationSettings'])
145 ->expects($this->exactly(2))
146 ->method(
'getValidityOfQualificationSettings')
147 ->willReturn($validity_settings);
150 ->expects($this->exactly(2))
151 ->method(
'getSettings')
155 ->expects($this->exactly(1))
156 ->method(
'getApplicableMembershipSourceForUser')
160 ->expects($this->exactly(1))
161 ->method(
'assignUser')
166 ->expects($this->exactly(1))
167 ->method(
'actOnSingleAssignment');
177 ->withManuallyAssigned(
true);
180 ->expects($this->once())
181 ->method(
'getProgrammeIdsWithReassignmentForExpiringValidity')
187 $this->assignment_repo
188 ->expects($this->once())
189 ->method(
'getAboutToExpire')
190 ->willReturn([$ass1, $ass2]);
192 ->expects($this->exactly(2))
193 ->method(
'assignUser')
194 ->will($this->onConsecutiveCalls($ass1, $ass2));
199 $this->assertEquals(2, count($job->logs));
201 [
'userReAssigned', [
"ass_id" => 42,
'root_prg_id' => 11]],
202 [
'userReAssigned', [
"ass_id" => 43,
'root_prg_id' => 11]]
204 $this->assertEquals($expected_events, $this->events->raised);
ilPRGAssignmentDBRepository $assignment_repo
testRestartAssignmentsForNoRelevantProgrammes()
getStudyProgramme(int $prg_obj_id)
testRestartAssignmentsEvents()
ilPrgRestartAssignmentsCronJobMock $job
ilPrgCronJobAdapter $adapter
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...
testRestartAssignmentsForRelevantProgrammes()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Re-assign users (according to restart-date).
ilStudyProgrammeSettingsDBRepository $settings_repo
__construct(ilPRGAssignmentDBRepository $repo, ilPrgCronJobAdapter $adapter, ilObjStudyProgramme $prg)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
ProgrammeEventsMock $events