ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

needsInstalledILIAS

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 15 of file ilStudyProgrammeUserProgressTest.php.

Member Function Documentation

◆ assignNewUserToRoot()

◆ newUser()

ilStudyProgrammeUserProgressTest::newUser ( )
protected

Definition at line 56 of file ilStudyProgrammeUserProgressTest.php.

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

56  {
57  $user = new ilObjUser();
58  $user->create();
59  return $user;
60  }
+ Here is the caller graph for this function:

◆ setAllNodesActive()

◆ setUp()

ilStudyProgrammeUserProgressTest::setUp ( )
protected

Definition at line 18 of file ilStudyProgrammeUserProgressTest.php.

References $DIC, $ilUser, ilObjStudyProgramme\createInstance(), and user().

18  {
19  PHPUnit_Framework_Error_Deprecated::$enabled = FALSE;
20 
21  require_once("./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
22 
23  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
24  ilUnitUtil::performInitialisation();
25 
27  $this->root->putInTree(ROOT_FOLDER_ID);
28  $this->root->object_factory = new ilObjectFactoryWrapperMock();
29 
30  $this->node1 = ilObjStudyProgramme::createInstance();
31  $this->node2 = ilObjStudyProgramme::createInstance();
32 
33  $this->leaf1 = new ilStudyProgrammeLeafMock();
34  $this->leaf2 = new ilStudyProgrammeLeafMock();
35 
36  $this->root->addNode($this->node1);
37  $this->root->addNode($this->node2);
38  $this->node1->addLeaf($this->leaf1);
39  $this->node2->addLeaf($this->leaf2);
40 
41  global $DIC;
42  $tree = $DIC['tree'];
43  $this->tree = $tree;
44 
45  global $DIC;
46  $ilUser = $DIC['ilUser'];
47  $this->user = $ilUser;
48  }
Mock classes for tests.
Definition: mocks.php:20
user()
Definition: user.php:4
$ilUser
Definition: imgupload.php:18
static createInstance()
Create an instance of ilObjStudyProgramme, put in cache.
global $DIC
Mock for object factory.
Definition: mocks.php:68
+ Here is the call graph for this function:

◆ tearDown()

ilStudyProgrammeUserProgressTest::tearDown ( )
protected

Definition at line 50 of file ilStudyProgrammeUserProgressTest.php.

50  {
51  if ($this->root) {
52  $this->root->delete();
53  }
54  }

◆ testCanBeCompleted1()

ilStudyProgrammeUserProgressTest::testCanBeCompleted1 ( )

Definition at line 331 of file ilStudyProgrammeUserProgressTest.php.

References assignNewUserToRoot(), and setAllNodesActive().

331  {
332  $this->setAllNodesActive();
333  $tmp = $this->assignNewUserToRoot();
334  $ass = $tmp[0];
335  $user = $tmp[1];
336 
337  $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
338  $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
339  $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
340 
341  $this->assertTrue($root_progress->canBeCompleted());
342  $this->assertTrue($node1_progress->canBeCompleted());
343  $this->assertTrue($node2_progress->canBeCompleted());
344  }
+ Here is the call graph for this function:

◆ testCanBeCompleted2()

ilStudyProgrammeUserProgressTest::testCanBeCompleted2 ( )

Definition at line 346 of file ilStudyProgrammeUserProgressTest.php.

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

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

◆ testCanBeCompleted3()

ilStudyProgrammeUserProgressTest::testCanBeCompleted3 ( )

Definition at line 363 of file ilStudyProgrammeUserProgressTest.php.

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

363  {
364  $NEW_AMOUNT_OF_POINTS = 3003;
365  $this->assertGreaterThan(ilStudyProgramme::DEFAULT_POINTS, $NEW_AMOUNT_OF_POINTS);
366 
367  $this->setAllNodesActive();
369  $this->root->addNode($node3);
370  $node3->setPoints($NEW_AMOUNT_OF_POINTS)
372  ->update();
373 
374 
375  $tmp = $this->assignNewUserToRoot();
376  $ass = $tmp[0];
377  $user = $tmp[1];
378 
379  $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
380  $node3_progress = array_shift($node3->getProgressesOf($user->getId()));
381 
382  $this->assertFalse($root_progress->canBeCompleted());
383  $this->assertFalse($node3_progress->canBeCompleted());
384  }
static createInstance()
Create an instance of ilObjStudyProgramme, put in cache.
+ Here is the call graph for this function:

◆ testCompletionOnDeeplyNestedProgresses()

ilStudyProgrammeUserProgressTest::testCompletionOnDeeplyNestedProgresses ( )

Definition at line 583 of file ilStudyProgrammeUserProgressTest.php.

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

583  {
588  $depth1->putInTree(ROOT_FOLDER_ID);
589  $depth1->addNode($depth2);
590  $depth2->addNode($depth3);
591  $depth3->addNode($depth4);
592  $depth1->setStatus(ilStudyProgramme::STATUS_ACTIVE);
593  $depth2->setStatus(ilStudyProgramme::STATUS_ACTIVE);
594  $depth3->setStatus(ilStudyProgramme::STATUS_ACTIVE);
595  $depth4->setStatus(ilStudyProgramme::STATUS_ACTIVE);
596 
597  $user = $this->newUser();
598 
599  $assignment = $depth1->assignUser($user->getId());
600  $progress4 = $depth4->getProgressForAssignment($assignment->getId());
601  $progress4->markAccredited(6);
602 
603  $progress1 = $depth1->getProgressForAssignment($assignment->getId());
604  $progress2 = $depth2->getProgressForAssignment($assignment->getId());
605  $progress3 = $depth3->getProgressForAssignment($assignment->getId());
606 
607  $this->assertTrue($progress1->isSuccessful());
608  $this->assertTrue($progress2->isSuccessful());
609  $this->assertTrue($progress3->isSuccessful());
610  $this->assertTrue($progress4->isSuccessful());
611 
612  $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $progress1->getCurrentAmountOfPoints());
613  $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $progress2->getCurrentAmountOfPoints());
614  $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $progress3->getCurrentAmountOfPoints());
615  $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $progress4->getCurrentAmountOfPoints());
616  }
static createInstance()
Create an instance of ilObjStudyProgramme, put in cache.
+ Here is the call graph for this function:

