ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilStudyProgrammeUserProgressTest Class Reference

TestCase for the progress of users at a programme. More...

+ Inheritance diagram for ilStudyProgrammeUserProgressTest:
+ Collaboration diagram for ilStudyProgrammeUserProgressTest:

Public Member Functions

 testInitialProgressActive ()
 
 testInitialProgressDraft ()
 
 testInitialProgressOutdated ()
 
 testUserSelection ()
 
 testMarkAccredited ()
 
 testUnmarkAccredited ()
 
 testMarkNotRelevant ()
 
 testNewNodesAreNotRelevant ()
 
 testIndividualRequiredPoints ()
 
 testMaximimPossibleAmountOfPoints1 ()
 
 testMaximimPossibleAmountOfPoints2 ()
 
 testCanBeCompleted1 ()
 
 testCanBeCompleted2 ()
 
 testCanBeCompleted3 ()
 
 testUserDeletionDeletesAssignments ()
 
 testNoImplicitPointUpdate ()
 
 testExplicitPointUpdate1 ()
 
 testExplicitPointUpdate2 ()
 
 testNoUpdateOnModifiedNodes ()
 
 testOutdatedNodesCantBeSetToRelevant ()
 QUA-Objekte, welche "Inaktiv" sind können bei Studierenden-Studienplänen nicht von "nicht relevant" auf irgendeinen anderen Status gesetzt werden. More...
 
 testHasDeviationToProgram1 ()
 
 testHasDeviationToProgram2 ()
 
 testHasDeviationToProgram3 ()
 
 testHasDeviationToProgram4 ()
 
 testGetNamesOfCompletedOrAccreditedChildren ()
 
 testCompletionOnDeeplyNestedProgresses ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 newUser ()
 
 setAllNodesActive ()
 
 assignNewUserToRoot ()
 

Protected Attributes

 $backupGlobals = FALSE
 

Detailed Description

TestCase for the progress of users at a programme.

Author
Michael Herren mh@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Richard Klees richa.nosp@m.rd.k.nosp@m.lees@.nosp@m.conc.nosp@m.epts-.nosp@m.and-.nosp@m.train.nosp@m.ing..nosp@m.de
Version
1.0.0

Definition at line 14 of file ilStudyProgrammeUserProgressTest.php.

Member Function Documentation

◆ assignNewUserToRoot()

◆ newUser()

ilStudyProgrammeUserProgressTest::newUser ( )
protected

Definition at line 53 of file ilStudyProgrammeUserProgressTest.php.

53 {
54 $user = new ilObjUser();
55 $user->create();
56 return $user;
57 }

Referenced by assignNewUserToRoot(), testCompletionOnDeeplyNestedProgresses(), testGetNamesOfCompletedOrAccreditedChildren(), testMarkAccredited(), testMarkNotRelevant(), and testUnmarkAccredited().

+ Here is the caller graph for this function:

◆ setAllNodesActive()

◆ setUp()

ilStudyProgrammeUserProgressTest::setUp ( )
protected

Definition at line 17 of file ilStudyProgrammeUserProgressTest.php.

