19 declare(strict_types=1);
30 $this->assertInstanceOf(Node::class, $pgs);
31 $this->assertEquals($pgs->getNodeId(), 123);
38 $dat = DateTimeImmutable::createFromFormat(
'Ymd',
'20221024');
40 $this->assertEquals($pgs->withAmountOfPoints(12)->getAmountOfPoints(), 12);
41 $this->assertEquals($pgs->withCurrentAmountOfPoints(8)->getCurrentAmountOfPoints(), 8);
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());
60 $this->assertTrue($pgs->isRelevant());
64 $this->assertFalse($pgs->isAccredited());
76 ->withValidityOfQualification($today);
78 $this->assertNull($pgs->hasValidQualification($today));
81 $this->assertTrue($pgs->hasValidQualification($yesterday));
82 $this->assertTrue($pgs->hasValidQualification($today));
83 $this->assertFalse($pgs->hasValidQualification($tomorrow));
94 ->withValidityOfQualification($today);
95 $this->assertFalse($pgs->isInvalidated());
98 ->withValidityOfQualification($yesterday)
100 $this->assertTrue($pgs->isInvalidated());
105 $this->expectException(\ilException::class);
110 ->withValidityOfQualification($tomorrow)
121 $pgs = $pgs->markAccredited($now, $usr);
122 $this->assertEquals($now, $pgs->getCompletionDate());
123 $this->assertEquals($usr, $pgs->getCompletionBy());
124 $this->assertEquals($usr, $pgs->getLastChangeBy());
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());
158 $pgs = $pgs->markFailed($now, $usr);
159 $this->assertNull($pgs->getCompletionDate());
160 $this->assertNull($pgs->getCompletionBy());
161 $this->assertEquals($usr, $pgs->getLastChangeBy());
176 $pgs = $pgs->markNotFailed($now, $usr);
177 $this->assertNull($pgs->getCompletionDate());
178 $this->assertNull($pgs->getCompletionBy());
179 $this->assertEquals($usr, $pgs->getLastChangeBy());
194 $pgs = $pgs->succeed($now, $usr);
195 $this->assertEquals($now, $pgs->getCompletionDate());
196 $this->assertEquals($usr, $pgs->getCompletionBy());
197 $this->assertEquals($usr, $pgs->getLastChangeBy());
212 $pgs = $pgs->markRelevant($now, $usr);
213 $this->assertNull($pgs->getCompletionBy());
214 $this->assertEquals($usr, $pgs->getLastChangeBy());
220 $this->assertTrue($pgs->hasIndividualModifications());
230 $pgs = $pgs->markNotRelevant($now, $usr);
231 $this->assertNull($pgs->getCompletionBy());
232 $this->assertEquals($usr, $pgs->getLastChangeBy());
238 $this->assertTrue($pgs->hasIndividualModifications());
255 $this->expectException(\ilException::class);
265 if (in_array($status, [
272 $this->assertTrue($pgs->isTransitionAllowedTo($status));
274 $this->assertFalse($pgs->isTransitionAllowedTo($status));
286 if (in_array($status, [
293 $this->assertTrue($pgs->isTransitionAllowedTo($status));
295 $this->assertFalse($pgs->isTransitionAllowedTo($status));
307 if (in_array($status, [
312 $this->assertTrue($pgs->isTransitionAllowedTo($status));
314 $this->assertFalse($pgs->isTransitionAllowedTo($status));
326 if (in_array($status, [
332 $this->assertTrue($pgs->isTransitionAllowedTo($status));
334 $this->assertFalse($pgs->isTransitionAllowedTo($status));
345 || $status === $pgs->getStatus()
347 $this->assertTrue($pgs->isTransitionAllowedTo($status));
349 $this->assertFalse($pgs->isTransitionAllowedTo($status));
365 ->withAmountOfPoints(112);
367 ->withAmountOfPoints(111);
369 ->setSubnodes([$pgs111, $pgs112])
370 ->withAmountOfPoints(11);
372 ->withAmountOfPoints(12);
374 ->withAmountOfPoints(13);
376 ->setSubnodes([$pgs11, $pgs12, $pgs13])
377 ->withAmountOfPoints(1);
379 $this->assertEquals(111 + 112, $pgs11->getPossiblePointsOfRelevantChildren());
380 $this->assertEquals(0, $pgs12->getPossiblePointsOfRelevantChildren());
381 $this->assertEquals(11 + 12 + 13 * 0, $pgs1->getPossiblePointsOfRelevantChildren());
382 $this->assertEquals(111 + 112, $pgs11->getAchievedPointsOfChildren());
383 $this->assertEquals(0, $pgs1->getAchievedPointsOfChildren());
testPRGProgressPointsOfChildren()
testPRGProgressProperties()
testPRGProgressStatusActionsMarkNotRelevant()
testPRGProgressAllowedTransitionsForFailed($status)
ilPRGProgressStatus
testPRGProgressAllowedTransitionsForAccredited($status)
ilPRGProgressStatus
testPRGProgressAllowedTransitionsForCompleted($status)
ilPRGProgressStatus
testPRGProgressStatusActionsUnmarkAccredited()
testPRGProgressStatusActionsMarkRelevant()
static ilPRGProgressStatus()
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...
testPRGProgressInitAndId()
testPRGProgressInvalidation()
testPRGProgressStatusActionsMarkNotFailed()
testPRGProgressHasValidQualification()
testPRGProgressAllowedTransitionsForIrrelevant($status)
ilPRGProgressStatus
testPRGProgressInvalidStatus()
const STATUS_NOT_RELEVANT
testPRGProgressAllowedTransitionsForInProgress(int $status)
ilPRGProgressStatus
testPRGProgressStatusChecker()
testPRGProgressStatusActionsMarkFailed()
testPRGProgressInvalidInvalidation()
testPRGProgressStatusActionsSucceed()
testPRGProgressStatusActionsMarkAccredited()