ILIAS  release_7 Revision v7.30-3-g800a261c036
ilStudyProgrammeProgressCalculationsTest Class Reference
+ Inheritance diagram for ilStudyProgrammeProgressCalculationsTest:
+ Collaboration diagram for ilStudyProgrammeProgressCalculationsTest:

Public Member Functions

 setUp ()
 
 testInternalTreeIntegrity ()
 
 testInternalRunIntegrity ()
 
 testParentAcquisition ()
 ── 1 ├── 11 │ ├── 111 │ └── 112 ├── 12 └── 13 More...
 
 testChildrenPossiblePointsAddition ()
 ── 1 (1) ├── 11 (8) │ ├── 111 (5) │ └── 112 (10) <– turns irrelevant ├── 12 (12) <– turns irrelevant └── 13 (10) More...
 
 testAchievedPoints ()
 ── 1 (1) ├── 11 (8) │ ├── 111 (5) │ └── 112 (10) ├── 12 (12) └── 13 (10) More...
 
 testMarkAccreditedShouldCompleteParentBySufficientPoints ()
 PRG: MODE_POINTS ── 1 (5) ├── 11 (12) │ ├── 111 (5) │ └── 112 (7) ├── 12 (2) └── 13 (2) More...
 
 testMarkAccreditedOnLPNode ()
 ── 1 (10) ├── 11 (5, LP) └── 12 (5) More...
 
 testMarkAccreditedShouldNotChangeIrrelevantParent ()
 ── 1 ├── 11 (irrelevant) │ ├── 111 │ └── 112 ├── 12 └── 13 More...
 
 testMarkRelevantShouldRecalculateStatusAndPoints ()
 
 testSuccessionCompletingParents ()
 
 testMarkIrrelevantDoesNotCompleteParent ()
 
 testFailByDeadline ()
 
 testDontFailByFutureDeadline ()
 
 testDontFailByDeadlineIfSucceeded ()
 
 testChangingDeadline ()
 
 testDontChangeDeadlineForCompleted ()
 
 testTranstitionToProgressWithPastDeadline ()
 
 testChangingValidity ()
 
 testDontChangeValidityForIncomplete ()
 
 testMarkAsIndividual ()
 
 testUpdateFromSettingsResetsIndividual ()
 
 testUpdatePlanFromSettings ()
 

Protected Member Functions

 buildProgramme (int $prg_id)
 
 getRootPrg ()
 
 setPointsForNode (int $node_id, int $points)
 
 setModeForNode (int $node_id, int $mode)
 

Detailed Description

Definition at line 7 of file ilStudyProgrammeProgressCalculationsTest.php.

Member Function Documentation

◆ buildProgramme()

ilStudyProgrammeProgressCalculationsTest::buildProgramme ( int  $prg_id)
protected

Definition at line 9 of file ilStudyProgrammeProgressCalculationsTest.php.

10 {
11 $prg = new PrgMock($prg_id, $this);
12 $settings = new SettingsMock(
13 $prg_id
14 );
15 $settings->setLPMode(ilStudyProgrammeSettings::MODE_POINTS);
17 $set_dl = new ilStudyProgrammeDeadlineSettings(null, null);
18 $set_vq = new ilStudyProgrammeValidityOfAchievedQualificationSettings(null, null, null);
19 $settings = $settings
20 ->withAssessmentSettings($set_ass)
21 ->withDeadlineSettings($set_dl)
22 ->withValidityOfQualificationSettings($set_vq);
23 $this->settings_repo->update($settings);
24
25 $progress = (new ilStudyProgrammeProgress($prg_id * -1))
26 ->withUserId(666)
28 ->withAmountOfPoints(2)
29 ->withAssignmentId(-42)
30 ->withNodeId($prg_id);
31 $this->progress_repo->update($progress);
32 return $prg;
33 }
Class ilStudyProgrammeProgress.

References ilStudyProgrammeSettings\MODE_POINTS, ilStudyProgrammeAssessmentSettings\STATUS_ACTIVE, and ilStudyProgrammeProgress\STATUS_IN_PROGRESS.

Referenced by setUp().

+ Here is the caller graph for this function:

◆ getRootPrg()

◆ setModeForNode()

ilStudyProgrammeProgressCalculationsTest::setModeForNode ( int  $node_id,
int  $mode 
)
protected