17 {
18 PHPUnit_Framework_Error_Deprecated::$enabled = FALSE;
19
20 require_once("./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
21
22 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
23 ilUnitUtil::performInitialisation();
24
26 $this->root->putInTree(ROOT_FOLDER_ID);
27 $this->root->object_factory = new ilObjectFactoryWrapperMock();
28
31
32 $this->leaf1 = new ilStudyProgrammeLeafMock();
33 $this->leaf2 = new ilStudyProgrammeLeafMock();
34
35 $this->root->addNode($this->node1);
36 $this->root->addNode($this->node2);
37 $this->node1->addLeaf($this->leaf1);
38 $this->node2->addLeaf($this->leaf2);
39
40 global $tree;
41 $this->tree = $tree;
42
43 global $ilUser;
44 $this->user = $ilUser;
45 }
static createInstance()
Create an instance of ilObjStudyProgramme, put in cache.
Mock for object factory.
Definition: mocks.php:66
Mock classes for tests.
Definition: mocks.php:21
global $ilUser
Definition: imgupload.php:15

References $ilUser, and ilObjStudyProgramme\createInstance().

+ Here is the call graph for this function:

◆ tearDown()

ilStudyProgrammeUserProgressTest::tearDown ( )
protected

Definition at line 47 of file ilStudyProgrammeUserProgressTest.php.

47 {
48 if ($this->root) {
49 $this->root->delete();
50 }
51 }

◆ testCanBeCompleted1()

ilStudyProgrammeUserProgressTest::testCanBeCompleted1 ( )

Definition at line 328 of file ilStudyProgrammeUserProgressTest.php.

328 {
329 $this->setAllNodesActive();
330 $tmp = $this->assignNewUserToRoot();
331 $ass = $tmp[0];
332 $user = $tmp[1];
333
334 $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
335 $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
336 $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
337
338 $this->assertTrue($root_progress->canBeCompleted());
339 $this->assertTrue($node1_progress->canBeCompleted());
340 $this->assertTrue($node2_progress->canBeCompleted());
341 }

References assignNewUserToRoot(), and setAllNodesActive().

+ Here is the call graph for this function:

◆ testCanBeCompleted2()

ilStudyProgrammeUserProgressTest::testCanBeCompleted2 ( )

Definition at line 343 of file ilStudyProgrammeUserProgressTest.php.

343 {
344 $NEW_AMOUNT_OF_POINTS = 3003;
345 $this->assertGreaterThan(ilStudyProgramme::DEFAULT_POINTS, $NEW_AMOUNT_OF_POINTS);
346
347 $this->setAllNodesActive();
348 $this->root->setPoints($NEW_AMOUNT_OF_POINTS)
349 ->update();
350 $tmp = $this->assignNewUserToRoot();
351 $ass = $tmp[0];
352 $user = $tmp[1];
353
354 $this->assertLessThan($NEW_AMOUNT_OF_POINTS, $this->node1->getPoints() + $this->node2->getPoints());
355
356 $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
357 $this->assertFalse($root_progress->canBeCompleted());
358 }

References assignNewUserToRoot(), ilStudyProgramme\DEFAULT_POINTS, and setAllNodesActive().

+ Here is the call graph for this function:

◆ testCanBeCompleted3()

ilStudyProgrammeUserProgressTest::testCanBeCompleted3 ( )

Definition at line 360 of file ilStudyProgrammeUserProgressTest.php.

360 {
361 $NEW_AMOUNT_OF_POINTS = 3003;
362 $this->assertGreaterThan(ilStudyProgramme::DEFAULT_POINTS, $NEW_AMOUNT_OF_POINTS);
363
364 $this->setAllNodesActive();
366 $this->root->addNode($node3);
367 $node3->setPoints($NEW_AMOUNT_OF_POINTS)
369 ->update();
370
371
372 $tmp = $this->assignNewUserToRoot();
373 $ass = $tmp[0];
374 $user = $tmp[1];
375
376 $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
377 $node3_progress = array_shift($node3->getProgressesOf($user->getId()));
378
379 $this->assertFalse($root_progress->canBeCompleted());
380 $this->assertFalse($node3_progress->canBeCompleted());
381 }

References assignNewUserToRoot(), ilObjStudyProgramme\createInstance(), ilStudyProgramme\DEFAULT_POINTS, setAllNodesActive(), and ilStudyProgramme\STATUS_ACTIVE.

+ Here is the call graph for this function:

◆ testCompletionOnDeeplyNestedProgresses()

ilStudyProgrammeUserProgressTest::testCompletionOnDeeplyNestedProgresses ( )

Definition at line 580 of file ilStudyProgrammeUserProgressTest.php.

580 {
585 $depth1->putInTree(ROOT_FOLDER_ID);
586 $depth1->addNode($depth2);
587 $depth2->addNode($depth3);
588 $depth3->addNode($depth4);
589 $depth1->setStatus(ilStudyProgramme::STATUS_ACTIVE);
590 $depth2->setStatus(ilStudyProgramme::STATUS_ACTIVE);
591 $depth3->setStatus(ilStudyProgramme::STATUS_ACTIVE);
592 $depth4->setStatus(ilStudyProgramme::STATUS_ACTIVE);
593
594 $user = $this->newUser();
595
596 $assignment = $depth1->assignUser($user->getId());
597 $progress4 = $depth4->getProgressForAssignment($assignment->getId());
598 $progress4->markAccredited(6);
599
600 $progress1 = $depth1->getProgressForAssignment($assignment->getId());
601 $progress2 = $depth2->getProgressForAssignment($assignment->getId());
602 $progress3 = $depth3->getProgressForAssignment($assignment->getId());
603
604 $this->assertTrue($progress1->isSuccessful());
605 $this->assertTrue($progress2->isSuccessful());
606 $this->assertTrue($progress3->isSuccessful());
607 $this->assertTrue($progress4->isSuccessful());
608
609 $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $progress1->getCurrentAmountOfPoints());
610 $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $progress2->getCurrentAmountOfPoints());
611 $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $progress3->getCurrentAmountOfPoints());
612 $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $progress4->getCurrentAmountOfPoints());
613 }