◆ testExplicitPointUpdate1()

ilStudyProgrammeUserProgressTest::testExplicitPointUpdate1 ( )

Definition at line 421 of file ilStudyProgrammeUserProgressTest.php.

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

421  {
422  $this->setAllNodesActive();
423  $tmp = $this->assignNewUserToRoot();
424  $ass = $tmp[0];
425  $user = $tmp[1];
426 
427  $NEW_AMOUNT_OF_POINTS = 202;
428  $this->assertNotEquals($NEW_AMOUNT_OF_POINTS, ilStudyProgramme::DEFAULT_POINTS);
429 
430  $this->root->setPoints($NEW_AMOUNT_OF_POINTS)
431  ->update();
432 
433  $ass->updateFromProgram();
434  $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
435  $this->assertEquals($NEW_AMOUNT_OF_POINTS, $root_progress->getAmountOfPoints());
436  }
+ Here is the call graph for this function:

◆ testExplicitPointUpdate2()

ilStudyProgrammeUserProgressTest::testExplicitPointUpdate2 ( )

Definition at line 441 of file ilStudyProgrammeUserProgressTest.php.

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

441  {
442  $this->setAllNodesActive();
443  $tmp = $this->assignNewUserToRoot();
444  $ass = $tmp[0];
445  $user = $tmp[1];
446 
447  $NEW_AMOUNT_OF_POINTS = 203;
448  $this->assertNotEquals($NEW_AMOUNT_OF_POINTS, ilStudyProgramme::DEFAULT_POINTS);
449 
450  $this->root->setPoints($NEW_AMOUNT_OF_POINTS)
451  ->update();
452 
453  $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
454  $ass->updateFromProgram();
455  $this->assertEquals($NEW_AMOUNT_OF_POINTS, $root_progress->getAmountOfPoints());
456  }
+ Here is the call graph for this function:

◆ testGetNamesOfCompletedOrAccreditedChildren()

ilStudyProgrammeUserProgressTest::testGetNamesOfCompletedOrAccreditedChildren ( )

Definition at line 554 of file ilStudyProgrammeUserProgressTest.php.

References $names, array, assignNewUserToRoot(), newUser(), and setAllNodesActive().

554  {
555  $this->setAllNodesActive();
556  $tmp = $this->assignNewUserToRoot();
557  $ass = $tmp[0];
558  $user = $tmp[1];
559 
560  $user2 = $this->newUser();
561  $USER_ID = $user2->getId();
562 
563  $this->node1->setTitle("node1");
564  $this->node1->update();
565  $this->node2->setTitle("node2");
566  $this->node2->update();
567 
568  $names = $this->root->getProgressForAssignment($ass->getId())
569  ->getNamesOfCompletedOrAccreditedChildren();
570  $this->assertEquals($names, array());
571 
572  $this->node1->getProgressForAssignment($ass->getId())->markAccredited($USER_ID);
573  $names = $this->root->getProgressForAssignment($ass->getId())
574  ->getNamesOfCompletedOrAccreditedChildren();
575  $this->assertEquals($names, array("node1"));
576 
577  $this->node2->getProgressForAssignment($ass->getId())->markAccredited($USER_ID);
578  $names = $this->root->getProgressForAssignment($ass->getId())
579  ->getNamesOfCompletedOrAccreditedChildren();
580  $this->assertEquals($names, array("node1", "node2"));
581  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ testHasDeviationToProgram1()

ilStudyProgrammeUserProgressTest::testHasDeviationToProgram1 ( )

Definition at line 511 of file ilStudyProgrammeUserProgressTest.php.

References assignNewUserToRoot(), and setAllNodesActive().

511  {
512  $this->setAllNodesActive();
513  $tmp = $this->assignNewUserToRoot();
514  $ass1 = $tmp[0];
515  $user1 = $tmp[1];
516 
517  $progress = $this->node1->getProgressForAssignment($ass1->getId());
518  $this->assertFalse($progress->hasIndividualModifications());
519  }
+ Here is the call graph for this function:

◆ testHasDeviationToProgram2()

ilStudyProgrammeUserProgressTest::testHasDeviationToProgram2 ( )

Definition at line 521 of file ilStudyProgrammeUserProgressTest.php.

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

521  {
522  $this->setAllNodesActive();
523  $tmp = $this->assignNewUserToRoot();
524  $ass1 = $tmp[0];
525  $user1 = $tmp[1];
526 
527  $progress = $this->node1->getProgressForAssignment($ass1->getId());
528  $progress->setRequiredAmountOfPoints(1000, $this->user->getId());
529  $this->assertTrue($progress->hasIndividualModifications());
530  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ testHasDeviationToProgram3()

ilStudyProgrammeUserProgressTest::testHasDeviationToProgram3 ( )

Definition at line 532 of file ilStudyProgrammeUserProgressTest.php.

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

532  {
533  $this->setAllNodesActive();
534  $tmp = $this->assignNewUserToRoot();
535  $ass1 = $tmp[0];
536  $user1 = $tmp[1];
537 
538  $progress = $this->node1->getProgressForAssignment($ass1->getId());
539  $progress->markNotRelevant($this->user->getId());
540  $this->assertTrue($progress->hasIndividualModifications());
541  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ testHasDeviationToProgram4()

ilStudyProgrammeUserProgressTest::testHasDeviationToProgram4 ( )

Definition at line 543 of file ilStudyProgrammeUserProgressTest.php.

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

543  {
544  $this->setAllNodesActive();
545  $tmp = $this->assignNewUserToRoot();
546  $ass1 = $tmp[0];
547  $user1 = $tmp[1];
548 
549  $progress = $this->node1->getProgressForAssignment($ass1->getId());
550  $progress->markAccredited($this->user->getId());
551  $this->assertFalse($progress->hasIndividualModifications());
552  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ testIndividualRequiredPoints()

ilStudyProgrammeUserProgressTest::testIndividualRequiredPoints ( )

Definition at line 285 of file ilStudyProgrammeUserProgressTest.php.

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

285  {
286  $this->setAllNodesActive();
287  $tmp = $this->assignNewUserToRoot();
288  $ass1 = $tmp[0];
289  $user1 = $tmp[1];
290 
291 
292  $NEW_AMOUNT_OF_POINTS_1 = 205;
293  $this->assertNotEquals($NEW_AMOUNT_OF_POINTS_1, ilStudyProgramme::DEFAULT_POINTS);
294 
295  $node2_progress1 = array_shift($this->node2->getProgressesOf($user1->getId()));
296  $node2_progress1->setRequiredAmountOfPoints($NEW_AMOUNT_OF_POINTS_1, $this->user->getId());
297 
298  $this->assertEquals($NEW_AMOUNT_OF_POINTS_1, $node2_progress1->getAmountOfPoints());
299  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ testInitialProgressActive()

ilStudyProgrammeUserProgressTest::testInitialProgressActive ( )

Definition at line 73 of file ilStudyProgrammeUserProgressTest.php.

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

73  {
74  $this->setAllNodesActive();
75  $tmp = $this->assignNewUserToRoot();
76  $ass = $tmp[0];
77  $user = $tmp[1];
78 
79  $root_progresses = $this->root->getProgressesOf($user->getId());
80  $this->assertCount(1, $root_progresses);
81  $root_progress = $root_progresses[0];
83  , $root_progress->getStatus());
84  $this->assertEquals( $this->root->getPoints()
85  , $root_progress->getAmountOfPoints());
86  $this->assertEquals(0, $root_progress->getCurrentAmountOfPoints());
87  $this->assertEquals($this->root->getId(), $root_progress->getStudyProgramme()->getId());
88  $this->assertEquals($ass->getId(), $root_progress->getAssignment()->getId());
89  $this->assertEquals($user->getId(), $root_progress->getUserId());
90  $this->assertNull($root_progress->getLastChangeBy());
91  $this->assertNull($root_progress->getCompletionBy());
92 
93  $node1_progresses = $this->node1->getProgressesOf($user->getId());
94  $this->assertCount(1, $node1_progresses);
95  $node1_progress = $node1_progresses[0];
97  , $node1_progress->getStatus());
98  $this->assertEquals( $this->node1->getPoints()
99  , $node1_progress->getAmountOfPoints());
100  $this->assertEquals(0, $node1_progress->getCurrentAmountOfPoints());
101  $this->assertEquals($this->node1->getId(), $node1_progress->getStudyProgramme()->getId());
102  $this->assertEquals($ass->getId(), $node1_progress->getAssignment()->getId());
103  $this->assertEquals($user->getId(), $node1_progress->getUserId());
104  $this->assertNull($node1_progress->getLastChangeBy());
105  $this->assertNull($node1_progress->getCompletionBy());
106 
107  $node2_progresses = $this->node2->getProgressesOf($user->getId());
108  $this->assertCount(1, $node2_progresses);
109  $node2_progress = $node2_progresses[0];
111  , $node2_progress->getStatus());
112  $this->assertEquals( $this->node2->getPoints()
113  , $node2_progress->getAmountOfPoints());
114  $this->assertEquals(0, $node2_progress->getCurrentAmountOfPoints());
115  $this->assertEquals($this->node2->getId(), $node2_progress->getStudyProgramme()->getId());
116  $this->assertEquals($ass->getId(), $node2_progress->getAssignment()->getId());
117  $this->assertEquals($user->getId(), $node2_progress->getUserId());
118  $this->assertNull($node2_progress->getLastChangeBy());
119  $this->assertNull($node2_progress->getCompletionBy());
120  }
+ Here is the call graph for this function:

◆ testInitialProgressDraft()

ilStudyProgrammeUserProgressTest::testInitialProgressDraft ( )

Definition at line 122 of file ilStudyProgrammeUserProgressTest.php.

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

122  {
123  $this->root->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
124  $this->node1->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
125  $this->node2->setStatus(ilStudyProgramme::STATUS_DRAFT)->update();
126 
127  $tmp = $this->assignNewUserToRoot();
128  $user = $tmp[1];
129  $ass = $tmp[0];
130 
131  $root_progresses = $this->root->getProgressesOf($user->getId());
132  $root_progress = $root_progresses[0];
134  , $root_progress->getStatus());
135 
136  $node1_progresses = $this->node1->getProgressesOf($user->getId());
137  $node1_progress = $node1_progresses[0];
139  , $node1_progress->getStatus());
140 
141  $node2_progresses = $this->node2->getProgressesOf($user->getId());
142  $node2_progress = $node2_progresses[0];
144  , $node2_progress->getStatus());
145  }
+ Here is the call graph for this function:

◆ testInitialProgressOutdated()

ilStudyProgrammeUserProgressTest::testInitialProgressOutdated ( )

Definition at line 147 of file ilStudyProgrammeUserProgressTest.php.

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

147  {
148  $this->root->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
149  $this->node1->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
150  $this->node2->setStatus(ilStudyProgramme::STATUS_OUTDATED)->update();
151 
152  $tmp = $this->assignNewUserToRoot();
153  $user = $tmp[1];
154  $ass = $tmp[0];
155 
156  $root_progresses = $this->root->getProgressesOf($user->getId());
157  $root_progress = $root_progresses[0];
159  , $root_progress->getStatus());
160 
161  $node1_progresses = $this->node1->getProgressesOf($user->getId());
162  $node1_progress = $node1_progresses[0];
164  , $node1_progress->getStatus());
165 
166  $node2_progresses = $this->node2->getProgressesOf($user->getId());
167  $node2_progress = $node2_progresses[0];
169  , $node2_progress->getStatus());
170  }
+ Here is the call graph for this function:

◆ testMarkAccredited()

ilStudyProgrammeUserProgressTest::testMarkAccredited ( )

Definition at line 183 of file ilStudyProgrammeUserProgressTest.php.

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

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

◆ testMarkNotRelevant()

ilStudyProgrammeUserProgressTest::testMarkNotRelevant ( )

