ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilStudyProgrammeAssignmentTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21require_once(__DIR__ . "/../../../../../../vendor/composer/vendor/autoload.php");
22
23class ilStudyProgrammeAssignmentTest extends \PHPUnit\Framework\TestCase
24{
25 protected $backupGlobals = false;
26
27 public function testPRGAssignmentInitAndId(): void
28 {
29 $ass = new ilPRGAssignment(123, 6);
30 $this->assertEquals($ass->getId(), 123);
31 $this->assertEquals($ass->getUserId(), 6);
32 }
33
34 public function testPRGAssignmentProperties(): void
35 {
36 $ass = new ilPRGAssignment(123, 456);
37 $now = new DateTimeImmutable();
38
39 $ass = $ass->withLastChange(6, $now);
40 $this->assertEquals($ass->getLastChangeBy(), 6);
41 $this->assertEquals($ass->getLastChange()->format(ilPRGAssignment::DATE_TIME_FORMAT), $now->format(ilPRGAssignment::DATE_TIME_FORMAT));
42
43 $this->assertFalse($ass->withManuallyAssigned(false)->isManuallyAssigned());
44 $this->assertTrue($ass->withManuallyAssigned(true)->isManuallyAssigned());
45
46 $dl = DateTimeImmutable::createFromFormat('Ymd', '20201001');
47 $ass = $ass->withRestarted(321, $dl);
48 $this->assertEquals($ass->getRestartDate()->format('Ymd'), '20201001');
49 $this->assertEquals($ass->getRestartedAssignmentId(), 321);
50 }
51}
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...