Definition at line 79 of file ilStudyProgrammeProgressCalculationsTest.php.

80 {
81 $set = $this->settings_repo->get($node_id)->setLPMode($mode);
82 $this->settings_repo->update($set);
83 }

Referenced by testMarkAccreditedOnLPNode(), and testSuccessionCompletingParents().

+ Here is the caller graph for this function:

◆ setPointsForNode()

ilStudyProgrammeProgressCalculationsTest::setPointsForNode ( int  $node_id,
int  $points 
)
protected

Definition at line 70 of file ilStudyProgrammeProgressCalculationsTest.php.

71 {
73 $this->settings_repo->update($this->settings_repo->get($node_id)->withAssessmentSettings($set));
74 $this->progress_repo->update($this->progress_repo->get($node_id)->withAmountOfPoints($points));
75
76 $this->assertEquals($points, $this->mock_tree[$node_id]['prg']->getPoints());
77 }

References ilStudyProgrammeAssessmentSettings\STATUS_ACTIVE.

Referenced by testAchievedPoints(), testChildrenPossiblePointsAddition(), testMarkAccreditedOnLPNode(), testMarkAccreditedShouldCompleteParentBySufficientPoints(), testMarkIrrelevantDoesNotCompleteParent(), and testSuccessionCompletingParents().

+ Here is the caller graph for this function:

◆ setUp()

ilStudyProgrammeProgressCalculationsTest::setUp ( )

Definition at line 35 of file ilStudyProgrammeProgressCalculationsTest.php.

35 : void
36 {
37 $this->progress_repo = new ProgressRepoMock();
38 $this->assignment_repo = new AssignmentRepoMock();
39 $this->settings_repo = new SettingsRepoMock();
40 $this->messages = new ilPRGMessageCollection();
41
42 /*
43 └── 1
44 ├── 11
45 │ ├── 111
46 │ └── 112
47 ├── 12
48 └── 13
49 */
50 $this->mock_tree = [
51 1 => ['parent' => null, 'children' => [11,12,13], 'prg' => $this->buildProgramme(1)],
52 11 => ['parent' => 1, 'children' => [111,112], 'prg' => $this->buildProgramme(11)],
53 111 => ['parent' => 11, 'children' => [], 'prg' => $this->buildProgramme(111)],
54 112 => ['parent' => 11, 'children' => [], 'prg' => $this->buildProgramme(112)],
55 12 => ['parent' => 1, 'children' => [], 'prg' => $this->buildProgramme(12)],
56 13 => ['parent' => 1, 'children' => [], 'prg' => $this->buildProgramme(13)]
57 ];
58
59 $assignment = (new ilStudyProgrammeAssignment(-42))
60 ->withRootId(1);
61 $this->assignment_repo->update($assignment);
62 }
Holds information about multi-actions, mainly in context of member-assignemnts and status changes.
Represents one assignment of the user to a program tree.

References buildProgramme().

+ Here is the call graph for this function:

◆ testAchievedPoints()

ilStudyProgrammeProgressCalculationsTest::testAchievedPoints ( )

── 1 (1) ├── 11 (8) │ ├── 111 (5) │ └── 112 (10) ├── 12 (12) └── 13 (10)

Definition at line 195 of file ilStudyProgrammeProgressCalculationsTest.php.

196 {
197 $this->setPointsForNode(111, 5);
198 $this->setPointsForNode(112, 10);
199 $this->setPointsForNode(11, 8);
200 $this->setPointsForNode(1, 1);
201 $this->setPointsForNode(12, 12);
202 $this->setPointsForNode(13, 10);
203 $prg = $this->getRootPrg();
204
205 $this->assertEquals(0, $prg->getAchievedPointsOfChildren($this->progress_repo->get(12)));
206 $this->assertEquals(0, $prg->getAchievedPointsOfChildren($this->progress_repo->get(11)));
207 $this->assertEquals(0, $prg->getAchievedPointsOfChildren($this->progress_repo->get(1)));
208
209 $prg->markAccredited(12, 6, $this->messages);
210 $prg->markAccredited(13, 6, $this->messages);
211 $this->assertEquals(22, $prg->getAchievedPointsOfChildren($this->progress_repo->get(1)));
212 $this->assertEquals(22, $this->progress_repo->get(1)->getCurrentAmountOfPoints());
213
214 $prg->markAccredited(111, 6, $this->messages);
215 $this->assertEquals(5, $prg->getAchievedPointsOfChildren($this->progress_repo->get(11)));
216 }

