ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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 ()
 
 testPRGProgressInvalidStatus ()
 
 testPRGProgressAllowedTransitionsForInProgress (int $status)
 
 testPRGProgressAllowedTransitionsForAccredited ($status)
 
 testPRGProgressAllowedTransitionsForCompleted ($status)
 
 testPRGProgressAllowedTransitionsForFailed ($status)
 
 testPRGProgressAllowedTransitionsForIrrelevant ($status)
 
 testPRGProgressPointsOfChildren ()
 

Static Public Member Functions

static ilPRGProgressStatus ()
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

Definition at line 23 of file ilStudyProgrammeProgressTest.php.

Member Function Documentation

◆ ilPRGProgressStatus()

static ilStudyProgrammeProgressTest::ilPRGProgressStatus ( )
static

◆ testPRGProgressAllowedTransitionsForAccredited()

ilStudyProgrammeProgressTest::testPRGProgressAllowedTransitionsForAccredited (   $status)

Definition at line 277 of file ilStudyProgrammeProgressTest.php.

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

278  {
279  $pgs = (new ilPRGProgress(123))
281  ->withStatus(ilPRGProgress::STATUS_ACCREDITED);
282  if (in_array($status, [
287  $pgs->getStatus()
288  ])) {
289  $this->assertTrue($pgs->isTransitionAllowedTo($status));
290  } else {
291  $this->assertFalse($pgs->isTransitionAllowedTo($status));
292  }
293  }
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)

Definition at line 296 of file ilStudyProgrammeProgressTest.php.

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

297  {
298  $pgs = (new ilPRGProgress(123))
300  ->withStatus(ilPRGProgress::STATUS_COMPLETED);
301  if (in_array($status, [
304  $pgs->getStatus()
305  ])) {
306  $this->assertTrue($pgs->isTransitionAllowedTo($status));
307  } else {
308  $this->assertFalse($pgs->isTransitionAllowedTo($status));
309  }
310  }
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)

Definition at line 313 of file ilStudyProgrammeProgressTest.php.

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

314  {
315  $pgs = (new ilPRGProgress(123))
317  ->withStatus(ilPRGProgress::STATUS_FAILED);
318  if (in_array($status, [
322  $pgs->getStatus()
323  ])) {
324  $this->assertTrue($pgs->isTransitionAllowedTo($status));
325  } else {
326  $this->assertFalse($pgs->isTransitionAllowedTo($status));
327  }
328  }
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)

Definition at line 260 of file ilStudyProgrammeProgressTest.php.

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

260  : void
261  {
262  $pgs = (new ilPRGProgress(123))->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
263  if (in_array($status, [
268  $pgs->getStatus()
269  ])) {
270  $this->assertTrue($pgs->isTransitionAllowedTo($status));
271  } else {
272  $this->assertFalse($pgs->isTransitionAllowedTo($status));
273  }
274  }
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)

Definition at line 331 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

331  : void
332  {
333  $pgs = (new ilPRGProgress(123))->withStatus(ilPRGProgress::STATUS_NOT_RELEVANT);
334  if ($status === ilPRGProgress::STATUS_IN_PROGRESS
335  || $status === $pgs->getStatus()
336  ) {
337  $this->assertTrue($pgs->isTransitionAllowedTo($status));
338  } else {
339  $this->assertFalse($pgs->isTransitionAllowedTo($status));
340  }
341  }
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 68 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_COMPLETED, and ilPRGProgress\STATUS_IN_PROGRESS.

68  : void
69  {
70  $today = new DateTimeImmutable();
71  $yesterday = $today->sub(new DateInterval('P1D'));
72  $tomorrow = $today->add(new DateInterval('P1D'));
73 
74  $pgs = (new ilPRGProgress(555))
76  ->withValidityOfQualification($today);
77 
78  $this->assertNull($pgs->hasValidQualification($today));
79 
80  $pgs = $pgs->withStatus(ilPRGProgress::STATUS_COMPLETED);
81  $this->assertTrue($pgs->hasValidQualification($yesterday));
82  $this->assertTrue($pgs->hasValidQualification($today));
83  $this->assertFalse($pgs->hasValidQualification($tomorrow));
84  }
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 27 of file ilStudyProgrammeProgressTest.php.

27  : void
28  {
29  $pgs = new ilPRGProgress(123);
30  $this->assertInstanceOf(Node::class, $pgs);
31  $this->assertEquals($pgs->getNodeId(), 123);
32  }
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 86 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_COMPLETED, and ilPRGProgress\STATUS_IN_PROGRESS.

86  : void
87  {
88  $today = new DateTimeImmutable();
89  $yesterday = $today->sub(new DateInterval('P1D'));
90 
91  $pgs = (new ilPRGProgress(666))
94  ->withValidityOfQualification($today);
95  $this->assertFalse($pgs->isInvalidated());
96 
97  $pgs = $pgs
98  ->withValidityOfQualification($yesterday)
99  ->invalidate();
100  $this->assertTrue($pgs->isInvalidated());
101  }
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 103 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_COMPLETED.