References ilObjStudyProgramme\createInstance(), ilStudyProgramme\DEFAULT_POINTS, newUser(), and ilStudyProgramme\STATUS_ACTIVE.

+ Here is the call graph for this function:

◆ testExplicitPointUpdate1()

ilStudyProgrammeUserProgressTest::testExplicitPointUpdate1 ( )

Definition at line 418 of file ilStudyProgrammeUserProgressTest.php.

418 {
419 $this->setAllNodesActive();
420 $tmp = $this->assignNewUserToRoot();
421 $ass = $tmp[0];
422 $user = $tmp[1];
423
424 $NEW_AMOUNT_OF_POINTS = 202;
425 $this->assertNotEquals($NEW_AMOUNT_OF_POINTS, ilStudyProgramme::DEFAULT_POINTS);
426
427 $this->root->setPoints($NEW_AMOUNT_OF_POINTS)
428 ->update();
429
430 $ass->updateFromProgram();
431 $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
432 $this->assertEquals($NEW_AMOUNT_OF_POINTS, $root_progress->getAmountOfPoints());
433 }

References assignNewUserToRoot(), ilStudyProgramme\DEFAULT_POINTS, and setAllNodesActive().

+ Here is the call graph for this function:

◆ testExplicitPointUpdate2()

ilStudyProgrammeUserProgressTest::testExplicitPointUpdate2 ( )

Definition at line 438 of file ilStudyProgrammeUserProgressTest.php.

438 {
439 $this->setAllNodesActive();
440 $tmp = $this->assignNewUserToRoot();
441 $ass = $tmp[0];
442 $user = $tmp[1];
443
444 $NEW_AMOUNT_OF_POINTS = 203;
445 $this->assertNotEquals($NEW_AMOUNT_OF_POINTS, ilStudyProgramme::DEFAULT_POINTS);
446
447 $this->root->setPoints($NEW_AMOUNT_OF_POINTS)
448 ->update();
449
450 $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
451 $ass->updateFromProgram();
452 $this->assertEquals($NEW_AMOUNT_OF_POINTS, $root_progress->getAmountOfPoints());
453 }

References assignNewUserToRoot(), ilStudyProgramme\DEFAULT_POINTS, and setAllNodesActive().

+ Here is the call graph for this function:

◆ testGetNamesOfCompletedOrAccreditedChildren()

ilStudyProgrammeUserProgressTest::testGetNamesOfCompletedOrAccreditedChildren ( )

Definition at line 551 of file ilStudyProgrammeUserProgressTest.php.

551 {
552 $this->setAllNodesActive();
553 $tmp = $this->assignNewUserToRoot();
554 $ass = $tmp[0];
555 $user = $tmp[1];
556
557 $user2 = $this->newUser();
558 $USER_ID = $user2->getId();
559
560 $this->node1->setTitle("node1");
561 $this->node1->update();
562 $this->node2->setTitle("node2");
563 $this->node2->update();
564
565 $names = $this->root->getProgressForAssignment($ass->getId())
566 ->getNamesOfCompletedOrAccreditedChildren();
567 $this->assertEquals($names, array());
568
569 $this->node1->getProgressForAssignment($ass->getId())->markAccredited($USER_ID);
570 $names = $this->root->getProgressForAssignment($ass->getId())
571 ->getNamesOfCompletedOrAccreditedChildren();
572 $this->assertEquals($names, array("node1"));
573
574 $this->node2->getProgressForAssignment($ass->getId())->markAccredited($USER_ID);
575 $names = $this->root->getProgressForAssignment($ass->getId())
576 ->getNamesOfCompletedOrAccreditedChildren();
577 $this->assertEquals($names, array("node1", "node2"));
578 }

References assignNewUserToRoot(), newUser(), and setAllNodesActive().

+ Here is the call graph for this function:

◆ testHasDeviationToProgram1()

ilStudyProgrammeUserProgressTest::testHasDeviationToProgram1 ( )

Definition at line 508 of file ilStudyProgrammeUserProgressTest.php.

508 {
509 $this->setAllNodesActive();
510 $tmp = $this->assignNewUserToRoot();
511 $ass1 = $tmp[0];
512 $user1 = $tmp[1];
513
514 $progress = $this->node1->getProgressForAssignment($ass1->getId());
515 $this->assertFalse($progress->hasIndividualModifications());
516 }

References assignNewUserToRoot(), and setAllNodesActive().

+ Here is the call graph for this function:

◆ testHasDeviationToProgram2()

ilStudyProgrammeUserProgressTest::testHasDeviationToProgram2 ( )

Definition at line 518 of file ilStudyProgrammeUserProgressTest.php.

518 {
519 $this->setAllNodesActive();
520 $tmp = $this->assignNewUserToRoot();
521 $ass1 = $tmp[0];
522 $user1 = $tmp[1];
523
524 $progress = $this->node1->getProgressForAssignment($ass1->getId());
525 $progress->setRequiredAmountOfPoints(1000, $this->user->getId());
526 $this->assertTrue($progress->hasIndividualModifications());
527 }

References assignNewUserToRoot(), and setAllNodesActive().

+ Here is the call graph for this function:

◆ testHasDeviationToProgram3()

ilStudyProgrammeUserProgressTest::testHasDeviationToProgram3 ( )

Definition at line 529 of file ilStudyProgrammeUserProgressTest.php.

529 {
530 $this->setAllNodesActive();
531 $tmp = $this->assignNewUserToRoot();
532 $ass1 = $tmp[0];
533 $user1 = $tmp[1];
534
535 $progress = $this->node1->getProgressForAssignment($ass1->getId());
536 $progress->markNotRelevant($this->user->getId());
537 $this->assertTrue($progress->hasIndividualModifications());
538 }

References assignNewUserToRoot(), and setAllNodesActive().

+ Here is the call graph for this function:

◆ testHasDeviationToProgram4()

ilStudyProgrammeUserProgressTest::testHasDeviationToProgram4 ( )

Definition at line 540 of file ilStudyProgrammeUserProgressTest.php.

540 {
541 $this->setAllNodesActive();
542 $tmp = $this->assignNewUserToRoot();
543 $ass1 = $tmp[0];
544 $user1 = $tmp[1];
545
546 $progress = $this->node1->getProgressForAssignment($ass1->getId());
547 $progress->markAccredited($this->user->getId());
548 $this->assertFalse($progress->hasIndividualModifications());
549 }

References assignNewUserToRoot(), and setAllNodesActive().

+ Here is the call graph for this function:

◆ testIndividualRequiredPoints()

ilStudyProgrammeUserProgressTest::testIndividualRequiredPoints ( )

Definition at line 282 of file ilStudyProgrammeUserProgressTest.php.

282 {
283 $this->setAllNodesActive();
284 $tmp = $this->assignNewUserToRoot();
285 $ass1 = $tmp[0];
286 $user1 = $tmp[1];
287
288
289 $NEW_AMOUNT_OF_POINTS_1 = 205;
290 $this->assertNotEquals($NEW_AMOUNT_OF_POINTS_1, ilStudyProgramme::DEFAULT_POINTS);
291
292 $node2_progress1 = array_shift($this->node2->getProgressesOf($user1->getId()));
293 $node2_progress1->setRequiredAmountOfPoints($NEW_AMOUNT_OF_POINTS_1, $this->user->getId());
294
295 $this->assertEquals($NEW_AMOUNT_OF_POINTS_1, $node2_progress1->getAmountOfPoints());
296 }

References assignNewUserToRoot(), ilStudyProgramme\DEFAULT_POINTS, and setAllNodesActive().

+ Here is the call graph for this function:

◆ testInitialProgressActive()

ilStudyProgrammeUserProgressTest::testInitialProgressActive ( )

Definition at line 70 of file ilStudyProgrammeUserProgressTest.php.