References getRootPrg(), and setPointsForNode().

+ Here is the call graph for this function:

◆ testChangingDeadline()

ilStudyProgrammeProgressCalculationsTest::testChangingDeadline ( )

Definition at line 435 of file ilStudyProgrammeProgressCalculationsTest.php.

436 {
437 $past = DateTimeImmutable::createFromFormat('Ymd', '20010101');
438 $this->getRootPrg()->changeProgressDeadline(12, 6, $this->messages, $past);
439
440 $this->assertEquals(
442 $this->progress_repo->get(12)->getStatus()
443 );
444 }

References getRootPrg(), and ilStudyProgrammeProgress\STATUS_FAILED.

+ Here is the call graph for this function:

◆ testChangingValidity()

ilStudyProgrammeProgressCalculationsTest::testChangingValidity ( )

Definition at line 478 of file ilStudyProgrammeProgressCalculationsTest.php.

479 {
480 $future = (new DateTimeImmutable())->add(new DateInterval('P1D'));
481 $this->progress_repo->update(
482 $this->progress_repo->get(1)
484 );
485
486 $this->getRootPrg()->changeProgressValidityDate(1, 6, $this->messages, $future);
487 $this->assertEquals(
488 $future,
489 $this->progress_repo->get(1)->getValidityOfQualification()
490 );
491 }
add()
Definition: add.php:2

References add(), getRootPrg(), and ilStudyProgrammeProgress\STATUS_COMPLETED.

+ Here is the call graph for this function:

◆ testChildrenPossiblePointsAddition()

ilStudyProgrammeProgressCalculationsTest::testChildrenPossiblePointsAddition ( )

── 1 (1) ├── 11 (8) │ ├── 111 (5) │ └── 112 (10) <– turns irrelevant ├── 12 (12) <– turns irrelevant └── 13 (10)

Definition at line 146 of file ilStudyProgrammeProgressCalculationsTest.php.

147 {
148 $this->setPointsForNode(111, 5);
149 $this->setPointsForNode(112, 10);
150 $this->setPointsForNode(11, 8);
151 $this->setPointsForNode(1, 1);
152 $this->setPointsForNode(12, 12);
153 $this->setPointsForNode(13, 10);
154
155 $this->assertEquals(
156 15, //111+112
157 $this->getRootPrg()->getPossiblePointsOfRelevantChildren(
158 $this->progress_repo->get(11)
159 )
160 );
161
162 $this->assertEquals(
163 30, //11+12+13
164 $this->getRootPrg()->getPossiblePointsOfRelevantChildren(
165 $this->progress_repo->get(1)
166 )
167 );
168
169 $this->getRootPrg()->markNotRelevant(12, 6, $this->messages);
170 $this->getRootPrg()->markNotRelevant(112, 6, $this->messages);
171
172 $this->assertEquals(
173 5, //111 (w/o + 112)
174 $this->getRootPrg()->getPossiblePointsOfRelevantChildren(
175 $this->progress_repo->get(11)
176 )
177 );
178
179 $this->assertEquals(
180 18,
181 $this->getRootPrg()->getPossiblePointsOfRelevantChildren(
182 $this->progress_repo->get(1)
183 )
184 );
185 }

References getRootPrg(), and setPointsForNode().

+ Here is the call graph for this function:

◆ testDontChangeDeadlineForCompleted()

ilStudyProgrammeProgressCalculationsTest::testDontChangeDeadlineForCompleted ( )

Definition at line 446 of file ilStudyProgrammeProgressCalculationsTest.php.

447 {
448 $this->progress_repo->update(
449 $this->progress_repo->get(12)
451 );
452
453 $past = DateTimeImmutable::createFromFormat('Ymd', '20010101');
454 $this->getRootPrg()->changeProgressDeadline(12, 6, $this->messages, $past);
455
456 $progress = $this->progress_repo->get(12);
457 $this->assertEquals($progress->getStatus(), ilStudyProgrammeProgress::STATUS_COMPLETED);
458 $this->assertNull($progress->getDeadline());
459 }

