19 declare(strict_types=1);
32 $this->assignment_repo = $repo;
37 return \DateTimeImmutable::createFromFormat(
'Ymd',
'20221224');
40 protected function log(
string $msg): void
55 protected function setUp(): void
57 $this->events =
new ProgrammeEventsMock();
58 $this->settings_repo = $this->getMockBuilder(ilStudyProgrammeSettingsDBRepository::class)
59 ->disableOriginalConstructor()
60 ->onlyMethods([
'getProgrammeIdsWithMailsForExpiringValidity'])
63 $this->adapter = $this->getMockBuilder(ilPrgNotRestarted::class)
64 ->setConstructorArgs([$this->settings_repo, $this->events])
69 $this->assignment_repo = $this->getMockBuilder(ilPRGAssignmentDBRepository::class)
70 ->disableOriginalConstructor()
71 ->onlyMethods([
'getAboutToExpire',
'storeExpiryInfoSentFor'])
80 ->expects($this->once())
81 ->method(
'getRelevantProgrammeIds')
83 $this->assignment_repo
84 ->expects($this->never())
85 ->method(
'getAboutToExpire');
86 $this->assignment_repo
87 ->expects($this->never())
88 ->method(
'storeExpiryInfoSentFor');
90 ->expects($this->never())
91 ->method(
'actOnSingleAssignment');
99 ->withProgressTree($pgs1);
101 ->withProgressTree($pgs1);
104 ->expects($this->once())
105 ->method(
'getRelevantProgrammeIds')
109 $this->assignment_repo
110 ->expects($this->once())
111 ->method(
'getAboutToExpire')
112 ->willReturn([$ass1, $ass2]);
114 $this->assignment_repo
115 ->expects($this->exactly(2))
116 ->method(
'storeExpiryInfoSentFor');
119 ->expects($this->exactly(2))
120 ->method(
'actOnSingleAssignment');
132 ->expects($this->once())
133 ->method(
'getProgrammeIdsWithMailsForExpiringValidity')
139 $this->assignment_repo
140 ->expects($this->once())
141 ->method(
'getAboutToExpire')
142 ->willReturn([$ass1, $ass2]);
147 $this->assertEquals(2, count($job->logs));
149 [
'informUserToRestart', [
"ass_id" => 42,
'root_prg_id' => 11]],
150 [
'informUserToRestart', [
"ass_id" => 43,
'root_prg_id' => 11]]
152 $this->assertEquals($expected_events, $this->events->raised);
__construct(ilPRGAssignmentDBRepository $repo, ilPrgCronJobAdapter $adapter)
Inform a user, that her qualification is about to expire.
ilStudyProgrammeSettingsDBRepository $settings_repo
ilPRGAssignmentDBRepository $assignment_repo
ProgrammeEventsMock $events
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...
ilPrgUserNotRestartedCronJobMock $job
ilPrgCronJobAdapter $adapter
testAboutToExpireForRelevantProgrammes()
testAboutToExpireForNoRelevantProgrammes()
testAboutToExpireEvents()
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
ilPrgNotRestarted $real_adapter
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
ilPrgNotRestarted $adapter