70 {
71 $this->setAllNodesActive();
72 $tmp = $this->assignNewUserToRoot();
73 $ass = $tmp[0];
74 $user = $tmp[1];
75
76 $root_progresses = $this->root->getProgressesOf($user->getId());
77 $this->assertCount(1, $root_progresses);
78 $root_progress = $root_progresses[0];
80 , $root_progress->getStatus());
81 $this->assertEquals( $this->root->getPoints()
82 , $root_progress->getAmountOfPoints());
83 $this->assertEquals(0, $root_progress->getCurrentAmountOfPoints());
84 $this->assertEquals($this->root->getId(), $root_progress->getStudyProgramme()->getId());
85 $this->assertEquals($ass->getId(), $root_progress->getAssignment()->getId());
86 $this->assertEquals($user->getId(), $root_progress->getUserId());
87 $this->assertNull($root_progress->getLastChangeBy());
88 $this->assertNull($root_progress->getCompletionBy());
89
90 $node1_progresses = $this->node1->getProgressesOf($user->getId());
91 $this->assertCount(1, $node1_progresses);
92 $node1_progress = $node1_progresses[0];
94 , $node1_progress->getStatus());
95 $this->assertEquals( $this->node1->getPoints()
96 , $node1_progress->getAmountOfPoints());
97 $this->assertEquals(0, $node1_progress->getCurrentAmountOfPoints());
98 $this->assertEquals($this->node1->getId(), $node1_progress->getStudyProgramme()->getId());
99 $this->assertEquals($ass->getId(), $node1_progress->getAssignment()->getId());
100 $this->assertEquals($user->getId(), $node1_progress->getUserId());
101 $this->assertNull($node1_progress->getLastChangeBy());
102 $this->assertNull($node1_progress->getCompletionBy());
103
104 $node2_progresses = $this->node2->getProgressesOf($user->getId());
105 $this->assertCount(1, $node2_progresses);
106 $node2_progress = $node2_progresses[0];
108 , $node2_progress->getStatus());
109 $this->assertEquals( $this->node2->getPoints()
110 , $node2_progress->getAmountOfPoints());
111 $this->assertEquals(0, $node2_progress->getCurrentAmountOfPoints());
112 $this->assertEquals($this->node2->getId(), $node2_progress->getStudyProgramme()->getId());
113 $this->assertEquals($ass->getId(), $node2_progress->getAssignment()->getId());
114 $this->assertEquals($user->getId(), $node2_progress->getUserId());
115 $this->assertNull($node2_progress->getLastChangeBy());
116 $this->assertNull($node2_progress->getCompletionBy());
117 }

References assignNewUserToRoot(), setAllNodesActive(), and ilStudyProgrammeProgress\STATUS_IN_PROGRESS.

+ Here is the call graph for this function:

◆ testInitialProgressDraft()

ilStudyProgrammeUserProgressTest::testInitialProgressDraft ( )

Definition at line 119 of file ilStudyProgrammeUserProgressTest.php.

119 {
120 $this->root->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
121 $this->node1->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
122 $this->node2->setStatus(ilStudyProgramme::STATUS_DRAFT)->update();
123
124 $tmp = $this->assignNewUserToRoot();
125 $user = $tmp[1];
126 $ass = $tmp[0];
127
128 $root_progresses = $this->root->getProgressesOf($user->getId());
129 $root_progress = $root_progresses[0];
131 , $root_progress->getStatus());
132
133 $node1_progresses = $this->node1->getProgressesOf($user->getId());
134 $node1_progress = $node1_progresses[0];
136 , $node1_progress->getStatus());
137
138 $node2_progresses = $this->node2->getProgressesOf($user->getId());
139 $node2_progress = $node2_progresses[0];
141 , $node2_progress->getStatus());
142 }

References assignNewUserToRoot(), ilStudyProgramme\STATUS_ACTIVE, ilStudyProgramme\STATUS_DRAFT, ilStudyProgrammeProgress\STATUS_IN_PROGRESS, and ilStudyProgrammeProgress\STATUS_NOT_RELEVANT.

+ Here is the call graph for this function:

◆ testInitialProgressOutdated()

ilStudyProgrammeUserProgressTest::testInitialProgressOutdated ( )

Definition at line 144 of file ilStudyProgrammeUserProgressTest.php.

144 {
145 $this->root->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
146 $this->node1->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
147 $this->node2->setStatus(ilStudyProgramme::STATUS_OUTDATED)->update();
148
149 $tmp = $this->assignNewUserToRoot();
150 $user = $tmp[1];
151 $ass = $tmp[0];
152
153 $root_progresses = $this->root->getProgressesOf($user->getId());
154 $root_progress = $root_progresses[0];
156 , $root_progress->getStatus());
157
158 $node1_progresses = $this->node1->getProgressesOf($user->getId());
159 $node1_progress = $node1_progresses[0];
161 , $node1_progress->getStatus());
162
163 $node2_progresses = $this->node2->getProgressesOf($user->getId());
164 $node2_progress = $node2_progresses[0];
166 , $node2_progress->getStatus());
167 }

References assignNewUserToRoot(), ilStudyProgramme\STATUS_ACTIVE, ilStudyProgrammeProgress\STATUS_IN_PROGRESS, ilStudyProgrammeProgress\STATUS_NOT_RELEVANT, and ilStudyProgramme\STATUS_OUTDATED.

+ Here is the call graph for this function:

◆ testMarkAccredited()

ilStudyProgrammeUserProgressTest::testMarkAccredited ( )

Definition at line 180 of file ilStudyProgrammeUserProgressTest.php.