103  : void
104  {
105  $this->expectException(\ilException::class);
106  $today = new DateTimeImmutable();
107  $tomorrow = $today->add(new DateInterval('P1D'));
108  $pgs = (new ilPRGProgress(777))
109  ->withStatus(ilPRGProgress::STATUS_COMPLETED)
110  ->withValidityOfQualification($tomorrow)
111  ->invalidate();
112  }
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 253 of file ilStudyProgrammeProgressTest.php.

253  : void
254  {
255  $this->expectException(\ilException::class);
256  $pgs = (new ilPRGProgress(123))->withStatus(777);
257  }
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 343 of file ilStudyProgrammeProgressTest.php.

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

343  : void
344  {
345  /*
346  └── 1
347  ├── 11
348  │ ├── 111
349  │ └── 112
350  ├── 12
351  └── 13
352  */
353 
354  $pgs112 = (new ilPRGProgress(112, ilPRGProgress::STATUS_COMPLETED))
355  ->withAmountOfPoints(112);
356  $pgs111 = (new ilPRGProgress(111, ilPRGProgress::STATUS_COMPLETED))
357  ->withAmountOfPoints(111);
359  ->setSubnodes([$pgs111, $pgs112])
360  ->withAmountOfPoints(11);
362  ->withAmountOfPoints(12);
364  ->withAmountOfPoints(13);
366  ->setSubnodes([$pgs11, $pgs12, $pgs13])
367  ->withAmountOfPoints(1);
368 
369  $this->assertEquals(111 + 112, $pgs11->getPossiblePointsOfRelevantChildren());
370  $this->assertEquals(0, $pgs12->getPossiblePointsOfRelevantChildren());
371  $this->assertEquals(11 + 12 + 13 * 0, $pgs1->getPossiblePointsOfRelevantChildren());
372  $this->assertEquals(111 + 112, $pgs11->getAchievedPointsOfChildren());
373  $this->assertEquals(0, $pgs1->getAchievedPointsOfChildren());
374  }
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 34 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\STATUS_COMPLETED, and ilPRGProgress\STATUS_IN_PROGRESS.

34  : void
35  {
36  $pgs = (new ilPRGProgress(123))
38  $dat = DateTimeImmutable::createFromFormat('Ymd', '20221024');
39 
40  $this->assertEquals($pgs->withAmountOfPoints(12)->getAmountOfPoints(), 12);
41  $this->assertEquals($pgs->withCurrentAmountOfPoints(8)->getCurrentAmountOfPoints(), 8);
42 
43  $this->assertEquals($pgs->withStatus(ilPRGProgress::STATUS_COMPLETED)->getStatus(), ilPRGProgress::STATUS_COMPLETED);
44  $pgs = $pgs->withLastChange(6, $dat);
45  $this->assertEquals($pgs->getLastChangeBy(), 6);
46  $this->assertEquals($pgs->getLastChange(), $dat);
47  $this->assertEquals($pgs->withAssignmentDate($dat)->getAssignmentDate(), $dat);
48  $pgs = $pgs->withCompletion(6, $dat);
49  $this->assertEquals($pgs->getCompletionBy(), 6);
50  $this->assertEquals($pgs->getCompletionDate(), $dat);
51  $this->assertEquals($pgs->withDeadline($dat)->getDeadline(), $dat);
52  $this->assertEquals($pgs->withValidityOfQualification($dat)->getValidityOfQualification(), $dat);
53  $this->assertTrue($pgs->withIndividualModifications(true)->hasIndividualModifications());
54  }
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 114 of file ilStudyProgrammeProgressTest.php.

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

114  : void
115  {
116  $usr = 6;
117  $now = new DateTimeImmutable();
118  $pgs = (new ilPRGProgress(123))
119  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
120 
121  $pgs = $pgs->markAccredited($now, $usr);
122  $this->assertEquals($now, $pgs->getCompletionDate());
123  $this->assertEquals($usr, $pgs->getCompletionBy());
124  $this->assertEquals($usr, $pgs->getLastChangeBy());
125  $this->assertEquals(
126  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
127  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
128  );
129  $this->assertEquals(ilPRGProgress::STATUS_ACCREDITED, $pgs->getStatus());
130  }
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 151 of file ilStudyProgrammeProgressTest.php.

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

151  : void
152  {
153  $usr = 6;
154  $now = new DateTimeImmutable();
155  $pgs = (new ilPRGProgress(123))
156  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
157 
158  $pgs = $pgs->markFailed($now, $usr);
159  $this->assertNull($pgs->getCompletionDate());
160  $this->assertNull($pgs->getCompletionBy());
161  $this->assertEquals($usr, $pgs->getLastChangeBy());
162  $this->assertEquals(
163  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
164  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
165  );
166  $this->assertEquals(ilPRGProgress::STATUS_FAILED, $pgs->getStatus());
167  }
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 169 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\DATE_TIME_FORMAT, and ilPRGProgress\STATUS_IN_PROGRESS.

