ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStudyProgrammeProgressTest Class Reference
+ Inheritance diagram for ilStudyProgrammeProgressTest:
+ Collaboration diagram for ilStudyProgrammeProgressTest:

Public Member Functions

 testPRGProgressInitAndId ()
 
 testPRGProgressProperties ()
 
 testPRGProgressStatusChecker ()
 
 testPRGProgressHasValidQualification ()
 
 testPRGProgressInvalidation ()
 
 testPRGProgressInvalidInvalidation ()
 
 testPRGProgressStatusActionsMarkAccredited ()
 
 testPRGProgressStatusActionsUnmarkAccredited ()
 
 testPRGProgressStatusActionsMarkFailed ()
 
 testPRGProgressStatusActionsMarkNotFailed ()
 
 testPRGProgressStatusActionsSucceed ()
 
 testPRGProgressStatusActionsMarkRelevant ()
 
 testPRGProgressStatusActionsMarkNotRelevant ()
 
 status ()
 
 testPRGProgressInvalidStatus ()
 
 testPRGProgressAllowedTransitionsForInProgress (int $status)
 status More...
 
 testPRGProgressAllowedTransitionsForAccredited ($status)
 status More...
 
 testPRGProgressAllowedTransitionsForCompleted ($status)
 status More...
 
 testPRGProgressAllowedTransitionsForFailed ($status)
 status More...
 
 testPRGProgressAllowedTransitionsForIrrelevant ($status)
 status More...
 
 testPRGProgressPointsOfChildren ()
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

Definition at line 25 of file ilStudyProgrammeProgressTest.php.

Member Function Documentation

◆ status()

◆ testPRGProgressAllowedTransitionsForAccredited()

ilStudyProgrammeProgressTest::testPRGProgressAllowedTransitionsForAccredited (   $status)

status

Definition at line 283 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_ACCREDITED, ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_FAILED, ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