180 {
181 $this->setAllNodesActive();
182 $tmp = $this->assignNewUserToRoot();
183 $ass = $tmp[0];
184 $user = $tmp[1];
185
186 $user2 = $this->newUser();
187 $USER_ID = $user2->getId();
188
189 $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
190 $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
191
192 $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
193 $this->assertEquals($root_progress->getAmountOfPoints(), ilStudyProgramme::DEFAULT_POINTS);
194 $this->assertEquals($node1_progress->getAmountOfPoints(), ilStudyProgramme::DEFAULT_POINTS);
195 $this->assertEquals($node2_progress->getAmountOfPoints(), ilStudyProgramme::DEFAULT_POINTS);
196
197 $ts_before_change = $node2_progress->getLastChange()->get(IL_CAL_DATETIME);
198 $node2_progress->markAccredited($USER_ID);
199 $ts_after_change = $node2_progress->getLastChange()->get(IL_CAL_DATETIME);
200
201 $this->assertTrue($node2_progress->isSuccessful());
202 $this->assertEquals($root_progress->getAmountOfPoints(), $root_progress->getCurrentAmountOfPoints());
203
204 $this->assertEquals(ilStudyProgrammeProgress::STATUS_COMPLETED, $root_progress->getStatus());
205 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $node1_progress->getStatus());
206 $this->assertEquals(ilStudyProgrammeProgress::STATUS_ACCREDITED, $node2_progress->getStatus());
207
208 $this->assertEquals($USER_ID, $node2_progress->getCompletionBy());
209 $this->assertLessThanOrEqual($ts_before_change, $ts_after_change);
210 }
const IL_CAL_DATETIME

References assignNewUserToRoot(), ilStudyProgramme\DEFAULT_POINTS, IL_CAL_DATETIME, newUser(), setAllNodesActive(), ilStudyProgrammeProgress\STATUS_ACCREDITED, ilStudyProgrammeProgress\STATUS_COMPLETED, and ilStudyProgrammeProgress\STATUS_IN_PROGRESS.

+ Here is the call graph for this function:

◆ testMarkNotRelevant()

ilStudyProgrammeUserProgressTest::testMarkNotRelevant ( )

Definition at line 244 of file ilStudyProgrammeUserProgressTest.php.

244 {
245 $this->setAllNodesActive();
246 $tmp = $this->assignNewUserToRoot();
247 $ass = $tmp[0];
248 $user = $tmp[1];
249
250 $user2 = $this->newUser();
251 $USER_ID = $user2->getId();
252
253 $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
254 $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
255 $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
256 $ts_before_change = $node2_progress->getLastChange()->get(IL_CAL_DATETIME);
257 $node2_progress->markNotRelevant($USER_ID);
258 $ts_after_change = $node2_progress->getLastChange()->get(IL_CAL_DATETIME);
259 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $root_progress->getStatus());
260 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $node1_progress->getStatus());
261 $this->assertEquals(ilStudyProgrammeProgress::STATUS_NOT_RELEVANT, $node2_progress->getStatus());
262 $this->assertEquals($USER_ID, $node2_progress->getCompletionBy());
263 $this->assertLessThanOrEqual($ts_before_change, $ts_after_change);
264 $this->assertTrue($node2_progress->hasIndividualModifications());
265 }

References assignNewUserToRoot(), IL_CAL_DATETIME, newUser(), setAllNodesActive(), ilStudyProgrammeProgress\STATUS_IN_PROGRESS, and ilStudyProgrammeProgress\STATUS_NOT_RELEVANT.

+ Here is the call graph for this function:

◆ testMaximimPossibleAmountOfPoints1()

ilStudyProgrammeUserProgressTest::testMaximimPossibleAmountOfPoints1 ( )

Definition at line 298 of file ilStudyProgrammeUserProgressTest.php.

298 {
299 $this->setAllNodesActive();
300 $tmp = $this->assignNewUserToRoot();
301 $ass = $tmp[0];
302 $user = $tmp[1];
303
304 $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
305 $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
306 $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
307
308 $this->assertEquals(2 * ilStudyProgramme::DEFAULT_POINTS, $root_progress->getMaximumPossibleAmountOfPoints());
309 $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $node1_progress->getMaximumPossibleAmountOfPoints());
310 $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $node2_progress->getMaximumPossibleAmountOfPoints());
311 }

References assignNewUserToRoot(), ilStudyProgramme\DEFAULT_POINTS, and setAllNodesActive().

+ Here is the call graph for this function:

◆ testMaximimPossibleAmountOfPoints2()

ilStudyProgrammeUserProgressTest::testMaximimPossibleAmountOfPoints2 ( )