169  : void
170  {
171  $usr = 6;
172  $now = new DateTimeImmutable();
173  $pgs = (new ilPRGProgress(123))
174  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
175 
176  $pgs = $pgs->markNotFailed($now, $usr);
177  $this->assertNull($pgs->getCompletionDate());
178  $this->assertNull($pgs->getCompletionBy());
179  $this->assertEquals($usr, $pgs->getLastChangeBy());
180  $this->assertEquals(
181  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
182  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
183  );
184  $this->assertEquals(ilPRGProgress::STATUS_IN_PROGRESS, $pgs->getStatus());
185  }
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 223 of file ilStudyProgrammeProgressTest.php.

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

223  : void
224  {
225  $usr = 6;
226  $now = new DateTimeImmutable();
227  $pgs = (new ilPRGProgress(123))
228  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
229 
230  $pgs = $pgs->markNotRelevant($now, $usr);
231  $this->assertNull($pgs->getCompletionBy());
232  $this->assertEquals($usr, $pgs->getLastChangeBy());
233  $this->assertEquals(
234  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
235  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
236  );
237  $this->assertEquals(ilPRGProgress::STATUS_NOT_RELEVANT, $pgs->getStatus());
238  $this->assertTrue($pgs->hasIndividualModifications());
239  }
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 205 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\DATE_TIME_FORMAT, and ilPRGProgress\STATUS_IN_PROGRESS.

205  : void
206  {
207  $usr = 6;
208  $now = new DateTimeImmutable();
209  $pgs = (new ilPRGProgress(123))
210  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
211 
212  $pgs = $pgs->markRelevant($now, $usr);
213  $this->assertNull($pgs->getCompletionBy());
214  $this->assertEquals($usr, $pgs->getLastChangeBy());
215  $this->assertEquals(
216  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
217  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
218  );
219  $this->assertEquals(ilPRGProgress::STATUS_IN_PROGRESS, $pgs->getStatus());
220  $this->assertTrue($pgs->hasIndividualModifications());
221  }
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 187 of file ilStudyProgrammeProgressTest.php.

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

187  : void
188  {
189  $usr = 6;
190  $now = new DateTimeImmutable();
191  $pgs = (new ilPRGProgress(123))
192  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
193 
194  $pgs = $pgs->succeed($now, $usr);
195  $this->assertEquals($now, $pgs->getCompletionDate());
196  $this->assertEquals($usr, $pgs->getCompletionBy());
197  $this->assertEquals($usr, $pgs->getLastChangeBy());
198  $this->assertEquals(
199  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
200  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
201  );
202  $this->assertEquals(ilPRGProgress::STATUS_COMPLETED, $pgs->getStatus());
203  }
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 132 of file ilStudyProgrammeProgressTest.php.

References ilPRGProgress\DATE_TIME_FORMAT, and ilPRGProgress\STATUS_IN_PROGRESS.

132  : void
133  {
134  $usr = 6;
135  $now = new DateTimeImmutable();
136  $pgs = (new ilPRGProgress(123))
137  ->withStatus(ilPRGProgress::STATUS_IN_PROGRESS);
138 
139  $pgs = $pgs->unmarkAccredited($now, $usr);
140  $this->assertNull($pgs->getCompletionDate());
141  $this->assertNull($pgs->getCompletionBy());
142  $this->assertNull($pgs->getValidityOfQualification());
143  $this->assertEquals($usr, $pgs->getLastChangeBy());
144  $this->assertEquals(
145  $now->format(ilPRGProgress::DATE_TIME_FORMAT),
146  $pgs->getLastChange()->format(ilPRGProgress::DATE_TIME_FORMAT)
147  );
148  $this->assertEquals(ilPRGProgress::STATUS_IN_PROGRESS, $pgs->getStatus());
149  }
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 56 of file ilStudyProgrammeProgressTest.php.

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

56  : void
57  {
58  $pgs = (new ilPRGProgress(444))
60  $this->assertTrue($pgs->isRelevant());
61  $this->assertTrue($pgs->withStatus(ilPRGProgress::STATUS_ACCREDITED)->isSuccessful());
62  $this->assertFalse($pgs->withStatus(ilPRGProgress::STATUS_FAILED)->isSuccessful());
63  $this->assertFalse($pgs->withStatus(ilPRGProgress::STATUS_NOT_RELEVANT)->isRelevant());
64  $this->assertFalse($pgs->isAccredited());
65  $this->assertTrue($pgs->withStatus(ilPRGProgress::STATUS_ACCREDITED)->isAccredited());
66  }
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 25 of file ilStudyProgrammeProgressTest.php.


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