3 declare(strict_types=1);
32 $this->assignment_repo = $repo;
37 return \DateTimeImmutable::createFromFormat(
'Ymd',
'20221224');
40 protected function log(
string $msg): void
53 protected function setUp(): void
55 $this->events =
new ProgrammeEventsMock();
56 $this->settings_repo = $this->getMockBuilder(ilStudyProgrammeSettingsDBRepository::class)
57 ->disableOriginalConstructor()
58 ->onlyMethods([
'getProgrammeIdsWithMailsForExpiringValidity'])
61 $this->adapter = $this->getMockBuilder(ilPrgNotRestarted::class)
62 ->setConstructorArgs([$this->settings_repo, $this->events])
67 $this->assignment_repo = $this->getMockBuilder(ilPRGAssignmentDBRepository::class)
68 ->disableOriginalConstructor()
69 ->onlyMethods([
'getAboutToExpire',
'storeExpiryInfoSentFor'])
78 ->expects($this->once())
79 ->method(
'getRelevantProgrammeIds')
81 $this->assignment_repo
82 ->expects($this->never())
83 ->method(
'getAboutToExpire');
84 $this->assignment_repo
85 ->expects($this->never())
86 ->method(
'storeExpiryInfoSentFor');
88 ->expects($this->never())
89 ->method(
'actOnSingleAssignment');
97 ->withProgressTree($pgs1);
99 ->withProgressTree($pgs1);
102 ->expects($this->once())
103 ->method(
'getRelevantProgrammeIds')
107 $this->assignment_repo
108 ->expects($this->once())
109 ->method(
'getAboutToExpire')
110 ->willReturn([$ass1, $ass2]);
112 $this->assignment_repo
113 ->expects($this->exactly(2))
114 ->method(
'storeExpiryInfoSentFor');
117 ->expects($this->exactly(2))
118 ->method(
'actOnSingleAssignment');
130 ->expects($this->once())
131 ->method(
'getProgrammeIdsWithMailsForExpiringValidity')
137 $this->assignment_repo
138 ->expects($this->once())
139 ->method(
'getAboutToExpire')
140 ->willReturn([$ass1, $ass2]);
145 $this->assertEquals(2, count($job->logs));
147 [
'informUserToRestart', [
"ass_id" => 42,
'root_prg_id' => 11]],
148 [
'informUserToRestart', [
"ass_id" => 43,
'root_prg_id' => 11]]
150 $this->assertEquals($expected_events, $this->events->raised);
__construct(ilPRGAssignmentDBRepository $repo, ilPrgCronJobAdapter $adapter)
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...
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilPrgCronJobAdapter $adapter
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testAboutToExpireForRelevantProgrammes()
testAboutToExpireForNoRelevantProgrammes()
testAboutToExpireEvents()
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...