Definition at line 313 of file ilStudyProgrammeUserProgressTest.php.

313 {
314 $this->setAllNodesActive();
315 $tmp = $this->assignNewUserToRoot();
316 $ass = $tmp[0];
317 $user = $tmp[1];
318
319 $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
320 $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
321 $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
322
323 $this->assertEquals(2 * ilStudyProgramme::DEFAULT_POINTS, $root_progress->getMaximumPossibleAmountOfPoints());
324 $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $node1_progress->getMaximumPossibleAmountOfPoints());
325 $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $node2_progress->getMaximumPossibleAmountOfPoints());
326 }

References assignNewUserToRoot(), ilStudyProgramme\DEFAULT_POINTS, and setAllNodesActive().

+ Here is the call graph for this function:

◆ testNewNodesAreNotRelevant()

ilStudyProgrammeUserProgressTest::testNewNodesAreNotRelevant ( )

Definition at line 268 of file ilStudyProgrammeUserProgressTest.php.

268 {
269 $this->setAllNodesActive();
270 $tmp = $this->assignNewUserToRoot();
271 $ass = $tmp[0];
272 $user = $tmp[1];
273
275 $this->root->addNode($node3);
276
277 $node3_progress = array_shift($node3->getProgressesOf($user->getId()));
278 $this->assertNotNull($node3_progress);
279 $this->assertEquals(ilStudyProgrammeProgress::STATUS_NOT_RELEVANT, $node3_progress->getStatus());
280 }

References assignNewUserToRoot(), ilObjStudyProgramme\createInstance(), setAllNodesActive(), and ilStudyProgrammeProgress\STATUS_NOT_RELEVANT.

+ Here is the call graph for this function:

◆ testNoImplicitPointUpdate()

ilStudyProgrammeUserProgressTest::testNoImplicitPointUpdate ( )

Definition at line 400 of file ilStudyProgrammeUserProgressTest.php.

400 {
401 $this->setAllNodesActive();
402 $tmp = $this->assignNewUserToRoot();
403 $ass = $tmp[0];
404 $user = $tmp[1];
405
406 $NEW_AMOUNT_OF_POINTS = 201;
407 $this->assertNotEquals($NEW_AMOUNT_OF_POINTS, ilStudyProgramme::DEFAULT_POINTS);
408
409 $this->root->setPoints($NEW_AMOUNT_OF_POINTS)
410 ->update();
411
412 $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
413 $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $root_progress->getAmountOfPoints());
414 }

References assignNewUserToRoot(), ilStudyProgramme\DEFAULT_POINTS, and setAllNodesActive().

+ Here is the call graph for this function:

◆ testNoUpdateOnModifiedNodes()

ilStudyProgrammeUserProgressTest::testNoUpdateOnModifiedNodes ( )

Definition at line 458 of file ilStudyProgrammeUserProgressTest.php.

458 {
459 $this->setAllNodesActive();
460 $tmp = $this->assignNewUserToRoot();
461 $ass1 = $tmp[0];
462 $user1 = $tmp[1];
463
464 $tmp = $this->assignNewUserToRoot();
465 $ass2 = $tmp[0];
466 $user2 = $tmp[1];
467
468 $NEW_AMOUNT_OF_POINTS_1 = 205;
469 $this->assertNotEquals($NEW_AMOUNT_OF_POINTS_1, ilStudyProgramme::DEFAULT_POINTS);
470 $NEW_AMOUNT_OF_POINTS_2 = 206;
471 $this->assertNotEquals($NEW_AMOUNT_OF_POINTS_2, ilStudyProgramme::DEFAULT_POINTS);
472 $this->assertNotEquals($NEW_AMOUNT_OF_POINTS_1, $NEW_AMOUNT_OF_POINTS_2);
473
474 $node2_progress1 = array_shift($this->node2->getProgressesOf($user1->getId()));
475 $node2_progress2 = array_shift($this->node2->getProgressesOf($user2->getId()));
476
477 $node2_progress1->setRequiredAmountOfPoints($NEW_AMOUNT_OF_POINTS_1, $this->user->getId());
478
479 $this->node2->setPoints($NEW_AMOUNT_OF_POINTS_2)
480 ->update();
481 $this->root->updateAllAssignments();
482
483 $this->assertEquals($NEW_AMOUNT_OF_POINTS_1, $node2_progress1->getAmountOfPoints());
484 $this->assertEquals($NEW_AMOUNT_OF_POINTS_2, $node2_progress2->getAmountOfPoints());
485 }