References getRootPrg(), and ilStudyProgrammeProgress\STATUS_COMPLETED.

+ Here is the call graph for this function:

◆ testDontChangeValidityForIncomplete()

ilStudyProgrammeProgressCalculationsTest::testDontChangeValidityForIncomplete ( )

Definition at line 493 of file ilStudyProgrammeProgressCalculationsTest.php.

494 {
495 $future = (new DateTimeImmutable())->add(new DateInterval('P1D'));
496 $this->progress_repo->update(
497 $this->progress_repo->get(1)
499 );
500 $this->getRootPrg()->changeProgressValidityDate(1, 6, $this->messages, $future);
501 $this->assertNull($this->progress_repo->get(1)->getValidityOfQualification());
502 }

References add(), getRootPrg(), and ilStudyProgrammeProgress\STATUS_IN_PROGRESS.

+ Here is the call graph for this function:

◆ testDontFailByDeadlineIfSucceeded()

ilStudyProgrammeProgressCalculationsTest::testDontFailByDeadlineIfSucceeded ( )

Definition at line 418 of file ilStudyProgrammeProgressCalculationsTest.php.

419 {
420 $progress = $this->progress_repo->get(13)
422 $this->progress_repo->update($progress);
423
424 $past = DateTimeImmutable::createFromFormat('Ymd', '20010101');
425 $progress = $this->getRootPrg()->testApplyProgressDeadline(
426 $progress->withDeadline($past)
427 );
428
429 $this->assertEquals(
431 $progress->getStatus()
432 );
433 }

References getRootPrg(), and ilStudyProgrammeProgress\STATUS_COMPLETED.

+ Here is the call graph for this function:

◆ testDontFailByFutureDeadline()

ilStudyProgrammeProgressCalculationsTest::testDontFailByFutureDeadline ( )

Definition at line 404 of file ilStudyProgrammeProgressCalculationsTest.php.

405 {
406 $progress = $this->progress_repo->get(13);
407 $future = (new DateTimeImmutable())->add(new DateInterval('P1D'));
408 $progress = $this->getRootPrg()->testApplyProgressDeadline(
409 $progress->withDeadline($future)
410 );
411
412 $this->assertEquals(
414 $progress->getStatus()
415 );
416 }

References add(), getRootPrg(), and ilStudyProgrammeProgress\STATUS_IN_PROGRESS.

+ Here is the call graph for this function:

◆ testFailByDeadline()

ilStudyProgrammeProgressCalculationsTest::testFailByDeadline ( )

Definition at line 391 of file ilStudyProgrammeProgressCalculationsTest.php.

392 {
393 $past = DateTimeImmutable::createFromFormat('Ymd', '20010101');
394 $progress = $this->progress_repo->get(13)->withDeadline($past);
395
396 $progress = $this->getRootPrg()->testApplyProgressDeadline($progress);
397
398 $this->assertEquals(
400 $progress->getStatus()
401 );
402 }

References getRootPrg(), and ilStudyProgrammeProgress\STATUS_FAILED.

+ Here is the call graph for this function:

◆ testInternalRunIntegrity()

ilStudyProgrammeProgressCalculationsTest::testInternalRunIntegrity ( )

Definition at line 112 of file ilStudyProgrammeProgressCalculationsTest.php.

113 {
114 $progress = $this->progress_repo->get(11);
115 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $progress->getStatus());
116 }

References ilStudyProgrammeProgress\STATUS_IN_PROGRESS.

◆ testInternalTreeIntegrity()

ilStudyProgrammeProgressCalculationsTest::testInternalTreeIntegrity ( )

Definition at line 86 of file ilStudyProgrammeProgressCalculationsTest.php.

87 {
88 $progress = $this->progress_repo->get(111);
89 $parent = $this->getRootPrg()->getParentProgress($progress);
90 $this->assertEquals(111, $progress->getNodeId());
91 $this->assertEquals(11, $parent->getNodeId());
92 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $parent->getStatus());
93 $this->progress_repo->update(
95 );
96 $progress = $this->progress_repo->get(112);
97 $parent = $this->getRootPrg()->getParentProgress($progress);
98 $this->assertEquals(11, $parent->getNodeId());
99 $this->assertEquals(ilStudyProgrammeProgress::STATUS_FAILED, $parent->getStatus());
100
101 $progress = $this->progress_repo->get(11);
102 $this->assertEquals(
103 [
104 $this->progress_repo->get(111),
105 $this->progress_repo->get(112)
106 ],
107 $this->getRootPrg()->getChildrenProgress($progress)
108 );
109 }

