ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjStudyProgrammeCertificateTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
25  public function __construct()
26  {
27  }
28 
29  public function getRelevantProgress(array $assignments)
30  {
31  return $this->getRelevantProgressFromAssignments($assignments);
32  }
33 }
34 
35 class ilObjStudyProgrammeCertificateTest extends \PHPUnit\Framework\TestCase
36 {
37  protected $backupGlobals = false;
39  protected array $assignments;
40 
41  public function setUp(): void
42  {
44  ->withCompletion(7, new DateTimeImmutable('2023-12-01'))
45  ->withValidityOfQualification(new DateTimeImmutable('2023-12-31'));
46  $ass0 = (new ilPRGAssignment(1, 6))
47  ->withProgressTree($pgs);
48 
50  $ass1 = (new ilPRGAssignment(1, 6))
51  ->withProgressTree($pgs);
52 
54  ->withCompletion(7, new DateTimeImmutable('2023-12-02'))
55  ->withValidityOfQualification(new DateTimeImmutable('2023-12-30'));
56  $ass2 = (new ilPRGAssignment(1, 6))
57  ->withProgressTree($pgs);
58 
60  ->withCompletion(7, new DateTimeImmutable('2023-11-01'));
61  $ass3 = (new ilPRGAssignment(1, 6))
62  ->withProgressTree($pgs);
63 
64  $this->assignments = [
65  $ass0, $ass1, $ass2, $ass3
66  ];
67  $this->placeholder_mock = new PRGPlaceholderMock();
68  }
69 
71  {
72  $assignments = [];
73  $pgs = $this->placeholder_mock->getRelevantProgress($assignments);
74  $this->assertNull($pgs);
75  }
76 
78  {
79  $assignments = [$this->assignments[1]];
80  $pgs = $this->placeholder_mock->getRelevantProgress($assignments);
81  $this->assertEquals($this->assignments[1]->getProgressTree(), $pgs);
82  }
83 
85  {
86  $assignments = [
87  $this->assignments[0],
88  $this->assignments[2],
89  $this->assignments[3]
90  ];
91  $pgs = $this->placeholder_mock->getRelevantProgress($assignments);
92  $this->assertEquals($this->assignments[3]->getProgressTree(), $pgs);
93  }
94 
96  {
97  $assignments = $this->assignments;
98  $pgs = $this->placeholder_mock->getRelevantProgress($assignments);
99  $this->assertEquals($this->assignments[3]->getProgressTree(), $pgs);
100  }
101 
103  {
104  $assignments = [
105  $this->assignments[0],
106  $this->assignments[2]
107  ];
108  $pgs = $this->placeholder_mock->getRelevantProgress($assignments);
109  $this->assertEquals($this->assignments[0]->getProgressTree(), $pgs);
110  }
111 }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...