284  {
285  $pgs = (new ilPRGProgress(123))
287  ->withStatus(ilPRGProgress::STATUS_ACCREDITED);
288  if (in_array($status, [
293  $pgs->getStatus()
294  ])) {
295  $this->assertTrue($pgs->isTransitionAllowedTo($status));
296  } else {
297  $this->assertFalse($pgs->isTransitionAllowedTo($status));
298  }
299  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressAllowedTransitionsForCompleted()

ilStudyProgrammeProgressTest::testPRGProgressAllowedTransitionsForCompleted (   $status)

status

Definition at line 304 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

305  {
306  $pgs = (new ilPRGProgress(123))
308  ->withStatus(ilPRGProgress::STATUS_COMPLETED);
309  if (in_array($status, [
312  $pgs->getStatus()
313  ])) {
314  $this->assertTrue($pgs->isTransitionAllowedTo($status));
315  } else {
316  $this->assertFalse($pgs->isTransitionAllowedTo($status));
317  }
318  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressAllowedTransitionsForFailed()

ilStudyProgrammeProgressTest::testPRGProgressAllowedTransitionsForFailed (   $status)

status

Definition at line 323 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_FAILED, ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

324  {
325  $pgs = (new ilPRGProgress(123))
327  ->withStatus(ilPRGProgress::STATUS_FAILED);
328  if (in_array($status, [
332  $pgs->getStatus()
333  ])) {
334  $this->assertTrue($pgs->isTransitionAllowedTo($status));
335  } else {
336  $this->assertFalse($pgs->isTransitionAllowedTo($status));
337  }
338  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressAllowedTransitionsForInProgress()

ilStudyProgrammeProgressTest::testPRGProgressAllowedTransitionsForInProgress ( int  $status)

status

Definition at line 264 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_ACCREDITED, ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_FAILED, ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

264  : void
265  {
266  $pgs = (new ilPRGProgress(123))->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
267  if (in_array($status, [
272  $pgs->getStatus()
273  ])) {
274  $this->assertTrue($pgs->isTransitionAllowedTo($status));
275  } else {
276  $this->assertFalse($pgs->isTransitionAllowedTo($status));
277  }
278  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressAllowedTransitionsForIrrelevant()

ilStudyProgrammeProgressTest::testPRGProgressAllowedTransitionsForIrrelevant (   $status)

status

Definition at line 343 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

343  : void
344  {
345  $pgs = (new ilPRGProgress(123))->withStatus(ilPRGProgress::STATUS_NOT_RELEVANT);
346  if ($status === ilPRGProgress::STATUS_IN_PROGRESS
347  || $status === $pgs->getStatus()
348  ) {
349  $this->assertTrue($pgs->isTransitionAllowedTo($status));
350  } else {
351  $this->assertFalse($pgs->isTransitionAllowedTo($status));
352  }
353  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressHasValidQualification()

ilStudyProgrammeProgressTest::testPRGProgressHasValidQualification ( )

Definition at line 70 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_COMPLETED, and ilPRGProgress\STATUS_IN_PROGRESS.

70  : void
71  {
72  $today = new DateTimeImmutable();
73  $yesterday = $today->sub(new DateInterval('P1D'));
74  $tomorrow = $today->add(new DateInterval('P1D'));
75 
76  $pgs = (new ilPRGProgress(555))
78  ->withValidityOfQualification($today);
79 
80  $this->assertNull($pgs->hasValidQualification($today));
81 
82  $pgs = $pgs->withStatus(ilPRGProgress::STATUS_COMPLETED);
83  $this->assertTrue($pgs->hasValidQualification($yesterday));
84  $this->assertTrue($pgs->hasValidQualification($today));
85  $this->assertFalse($pgs->hasValidQualification($tomorrow));
86  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressInitAndId()

ilStudyProgrammeProgressTest::testPRGProgressInitAndId ( )

Definition at line 29 of file ilStudyProgrammeProgressTest.php.

29  : void
30  {
31  $pgs = new ilPRGProgress(123);
32  $this->assertInstanceOf(Node::class, $pgs);
33  $this->assertEquals($pgs->getNodeId(), 123);
34  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressInvalidation()

ilStudyProgrammeProgressTest::testPRGProgressInvalidation ( )

Definition at line 88 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_COMPLETED, and ilPRGProgress\STATUS_IN_PROGRESS.

88  : void
89  {
90  $today = new DateTimeImmutable();
91  $yesterday = $today->sub(new DateInterval('P1D'));
92 
93  $pgs = (new ilPRGProgress(666))
96  ->withValidityOfQualification($today);
97  $this->assertFalse($pgs->isInvalidated());
98 
99  $pgs = $pgs
100  ->withValidityOfQualification($yesterday)
101  ->invalidate();
102  $this->assertTrue($pgs->isInvalidated());
103  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressInvalidInvalidation()

ilStudyProgrammeProgressTest::testPRGProgressInvalidInvalidation ( )

Definition at line 105 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_COMPLETED.

105  : void
106  {
107  $this->expectException(\ilException::class);
108  $today = new DateTimeImmutable();
109  $tomorrow = $today->add(new DateInterval('P1D'));
110  $pgs = (new ilPRGProgress(777))
111  ->withStatus(ilPRGProgress::STATUS_COMPLETED)
112  ->withValidityOfQualification($tomorrow)
113  ->invalidate();
114  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressInvalidStatus()

ilStudyProgrammeProgressTest::testPRGProgressInvalidStatus ( )

Definition at line 255 of file ilStudyProgrammeProgressTest.php.

255  : void
256  {
257  $this->expectException(\ilException::class);
258  $pgs = (new ilPRGProgress(123))->withStatus(777);
259  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressPointsOfChildren()

ilStudyProgrammeProgressTest::testPRGProgressPointsOfChildren ( )

Definition at line 355 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

355  : void
356  {
357  /*
358  └── 1
359  ├── 11
360  │ ├── 111
361  │ └── 112
362  ├── 12
363  └── 13
364  */
365 
366  $pgs112 = (new ilPRGProgress(112, ilPRGProgress::STATUS_COMPLETED))
367  ->withAmountOfPoints(112);
368  $pgs111 = (new ilPRGProgress(111, ilPRGProgress::STATUS_COMPLETED))
369  ->withAmountOfPoints(111);
371  ->setSubnodes([$pgs111, $pgs112])
372  ->withAmountOfPoints(11);
374  ->withAmountOfPoints(12);
376  ->withAmountOfPoints(13);
378  ->setSubnodes([$pgs11, $pgs12, $pgs13])
379  ->withAmountOfPoints(1);
380 
381  $this->assertEquals(111 + 112, $pgs11->getPossiblePointsOfRelevantChildren());
382  $this->assertEquals(0, $pgs12->getPossiblePointsOfRelevantChildren());
383  $this->assertEquals(11 + 12 + 13 * 0, $pgs1->getPossiblePointsOfRelevantChildren());
384  $this->assertEquals(111 + 112, $pgs11->getAchievedPointsOfChildren());
385  $this->assertEquals(0, $pgs1->getAchievedPointsOfChildren());
386  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressProperties()

ilStudyProgrammeProgressTest::testPRGProgressProperties ( )

Definition at line 36 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_COMPLETED, and ilPRGProgress\STATUS_IN_PROGRESS.

36  : void
37  {
38  $pgs = (new ilPRGProgress(123))
40  $dat = DateTimeImmutable::createFromFormat('Ymd', '20221024');
41 
42  $this->assertEquals($pgs->withAmountOfPoints(12)->getAmountOfPoints(), 12);
43  $this->assertEquals($pgs->withCurrentAmountOfPoints(8)->getCurrentAmountOfPoints(), 8);
44 
45  $this->assertEquals($pgs->withStatus(ilPRGProgress::STATUS_COMPLETED)->getStatus(), ilPRGProgress::STATUS_COMPLETED);
46  $pgs = $pgs->withLastChange(6, $dat);
47  $this->assertEquals($pgs->getLastChangeBy(), 6);
48  $this->assertEquals($pgs->getLastChange(), $dat);
49  $this->assertEquals($pgs->withAssignmentDate($dat)->getAssignmentDate(), $dat);
50  $pgs = $pgs->withCompletion(6, $dat);
51  $this->assertEquals($pgs->getCompletionBy(), 6);
52  $this->assertEquals($pgs->getCompletionDate(), $dat);
53  $this->assertEquals($pgs->withDeadline($dat)->getDeadline(), $dat);
54  $this->assertEquals($pgs->withValidityOfQualification($dat)->getValidityOfQualification(), $dat);
55  $this->assertTrue($pgs->withIndividualModifications(true)->hasIndividualModifications());
56  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressStatusActionsMarkAccredited()

ilStudyProgrammeProgressTest::testPRGProgressStatusActionsMarkAccredited ( )

Definition at line 116 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\DATE_TIME_FORMAT, ilPRGProgress\STATUS_ACCREDITED, and ilPRGProgress\STATUS_IN_PROGRESS.

116  : void
117  {
118  $usr = 6;
119  $now = new DateTimeImmutable();
120  $pgs = (new ilPRGProgress(123))
121  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
122 
123  $pgs = $pgs->markAccredited($now, $usr);
124  $this->assertEquals($now, $pgs->getCompletionDate());
125  $this->assertEquals($usr, $pgs->getCompletionBy());
126  $this->assertEquals($usr, $pgs->getLastChangeBy());
127  $this->assertEquals(
128  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
129  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
130  );
131  $this->assertEquals(ilPRGProgress::STATUS_ACCREDITED, $pgs->getStatus());
132  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressStatusActionsMarkFailed()

ilStudyProgrammeProgressTest::testPRGProgressStatusActionsMarkFailed ( )

Definition at line 153 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\DATE_TIME_FORMAT, ilPRGProgress\STATUS_FAILED, and ilPRGProgress\STATUS_IN_PROGRESS.

153  : void
154  {
155  $usr = 6;
156  $now = new DateTimeImmutable();
157  $pgs = (new ilPRGProgress(123))
158  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
159 
160  $pgs = $pgs->markFailed($now, $usr);
161  $this->assertNull($pgs->getCompletionDate());
162  $this->assertNull($pgs->getCompletionBy());
163  $this->assertEquals($usr, $pgs->getLastChangeBy());
164  $this->assertEquals(
165  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
166  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
167  );
168  $this->assertEquals(ilPRGProgress::STATUS_FAILED, $pgs->getStatus());
169  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressStatusActionsMarkNotFailed()

ilStudyProgrammeProgressTest::testPRGProgressStatusActionsMarkNotFailed ( )

Definition at line 171 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\DATE_TIME_FORMAT, and ilPRGProgress\STATUS_IN_PROGRESS.

171  : void
172  {
173  $usr = 6;
174  $now = new DateTimeImmutable();
175  $pgs = (new ilPRGProgress(123))
176  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
177 
178  $pgs = $pgs->markNotFailed($now, $usr);
179  $this->assertNull($pgs->getCompletionDate());
180  $this->assertNull($pgs->getCompletionBy());
181  $this->assertEquals($usr, $pgs->getLastChangeBy());
182  $this->assertEquals(
183  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
184  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
185  );
186  $this->assertEquals(ilPRGProgress::STATUS_IN_PROGRESS, $pgs->getStatus());
187  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressStatusActionsMarkNotRelevant()

ilStudyProgrammeProgressTest::testPRGProgressStatusActionsMarkNotRelevant ( )

Definition at line 225 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\DATE_TIME_FORMAT, ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

225  : void
226  {
227  $usr = 6;
228  $now = new DateTimeImmutable();
229  $pgs = (new ilPRGProgress(123))
230  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
231 
232  $pgs = $pgs->markNotRelevant($now, $usr);
233  $this->assertNull($pgs->getCompletionBy());
234  $this->assertEquals($usr, $pgs->getLastChangeBy());
235  $this->assertEquals(
236  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
237  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
238  );
239  $this->assertEquals(ilPRGProgress::STATUS_NOT_RELEVANT, $pgs->getStatus());
240  $this->assertTrue($pgs->hasIndividualModifications());
241  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressStatusActionsMarkRelevant()

ilStudyProgrammeProgressTest::testPRGProgressStatusActionsMarkRelevant ( )

Definition at line 207 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\DATE_TIME_FORMAT, and ilPRGProgress\STATUS_IN_PROGRESS.

207  : void
208  {
209  $usr = 6;
210  $now = new DateTimeImmutable();
211  $pgs = (new ilPRGProgress(123))
212  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
213 
214  $pgs = $pgs->markRelevant($now, $usr);
215  $this->assertNull($pgs->getCompletionBy());
216  $this->assertEquals($usr, $pgs->getLastChangeBy());
217  $this->assertEquals(
218  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
219  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
220  );
221  $this->assertEquals(ilPRGProgress::STATUS_IN_PROGRESS, $pgs->getStatus());
222  $this->assertTrue($pgs->hasIndividualModifications());
223  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressStatusActionsSucceed()

ilStudyProgrammeProgressTest::testPRGProgressStatusActionsSucceed ( )

Definition at line 189 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\DATE_TIME_FORMAT, ilPRGProgress\STATUS_COMPLETED, and ilPRGProgress\STATUS_IN_PROGRESS.

189  : void
190  {
191  $usr = 6;
192  $now = new DateTimeImmutable();
193  $pgs = (new ilPRGProgress(123))
194  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
195 
196  $pgs = $pgs->succeed($now, $usr);
197  $this->assertEquals($now, $pgs->getCompletionDate());
198  $this->assertEquals($usr, $pgs->getCompletionBy());
199  $this->assertEquals($usr, $pgs->getLastChangeBy());
200  $this->assertEquals(
201  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
202  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
203  );
204  $this->assertEquals(ilPRGProgress::STATUS_COMPLETED, $pgs->getStatus());
205  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressStatusActionsUnmarkAccredited()

ilStudyProgrammeProgressTest::testPRGProgressStatusActionsUnmarkAccredited ( )

Definition at line 134 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\DATE_TIME_FORMAT, and ilPRGProgress\STATUS_IN_PROGRESS.

134  : void
135  {
136  $usr = 6;
137  $now = new DateTimeImmutable();
138  $pgs = (new ilPRGProgress(123))
139  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
140 
141  $pgs = $pgs->unmarkAccredited($now, $usr);
142  $this->assertNull($pgs->getCompletionDate());
143  $this->assertNull($pgs->getCompletionBy());
144  $this->assertNull($pgs->getValidityOfQualification());
145  $this->assertEquals($usr, $pgs->getLastChangeBy());
146  $this->assertEquals(
147  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
148  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
149  );
150  $this->assertEquals(ilPRGProgress::STATUS_IN_PROGRESS, $pgs->getStatus());
151  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

◆ testPRGProgressStatusChecker()

ilStudyProgrammeProgressTest::testPRGProgressStatusChecker ( )

Definition at line 58 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_ACCREDITED, ilPRGProgress\STATUS_FAILED, ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

58  : void
59  {
60  $pgs = (new ilPRGProgress(444))
62  $this->assertTrue($pgs->isRelevant());
63  $this->assertTrue($pgs->withStatus(ilPRGProgress::STATUS_ACCREDITED)->isSuccessful());
64  $this->assertFalse($pgs->withStatus(ilPRGProgress::STATUS_FAILED)->isSuccessful());
65  $this->assertFalse($pgs->withStatus(ilPRGProgress::STATUS_NOT_RELEVANT)->isRelevant());
66  $this->assertFalse($pgs->isAccredited());
67  $this->assertTrue($pgs->withStatus(ilPRGProgress::STATUS_ACCREDITED)->isAccredited());
68  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...

Field Documentation

◆ $backupGlobals

ilStudyProgrammeProgressTest::$backupGlobals = false
protected

Definition at line 27 of file ilStudyProgrammeProgressTest.php.


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