Definition at line 247 of file ilStudyProgrammeUserProgressTest.php.

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

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

◆ testMaximimPossibleAmountOfPoints1()

ilStudyProgrammeUserProgressTest::testMaximimPossibleAmountOfPoints1 ( )

Definition at line 301 of file ilStudyProgrammeUserProgressTest.php.

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

301  {
302  $this->setAllNodesActive();
303  $tmp = $this->assignNewUserToRoot();
304  $ass = $tmp[0];
305  $user = $tmp[1];
306 
307  $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
308  $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
309  $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
310 
311  $this->assertEquals(2 * ilStudyProgramme::DEFAULT_POINTS, $root_progress->getMaximumPossibleAmountOfPoints());
312  $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $node1_progress->getMaximumPossibleAmountOfPoints());
313  $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $node2_progress->getMaximumPossibleAmountOfPoints());
314  }
+ Here is the call graph for this function:

◆ testMaximimPossibleAmountOfPoints2()

ilStudyProgrammeUserProgressTest::testMaximimPossibleAmountOfPoints2 ( )

Definition at line 316 of file ilStudyProgrammeUserProgressTest.php.

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

316  {
317  $this->setAllNodesActive();
318  $tmp = $this->assignNewUserToRoot();
319  $ass = $tmp[0];
320  $user = $tmp[1];
321 
322  $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
323  $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
324  $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
325 
326  $this->assertEquals(2 * ilStudyProgramme::DEFAULT_POINTS, $root_progress->getMaximumPossibleAmountOfPoints());
327  $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $node1_progress->getMaximumPossibleAmountOfPoints());
328  $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $node2_progress->getMaximumPossibleAmountOfPoints());
329  }
+ Here is the call graph for this function:

◆ testNewNodesAreNotRelevant()

ilStudyProgrammeUserProgressTest::testNewNodesAreNotRelevant ( )

Definition at line 271 of file ilStudyProgrammeUserProgressTest.php.

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

