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);
259 #[\PHPUnit\Framework\Attributes\DataProvider('ilPRGProgressStatus')] 263 if (in_array($status, [
270 $this->assertTrue($pgs->isTransitionAllowedTo($status));
272 $this->assertFalse($pgs->isTransitionAllowedTo($status));
276 #[\PHPUnit\Framework\Attributes\DataProvider('ilPRGProgressStatus')] 282 if (in_array($status, [
289 $this->assertTrue($pgs->isTransitionAllowedTo($status));
291 $this->assertFalse($pgs->isTransitionAllowedTo($status));
295 #[\PHPUnit\Framework\Attributes\DataProvider('ilPRGProgressStatus')] 301 if (in_array($status, [
306 $this->assertTrue($pgs->isTransitionAllowedTo($status));
308 $this->assertFalse($pgs->isTransitionAllowedTo($status));
312 #[\PHPUnit\Framework\Attributes\DataProvider('ilPRGProgressStatus')] 318 if (in_array($status, [
324 $this->assertTrue($pgs->isTransitionAllowedTo($status));
326 $this->assertFalse($pgs->isTransitionAllowedTo($status));
330 #[\PHPUnit\Framework\Attributes\DataProvider('ilPRGProgressStatus')] 335 || $status === $pgs->getStatus()
337 $this->assertTrue($pgs->isTransitionAllowedTo($status));
339 $this->assertFalse($pgs->isTransitionAllowedTo($status));
355 ->withAmountOfPoints(112);
357 ->withAmountOfPoints(111);
359 ->setSubnodes([$pgs111, $pgs112])
360 ->withAmountOfPoints(11);
362 ->withAmountOfPoints(12);
364 ->withAmountOfPoints(13);
366 ->setSubnodes([$pgs11, $pgs12, $pgs13])
367 ->withAmountOfPoints(1);
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());
testPRGProgressPointsOfChildren()
testPRGProgressProperties()
testPRGProgressStatusActionsMarkNotRelevant()
testPRGProgressAllowedTransitionsForFailed($status)
testPRGProgressAllowedTransitionsForAccredited($status)
testPRGProgressAllowedTransitionsForCompleted($status)
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)
testPRGProgressInvalidStatus()
const STATUS_NOT_RELEVANT
testPRGProgressAllowedTransitionsForInProgress(int $status)
testPRGProgressStatusChecker()
testPRGProgressStatusActionsMarkFailed()
testPRGProgressInvalidInvalidation()
testPRGProgressStatusActionsSucceed()
testPRGProgressStatusActionsMarkAccredited()