References getRootPrg(), ilStudyProgrammeProgress\STATUS_FAILED, and ilStudyProgrammeProgress\STATUS_IN_PROGRESS.

+ Here is the call graph for this function:

◆ testMarkAccreditedOnLPNode()

ilStudyProgrammeProgressCalculationsTest::testMarkAccreditedOnLPNode ( )

── 1 (10) ├── 11 (5, LP) └── 12 (5)

Definition at line 267 of file ilStudyProgrammeProgressCalculationsTest.php.

268 {
269 $this->setPointsForNode(1, 10);
270 $this->setPointsForNode(11, 5);
271 $this->setPointsForNode(12, 5);
273 $this->mock_tree = [
274 1 => $this->mock_tree[1],
275 11 => $this->mock_tree[13],
276 12 => $this->mock_tree[12]
277 ];
278
279 $this->getRootPrg()->markAccredited(11, 6, $this->messages);
280 $this->assertEquals(ilStudyProgrammeProgress::STATUS_ACCREDITED, $this->progress_repo->get(11)->getStatus());
281 $this->assertEquals(5, $this->progress_repo->get(11)->getCurrentAmountOfPoints());
282 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $this->progress_repo->get(12)->getStatus());
283 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $this->progress_repo->get(1)->getStatus());
284
285 $this->getRootPrg()->markAccredited(12, 6, $this->messages);
286 $this->assertEquals(ilStudyProgrammeProgress::STATUS_ACCREDITED, $this->progress_repo->get(11)->getStatus());
287 $this->assertEquals(ilStudyProgrammeProgress::STATUS_ACCREDITED, $this->progress_repo->get(12)->getStatus());
288 $this->assertEquals(ilStudyProgrammeProgress::STATUS_COMPLETED, $this->progress_repo->get(1)->getStatus());
289 $this->assertEquals(5, $this->progress_repo->get(11)->getCurrentAmountOfPoints());
290 $this->assertEquals(5, $this->progress_repo->get(12)->getCurrentAmountOfPoints());
291 $this->assertEquals(10, $this->progress_repo->get(1)->getCurrentAmountOfPoints());
292 }

References getRootPrg(), ilStudyProgrammeSettings\MODE_LP_COMPLETED, setModeForNode(), setPointsForNode(), ilStudyProgrammeProgress\STATUS_ACCREDITED, ilStudyProgrammeProgress\STATUS_COMPLETED, and ilStudyProgrammeProgress\STATUS_IN_PROGRESS.

+ Here is the call graph for this function:

◆ testMarkAccreditedShouldCompleteParentBySufficientPoints()

ilStudyProgrammeProgressCalculationsTest::testMarkAccreditedShouldCompleteParentBySufficientPoints ( )

PRG: MODE_POINTS ── 1 (5) ├── 11 (12) │ ├── 111 (5) │ └── 112 (7) ├── 12 (2) └── 13 (2)

Definition at line 228 of file ilStudyProgrammeProgressCalculationsTest.php.

229 {
230 $this->setPointsForNode(111, 5);
231 $this->setPointsForNode(112, 7);
232 $this->setPointsForNode(11, 12);
233 $this->setPointsForNode(1, 5);
234
235 $this->getRootPrg()->markAccredited(111, 6, $this->messages);
236 $this->getRootPrg()->markAccredited(112, 6, $this->messages);
237
238 $this->assertEquals(5, $this->progress_repo->get(111)->getCurrentAmountOfPoints());
239 $this->assertEquals(7, $this->progress_repo->get(112)->getCurrentAmountOfPoints());
240 $this->assertEquals(12, $this->progress_repo->get(11)->getCurrentAmountOfPoints());
241 $this->assertEquals(12, $this->progress_repo->get(1)->getCurrentAmountOfPoints());
242
243 $this->assertEquals(
244 16,
245 $this->getRootPrg()->getPossiblePointsOfRelevantChildren(
246 $this->progress_repo->get(1)
247 )
248 );
249 $this->assertEquals(
250 12,
251 $this->getRootPrg()->getAchievedPointsOfChildren(
252 $this->progress_repo->get(1)
253 )
254 );
255
256 $this->assertEquals(ilStudyProgrammeProgress::STATUS_ACCREDITED, $this->progress_repo->get(111)->getStatus());
257 $this->assertEquals(ilStudyProgrammeProgress::STATUS_ACCREDITED, $this->progress_repo->get(112)->getStatus());
258 $this->assertEquals(ilStudyProgrammeProgress::STATUS_COMPLETED, $this->progress_repo->get(11)->getStatus());
259 $this->assertEquals(ilStudyProgrammeProgress::STATUS_COMPLETED, $this->progress_repo->get(1)->getStatus());
260 }