271  {
272  $this->setAllNodesActive();
273  $tmp = $this->assignNewUserToRoot();
274  $ass = $tmp[0];
275  $user = $tmp[1];
276 
278  $this->root->addNode($node3);
279 
280  $node3_progress = array_shift($node3->getProgressesOf($user->getId()));
281  $this->assertNotNull($node3_progress);
282  $this->assertEquals(ilStudyProgrammeProgress::STATUS_NOT_RELEVANT, $node3_progress->getStatus());
283  }
static createInstance()
Create an instance of ilObjStudyProgramme, put in cache.
+ Here is the call graph for this function:

◆ testNoImplicitPointUpdate()

ilStudyProgrammeUserProgressTest::testNoImplicitPointUpdate ( )

Definition at line 403 of file ilStudyProgrammeUserProgressTest.php.

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

403  {
404  $this->setAllNodesActive();
405  $tmp = $this->assignNewUserToRoot();
406  $ass = $tmp[0];
407  $user = $tmp[1];
408 
409  $NEW_AMOUNT_OF_POINTS = 201;
410  $this->assertNotEquals($NEW_AMOUNT_OF_POINTS, ilStudyProgramme::DEFAULT_POINTS);
411 
412  $this->root->setPoints($NEW_AMOUNT_OF_POINTS)
413  ->update();
414 
415  $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
416  $this->assertEquals(ilStudyProgramme::DEFAULT_POINTS, $root_progress->getAmountOfPoints());
417  }
+ Here is the call graph for this function:

◆ testNoUpdateOnModifiedNodes()

ilStudyProgrammeUserProgressTest::testNoUpdateOnModifiedNodes ( )

Definition at line 461 of file ilStudyProgrammeUserProgressTest.php.

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

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

ilException

Definition at line 496 of file ilStudyProgrammeUserProgressTest.php.

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

496  {
497  $this->setAllNodesActive();
498  $this->node1->setStatus(ilStudyProgramme::STATUS_OUTDATED);
499  $tmp = $this->assignNewUserToRoot();
500  $ass1 = $tmp[0];
501  $user1 = $tmp[1];
502 
503  $progress = $this->node1->getProgressForAssignment($ass1->getId());
505  , $progress->getStatus());
506  $progress->markAccredited($this->user->getId());
507  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ testUnmarkAccredited()

ilStudyProgrammeUserProgressTest::testUnmarkAccredited ( )

Definition at line 215 of file ilStudyProgrammeUserProgressTest.php.

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

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

◆ testUserDeletionDeletesAssignments()

ilStudyProgrammeUserProgressTest::testUserDeletionDeletesAssignments ( )

Definition at line 386 of file ilStudyProgrammeUserProgressTest.php.

References assignNewUserToRoot(), and setAllNodesActive().

386  {
387  $this->setAllNodesActive();
388  $tmp = $this->assignNewUserToRoot();
389  $ass = $tmp[0];
390  $user = $tmp[1];
391 
392  $user->delete();
393 
394  $root_progresses = $this->root->getProgressesOf($user->getId());
395  $this->assertCount(0, $root_progresses);
396  $node1_progresses = $this->root->getProgressesOf($user->getId());
397  $this->assertCount(0, $node1_progresses);
398  $node2_progresses = $this->root->getProgressesOf($user->getId());
399  $this->assertCount(0, $node2_progresses);
400  }
+ Here is the call graph for this function:

◆ testUserSelection()

ilStudyProgrammeUserProgressTest::testUserSelection ( )

Definition at line 172 of file ilStudyProgrammeUserProgressTest.php.

References assignNewUserToRoot(), and setAllNodesActive().

172  {
173  $this->setAllNodesActive();
174  $this->assignNewUserToRoot();
175  $tmp = $this->assignNewUserToRoot();
176  $ass = $tmp[0];
177  $user = $tmp[1];
178 
179  $root_progresses = $this->root->getProgressesOf($user->getId());
180  $this->assertCount(1, $root_progresses);
181  }
+ Here is the call graph for this function:

Field Documentation

◆ $backupGlobals

ilStudyProgrammeUserProgressTest::$backupGlobals = FALSE
protected

Definition at line 16 of file ilStudyProgrammeUserProgressTest.php.


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