ILIAS  release_8 Revision v8.24
ilObjStudyProgrammeCertificateTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22{
23 public function __construct()
24 {
25 }
26
27 public function getRelevantProgress(array $assignments)
28 {
29 return $this->getRelevantProgressFromAssignments($assignments);
30 }
31}
32
33class ilObjStudyProgrammeCertificateTest extends \PHPUnit\Framework\TestCase
34{
35 protected $backupGlobals = false;
37
38 public function setUp(): void
39 {
41 ->withCompletion(7, new DateTimeImmutable('2023-12-01'))
42 ->withValidityOfQualification(new DateTimeImmutable('2023-12-31'));
43 $ass0 = (new ilPRGAssignment(1, 6))
44 ->withProgressTree($pgs);
45
47 $ass1 = (new ilPRGAssignment(1, 6))
48 ->withProgressTree($pgs);
49
51 ->withCompletion(7, new DateTimeImmutable('2023-12-02'))
52 ->withValidityOfQualification(new DateTimeImmutable('2023-12-30'));
53 $ass2 = (new ilPRGAssignment(1, 6))
54 ->withProgressTree($pgs);
55
57 ->withCompletion(7, new DateTimeImmutable('2023-11-01'));
58 $ass3 = (new ilPRGAssignment(1, 6))
59 ->withProgressTree($pgs);
60
61 $this->assignments = [
62 $ass0, $ass1, $ass2, $ass3
63 ];
64 $this->placeholder_mock = new PRGPlaceholderMock();
65 }
66
68 {
69 $assignments = [];
70 $pgs = $this->placeholder_mock->getRelevantProgress($assignments);
71 $this->assertNull($pgs);
72 }
73
75 {
76 $assignments = [$this->assignments[1]];
77 $pgs = $this->placeholder_mock->getRelevantProgress($assignments);
78 $this->assertEquals($this->assignments[1]->getProgressTree(), $pgs);
79 }
80
82 {
83 $assignments = [
84 $this->assignments[0],
85 $this->assignments[2],
86 $this->assignments[3]
87 ];
88 $pgs = $this->placeholder_mock->getRelevantProgress($assignments);
89 $this->assertEquals($this->assignments[3]->getProgressTree(), $pgs);
90 }
91
93 {
94 $assignments = $this->assignments;
95 $pgs = $this->placeholder_mock->getRelevantProgress($assignments);
96 $this->assertEquals($this->assignments[3]->getProgressTree(), $pgs);
97 }
98
100 {
101 $assignments = [
102 $this->assignments[0],
103 $this->assignments[2]
104 ];
105 $pgs = $this->placeholder_mock->getRelevantProgress($assignments);
106 $this->assertEquals($this->assignments[0]->getProgressTree(), $pgs);
107 }
108}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...