References getRootPrg(), setPointsForNode(), ilStudyProgrammeProgress\STATUS_ACCREDITED, and ilStudyProgrammeProgress\STATUS_COMPLETED.

+ Here is the call graph for this function:

◆ testMarkAccreditedShouldNotChangeIrrelevantParent()

ilStudyProgrammeProgressCalculationsTest::testMarkAccreditedShouldNotChangeIrrelevantParent ( )

── 1 ├── 11 (irrelevant) │ ├── 111 │ └── 112 ├── 12 └── 13

Definition at line 302 of file ilStudyProgrammeProgressCalculationsTest.php.

303 {
304 $this->progress_repo->update(
305 $this->progress_repo->get(11)->withStatus(ilStudyProgrammeProgress::STATUS_NOT_RELEVANT)
306 );
307
308 $this->getRootPrg()->markAccredited(111, 6, $this->messages);
309 $this->getRootPrg()->markAccredited(112, 6, $this->messages);
310 $this->assertEquals(ilStudyProgrammeProgress::STATUS_ACCREDITED, $this->progress_repo->get(111)->getStatus());
311 $this->assertEquals(ilStudyProgrammeProgress::STATUS_ACCREDITED, $this->progress_repo->get(112)->getStatus());
312 $this->assertEquals(ilStudyProgrammeProgress::STATUS_NOT_RELEVANT, $this->progress_repo->get(11)->getStatus());
313 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $this->progress_repo->get(1)->getStatus());
314 $this->assertEquals(0, $this->progress_repo->get(1)->getCurrentAmountOfPoints());
315 }

References getRootPrg(), ilStudyProgrammeProgress\STATUS_ACCREDITED, ilStudyProgrammeProgress\STATUS_IN_PROGRESS, and ilStudyProgrammeProgress\STATUS_NOT_RELEVANT.

+ Here is the call graph for this function:

◆ testMarkAsIndividual()

ilStudyProgrammeProgressCalculationsTest::testMarkAsIndividual ( )

Definition at line 504 of file ilStudyProgrammeProgressCalculationsTest.php.

505 {
506 $this->assertFalse($this->progress_repo->get(11)->hasIndividualModifications());
507
508 $this->getRootPrg()->markNotRelevant(11, 6, $this->messages);
509 $this->assertTrue($this->progress_repo->get(11)->hasIndividualModifications());
510
511 $future = (new DateTimeImmutable())->add(new DateInterval('P1D'));
512
513 $this->getRootPrg()->changeProgressDeadline(12, 6, $this->messages, $future);
514 $this->assertTrue($this->progress_repo->get(12)->hasIndividualModifications());
515
516 $this->getRootPrg()->changeProgressValidityDate(13, 6, $this->messages, $future);
517 $this->assertFalse($this->progress_repo->get(13)->hasIndividualModifications());
518 }

References add(), and getRootPrg().

+ Here is the call graph for this function:

◆ testMarkIrrelevantDoesNotCompleteParent()

ilStudyProgrammeProgressCalculationsTest::testMarkIrrelevantDoesNotCompleteParent ( )

Definition at line 375 of file ilStudyProgrammeProgressCalculationsTest.php.

376 {
377 $this->setPointsForNode(1, 6);
378 $this->getRootPrg()->markAccredited(11, 6, $this->messages);
379 $this->getRootPrg()->markAccredited(13, 6, $this->messages);
380
381 $this->assertEquals(4, $this->progress_repo->get(1)->getCurrentAmountOfPoints());
382 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $this->progress_repo->get(1)->getStatus());
383
384 $this->getRootPrg()->markNotRelevant(12, 6, $this->messages);
385
386 $this->assertEquals(4, $this->progress_repo->get(1)->getCurrentAmountOfPoints());
387 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $this->progress_repo->get(1)->getStatus());
388 }