References assignNewUserToRoot(), ilStudyProgramme\DEFAULT_POINTS, and setAllNodesActive().

+ Here is the call graph for this function:

◆ testOutdatedNodesCantBeSetToRelevant()

ilStudyProgrammeUserProgressTest::testOutdatedNodesCantBeSetToRelevant ( )

QUA-Objekte, welche "Inaktiv" sind können bei Studierenden-Studienplänen nicht von "nicht relevant" auf irgendeinen anderen Status gesetzt werden.

@expectedException ilException

Definition at line 493 of file ilStudyProgrammeUserProgressTest.php.

493 {
494 $this->setAllNodesActive();
495 $this->node1->setStatus(ilStudyProgramme::STATUS_OUTDATED);
496 $tmp = $this->assignNewUserToRoot();
497 $ass1 = $tmp[0];
498 $user1 = $tmp[1];
499
500 $progress = $this->node1->getProgressForAssignment($ass1->getId());
502 , $progress->getStatus());
503 $progress->markAccredited($this->user->getId());
504 }

References assignNewUserToRoot(), setAllNodesActive(), ilStudyProgrammeProgress\STATUS_NOT_RELEVANT, and ilStudyProgramme\STATUS_OUTDATED.

+ Here is the call graph for this function:

◆ testUnmarkAccredited()

ilStudyProgrammeUserProgressTest::testUnmarkAccredited ( )

Definition at line 212 of file ilStudyProgrammeUserProgressTest.php.

212 {
213 $this->setAllNodesActive();
214 $tmp = $this->assignNewUserToRoot();
215 $ass = $tmp[0];
216 $user = $tmp[1];
217
218 $user2 = $this->newUser();
219 $USER_ID = $user2->getId();
220
221 $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
222 $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
223 $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
224
225 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $root_progress->getStatus());
226 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $node1_progress->getStatus());
227 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $node2_progress->getStatus());
228
229 $ts_before_change = $node2_progress->getLastChange()->get(IL_CAL_DATETIME);
230 $node2_progress->markAccredited($USER_ID);
231 $node2_progress->unmarkAccredited();
232 $ts_after_change = $node2_progress->getLastChange()->get(IL_CAL_DATETIME);
233
234 // The root node will still be completed, as we do not go back from completed to some other
235 // status.
236 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $root_progress->getStatus());
237 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $node1_progress->getStatus());
238 $this->assertEquals(ilStudyProgrammeProgress::STATUS_IN_PROGRESS, $node2_progress->getStatus());
239 $this->assertEquals(NULL, $node2_progress->getCompletionBy());
240 $this->assertLessThanOrEqual($ts_before_change, $ts_after_change);
241 }

References assignNewUserToRoot(), IL_CAL_DATETIME, newUser(), setAllNodesActive(), and ilStudyProgrammeProgress\STATUS_IN_PROGRESS.

+ Here is the call graph for this function:

◆ testUserDeletionDeletesAssignments()

ilStudyProgrammeUserProgressTest::testUserDeletionDeletesAssignments ( )

Definition at line 383 of file ilStudyProgrammeUserProgressTest.php.

383 {
384 $this->setAllNodesActive();
385 $tmp = $this->assignNewUserToRoot();
386 $ass = $tmp[0];
387 $user = $tmp[1];
388
389 $user->delete();
390
391 $root_progresses = $this->root->getProgressesOf($user->getId());
392 $this->assertCount(0, $root_progresses);
393 $node1_progresses = $this->root->getProgressesOf($user->getId());
394 $this->assertCount(0, $node1_progresses);
395 $node2_progresses = $this->root->getProgressesOf($user->getId());
396 $this->assertCount(0, $node2_progresses);
397 }

References assignNewUserToRoot(), and setAllNodesActive().

+ Here is the call graph for this function:

◆ testUserSelection()

ilStudyProgrammeUserProgressTest::testUserSelection ( )

Definition at line 169 of file ilStudyProgrammeUserProgressTest.php.

169 {
170 $this->setAllNodesActive();
171 $this->assignNewUserToRoot();
172 $tmp = $this->assignNewUserToRoot();
173 $ass = $tmp[0];
174 $user = $tmp[1];
175
176 $root_progresses = $this->root->getProgressesOf($user->getId());
177 $this->assertCount(1, $root_progresses);
178 }

References assignNewUserToRoot(), and setAllNodesActive().

+ Here is the call graph for this function:

Field Documentation

◆ $backupGlobals

ilStudyProgrammeUserProgressTest::$backupGlobals = FALSE
protected

Definition at line 15 of file ilStudyProgrammeUserProgressTest.php.


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