References getRootPrg(), setPointsForNode(), and ilStudyProgrammeProgress\STATUS_IN_PROGRESS.

+ Here is the call graph for this function:

◆ testMarkRelevantShouldRecalculateStatusAndPoints()

ilStudyProgrammeProgressCalculationsTest::testMarkRelevantShouldRecalculateStatusAndPoints ( )

Definition at line 317 of file ilStudyProgrammeProgressCalculationsTest.php.

318 {
319 $this->progress_repo->update(
320 $this->progress_repo->get(11)->withStatus(ilStudyProgrammeProgress::STATUS_NOT_RELEVANT)
321 );
322
323 $this->getRootPrg()->markAccredited(111, 6, $this->messages);
324 $this->getRootPrg()->markAccredited(112, 6, $this->messages);
325 $this->assertEquals(0, $this->progress_repo->get(1)->getCurrentAmountOfPoints());
326
327 $this->getRootPrg()->markRelevant(11, 6, $this->messages);
328 $this->assertEquals(ilStudyProgrammeProgress::STATUS_COMPLETED, $this->progress_repo->get(11)->getStatus());
329 $this->assertEquals(2, $this->progress_repo->get(1)->getCurrentAmountOfPoints());
330
331 $this->getRootPrg()->markNotRelevant(11, 6, $this->messages);
332 $this->assertEquals(ilStudyProgrammeProgress::STATUS_COMPLETED, $this->progress_repo->get(11)->getStatus());
333 $this->assertEquals(ilStudyProgrammeProgress::STATUS_ACCREDITED, $this->progress_repo->get(111)->getStatus());
334 $this->assertEquals(2, $this->progress_repo->get(1)->getCurrentAmountOfPoints());
335 }

References getRootPrg(), ilStudyProgrammeProgress\STATUS_ACCREDITED, ilStudyProgrammeProgress\STATUS_COMPLETED, and ilStudyProgrammeProgress\STATUS_NOT_RELEVANT.

+ Here is the call graph for this function:

◆ testParentAcquisition()

ilStudyProgrammeProgressCalculationsTest::testParentAcquisition ( )

── 1 ├── 11 │ ├── 111 │ └── 112 ├── 12 └── 13

Definition at line 127 of file ilStudyProgrammeProgressCalculationsTest.php.

128 {
129 $progress = $this->getRootPrg()
130 ->testUpdateParentProgress($this->progress_repo->get(112));
131 $this->assertEquals($this->progress_repo->get(1), $progress);
132
133 $progress = $this->getRootPrg()
134 ->testUpdateParentProgress($this->progress_repo->get(13));
135 $this->assertEquals($this->progress_repo->get(1), $progress);
136 }

References getRootPrg().

+ Here is the call graph for this function:

◆ testSuccessionCompletingParents()

ilStudyProgrammeProgressCalculationsTest::testSuccessionCompletingParents ( )

Definition at line 345 of file ilStudyProgrammeProgressCalculationsTest.php.

346 {
347 $this->setPointsForNode(1, 6);
348 $this->setPointsForNode(11, 4);
349 $this->setPointsForNode(112, 3);
351
352 $this->mock_tree[112]['prg']->markAccredited(112, 6, $this->messages);
353 $this->mock_tree[12]['prg']->markAccredited(13, 6, $this->messages);
354 $triggering_obj_id = 9001;
355 $this->mock_tree[111]['prg']->succeed(111, $triggering_obj_id);
356
357 $this->assertEquals(ilStudyProgrammeProgress::STATUS_COMPLETED, $this->progress_repo->get(111)->getStatus());
358 $this->assertEquals(2, $this->progress_repo->get(111)->getCurrentAmountOfPoints());
359
360 $this->assertEquals(ilStudyProgrammeProgress::STATUS_COMPLETED, $this->progress_repo->get(11)->getStatus());
361 $this->assertEquals(5, $this->progress_repo->get(11)->getCurrentAmountOfPoints());
362
363 $this->assertEquals(ilStudyProgrammeProgress::STATUS_COMPLETED, $this->progress_repo->get(1)->getStatus());
364 $this->assertEquals(6, $this->progress_repo->get(1)->getCurrentAmountOfPoints());
365 }

References ilStudyProgrammeSettings\MODE_LP_COMPLETED, setModeForNode(), setPointsForNode(), and ilStudyProgrammeProgress\STATUS_COMPLETED.

+ Here is the call graph for this function:

◆ testTranstitionToProgressWithPastDeadline()

ilStudyProgrammeProgressCalculationsTest::testTranstitionToProgressWithPastDeadline ( )

Definition at line 461 of file ilStudyProgrammeProgressCalculationsTest.php.

462 {
463 $past = DateTimeImmutable::createFromFormat('Ymd', '20010101');
464 $this->progress_repo->update(
465 $this->progress_repo->get(11)
467 ->withDeadline($past)
468 );
469
470 $this->getRootPrg()->unmarkAccredited(11, 6, $this->messages);
471
472 $this->assertEquals(
474 $this->progress_repo->get(11)->getStatus()
475 );
476 }

References getRootPrg(), ilStudyProgrammeProgress\STATUS_ACCREDITED, and ilStudyProgrammeProgress\STATUS_FAILED.

+ Here is the call graph for this function:

◆ testUpdateFromSettingsResetsIndividual()

ilStudyProgrammeProgressCalculationsTest::testUpdateFromSettingsResetsIndividual ( )

Definition at line 520 of file ilStudyProgrammeProgressCalculationsTest.php.

521 {
522 $future = (new DateTimeImmutable())->add(new DateInterval('P1D'));
523 $prg = $this->getRootPrg();
524 $prg->tree = $this->mock_tree;
525
526 $prg->changeProgressDeadline(12, 6, $this->messages, $future);
527 $this->assertTrue($this->progress_repo->get(12)->hasIndividualModifications());
528 $prg->updatePlanFromRepository(12, 6);
529 $this->assertFalse($this->progress_repo->get(12)->hasIndividualModifications());
530 }

References add(), and getRootPrg().

+ Here is the call graph for this function:

◆ testUpdatePlanFromSettings()

ilStudyProgrammeProgressCalculationsTest::testUpdatePlanFromSettings ( )

Definition at line 532 of file ilStudyProgrammeProgressCalculationsTest.php.

533 {
534 $future = (new DateTime())->add(new DateInterval('P1D'));
535 $future2 = (new DateTime())->add(new DateInterval('P4D'));
536 $points = 73;
537
538 $set_dl = new ilStudyProgrammeDeadlineSettings(null, $future);
539 $set_vq = new ilStudyProgrammeValidityOfAchievedQualificationSettings(null, $future2, null);
541
542 foreach ([1,11,111] as $id) {
543 $settings = $this->mock_tree[$id]['prg']->getSettings()
544 ->withDeadlineSettings($set_dl)
545 ->withValidityOfQualificationSettings($set_vq)
546 ->withAssessmentSettings($set_as);
547
548 $this->mock_tree[$id]['prg']->updateSettings($settings);
549 $progress = $this->progress_repo->get($id)
550 ->withAmountOfPoints(69)
551 ->withDeadline(DateTimeImmutable::createFromMutable($future2))
552 ->withValidityOfQualification(DateTimeImmutable::createFromMutable($future));
553 $progress = $progress->markAccredited(
554 new DateTimeImmutable(),
555 6
556 );
557
558 $this->progress_repo->update($progress);
559 $progress = $this->progress_repo->get($id);
560 $this->assertEquals($future2, $progress->getDeadline());
561 $this->assertEquals($future, $progress->getValidityOfQualification());
562 $this->assertEquals(69, $progress->getAmountOfPoints());
563
564 $prg = $this->getRootPrg();
565 $prg->tree = &$this->mock_tree;
566 }
567
568 $this->getRootPrg()->updatePlanFromRepository(11, 6);
569
570 foreach ([1,11,111] as $prg_id) {
571 $progress = $this->progress_repo->get($prg_id);
572 $this->assertEquals($points, $progress->getAmountOfPoints());
573 $this->assertEquals($future, $progress->getDeadline());
574 }
575 }

References add(), getRootPrg(), and ilStudyProgrammeAssessmentSettings\STATUS_ACTIVE.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: