ILIAS  release_8 Revision v8.24
ilStudyProgrammeAssignmentActionsTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilStudyProgrammeAssignmentActionsTest:
+ Collaboration diagram for ilStudyProgrammeAssignmentActionsTest:

Public Member Functions

 setUp ()
 
 testPRGAssignmentActionsInitDates ()
 
 testPRGAssignmentActionsMarkRelevant ()
 
 testPRGAssignmentActionsMarkAccredited ()
 
 testPRGAssignmentActionsSucceedAndDeadline ()
 
 testPRGAssignmentActionsChangePoints ()
 

Protected Member Functions

 getProgressesWithDefaultStatus (int $status)
 

Protected Attributes

ilStudyProgrammeSettingsRepository $settings_repo
 
ilPRGMessageCollection $messages
 
ilPRGAssignment $ass
 
ilStudyProgrammeEvents $events
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 25 of file ilStudyProgrammeAssignmentActionsTest.php.

Member Function Documentation

◆ getProgressesWithDefaultStatus()

ilStudyProgrammeAssignmentActionsTest::getProgressesWithDefaultStatus ( int  $status)
protected

Definition at line 68 of file ilStudyProgrammeAssignmentActionsTest.php.

69 {
70 /*
71 └── 1
72 ├── 11
73 │ ├── 111
74 │ └── 112
75 ├── 12
76 └── 13
77 */
78 $pgs112 = (new ilPRGProgress(112, $status))->withAmountOfPoints(4);
79 $pgs111 = (new ilPRGProgress(111, $status))->withAmountOfPoints(5);
80 $pgs11 = (new ilPRGProgress(11, $status))->setSubnodes([$pgs111, $pgs112])->withAmountOfPoints(8);
81 $pgs12 = new ilPRGProgress(12, $status);
82 $pgs13 = new ilPRGProgress(13, $status);
83 $pgs1 = (new ilPRGProgress(1, $status))->setSubnodes([$pgs11, $pgs12, $pgs13]);
84 return $pgs1;
85 }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...
withAmountOfPoints(int $points)

References ilPRGProgress\withAmountOfPoints().

Referenced by setUp(), testPRGAssignmentActionsMarkAccredited(), and testPRGAssignmentActionsSucceedAndDeadline().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

ilStudyProgrammeAssignmentActionsTest::setUp ( )

Definition at line 32 of file ilStudyProgrammeAssignmentActionsTest.php.

32 : void
33 {
34 $this->settings_repo = new SettingsRepoMock();
35 foreach ([1, 11, 12, 13, 111, 112] as $pgs_id) {
36 $settings = new SettingsMock($pgs_id);
38 $this->settings_repo->update($settings);
39 }
40
41 $this->messages = new ilPRGMessageCollection();
42 $this->events = new ProgrammeEventsMock();
43
44 $udf = $this->getMockBuilder(ilUserDefinedData::class)
45 ->disableOriginalConstructor()
46 ->getMock();
47 $user_info = new ilPRGUserInformation(
48 $udf,
49 'some OrgU',
50 'firstname',
51 'lasttname',
52 'login',
53 true,
54 'f.lastname@example.com',
55 'f',
56 'Prof. Dr.',
57 );
58
59 $this->ass = (new ilPRGAssignment(42, 7))
60 ->withUserInformation($user_info)
61 ->withProgressTree(
64 )
65 );
66 }
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References ILIAS\LTI\ToolProvider\$settings, getProgressesWithDefaultStatus(), ilStudyProgrammeSettings\MODE_POINTS, and ilPRGProgress\STATUS_NOT_RELEVANT.

+ Here is the call graph for this function:

◆ testPRGAssignmentActionsChangePoints()

ilStudyProgrammeAssignmentActionsTest::testPRGAssignmentActionsChangePoints ( )

Definition at line 233 of file ilStudyProgrammeAssignmentActionsTest.php.

233 : void
234 {
235 $ass = $this->ass->changeAmountOfPoints(
236 $this->settings_repo,
237 111,
238 7,
239 $this->messages,
240 1987
241 );
242
243 $this->assertEquals(5, $ass->getProgressForNode(111)->getAmountOfPoints());
244 $ass = $this->ass
245 ->markRelevant($this->settings_repo, 111, 7, $this->messages)
246 ->changeAmountOfPoints(
247 $this->settings_repo,
248 111,
249 7,
250 $this->messages,
251 1987
252 );
253 $this->assertEquals(1987, $ass->getProgressForNode(111)->getAmountOfPoints());
254 }
getProgressForNode(int $node_id)

References $ass, and ilPRGAssignment\getProgressForNode().

+ Here is the call graph for this function:

◆ testPRGAssignmentActionsInitDates()

ilStudyProgrammeAssignmentActionsTest::testPRGAssignmentActionsInitDates ( )

Definition at line 88 of file ilStudyProgrammeAssignmentActionsTest.php.

88 : void
89 {
90 $today = (new \DateTimeImmutable())->format('Ymd');
91 $ass = $this->ass->initAssignmentDates();
92 foreach ([1, 11, 12, 13, 111, 112] as $pgs_id) {
93 $this->assertEquals(
94 $today,
95 $ass->getProgressForNode($pgs_id)->getAssignmentDate()->format('Ymd')
96 );
97 }
98 }

References $ass, and ilPRGAssignment\getProgressForNode().

+ Here is the call graph for this function:

◆ testPRGAssignmentActionsMarkAccredited()

ilStudyProgrammeAssignmentActionsTest::testPRGAssignmentActionsMarkAccredited ( )

Definition at line 133 of file ilStudyProgrammeAssignmentActionsTest.php.

133 : void
134 {
135 $ass = $this->ass->withProgressTree(
137 );
138
139 $ass = $ass
140 ->markAccredited($this->settings_repo, $this->events, 111, 7, $this->messages)
141 ->markAccredited($this->settings_repo, $this->events, 112, 7, $this->messages)
142 ->markAccredited($this->settings_repo, $this->events, 13, 7, $this->messages);
143 $this->assertEquals(
145 $ass->getProgressForNode(111)->getStatus()
146 );
147 $this->assertEquals(
149 $ass->getProgressForNode(112)->getStatus()
150 );
151 $this->assertEquals(
153 $ass->getProgressForNode(11)->getStatus()
154 );
155 $this->assertEquals(5 + 4, $ass->getProgressForNode(11)->getCurrentAmountOfPoints());
156 $this->assertEquals(
158 $ass->getProgressForNode(13)->getStatus()
159 );
160
161 $ass = $ass
162 ->unmarkAccredited($this->settings_repo, 112, 7, $this->messages)
163 ->unmarkAccredited($this->settings_repo, 111, 7, $this->messages)
164 ->unmarkAccredited($this->settings_repo, 13, 7, $this->messages);
165
166 $this->assertEquals(
168 $ass->getProgressForNode(112)->getStatus()
169 );
170 $this->assertEquals(0, $ass->getProgressForNode(11)->getCurrentAmountOfPoints());
171 $this->assertEquals(
172 ilPRGProgress::STATUS_COMPLETED, //completion may not be revoked manually
173 $ass->getProgressForNode(13)->getStatus()
174 );
175 $this->assertEquals(
176 ilPRGProgress::STATUS_IN_PROGRESS, //completion may be revoked automatically
177 $ass->getProgressForNode(11)->getStatus()
178 );
179 }
withProgressTree(ilPRGProgress $progress)

References $ass, getProgressesWithDefaultStatus(), ilPRGAssignment\getProgressForNode(), ilPRGProgress\STATUS_ACCREDITED, ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGAssignment\withProgressTree().

+ Here is the call graph for this function:

◆ testPRGAssignmentActionsMarkRelevant()

ilStudyProgrammeAssignmentActionsTest::testPRGAssignmentActionsMarkRelevant ( )

Definition at line 100 of file ilStudyProgrammeAssignmentActionsTest.php.

100 : void
101 {
102 $ass = $this->ass->markRelevant($this->settings_repo, 111, 7, $this->messages);
103
104 $this->assertEquals(
106 $ass->getProgressForNode(111)->getStatus()
107 );
108 $this->assertEquals(
110 $ass->getProgressForNode(11)->getStatus()
111 );
112 $this->assertEquals(
114 $ass->getProgressForNode(12)->getStatus()
115 );
116
118 $ass = $this->ass
119 ->markNotRelevant($this->settings_repo, 12, 7, $messages)
120 ->markNotRelevant($this->settings_repo, 111, 7, $messages);
121
122 $this->assertTrue($messages->hasErrors());
123 $this->assertEquals(
125 $ass->getProgressForNode(12)->getStatus()
126 );
127 $this->assertEquals(
129 $ass->getProgressForNode(111)->getStatus()
130 );
131 }

References $ass, $messages, ilPRGAssignment\getProgressForNode(), ilPRGMessageCollection\hasErrors(), ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

+ Here is the call graph for this function:

◆ testPRGAssignmentActionsSucceedAndDeadline()

ilStudyProgrammeAssignmentActionsTest::testPRGAssignmentActionsSucceedAndDeadline ( )

Definition at line 181 of file ilStudyProgrammeAssignmentActionsTest.php.

181 : void
182 {
183 $today = new DateTimeImmutable();
184 $yesterday = $today->sub(new DateInterval('P1D'));
185
187 $pgs12 = $pgss->getSubnode('13')->withDeadline($today);
188 $pgs13 = $pgss->getSubnode('13')->withDeadline($yesterday);
189 $pgss = $pgss
190 ->withSubnode($pgs12)
191 ->withSubnode($pgs13);
192
193 $ass = $this->ass
194 ->withProgressTree($pgss)
195 ->succeed($this->settings_repo, 12, 777)
196 ->succeed($this->settings_repo, 13, 777);
197
198 $this->assertEquals(
200 $ass->getProgressForNode(12)->getStatus()
201 );
202 $this->assertEquals(
204 $ass->getProgressForNode(13)->getStatus()
205 );
206
207 $ass = $ass
208 ->changeProgressDeadline(
209 $this->settings_repo,
210 11,
211 7,
212 $this->messages,
213 $yesterday
214 )
215 ->changeProgressDeadline(
216 $this->settings_repo,
217 13,
218 7,
219 $this->messages,
220 $today
221 );
222
223 $this->assertEquals(
225 $ass->getProgressForNode(11)->getStatus()
226 );
227 $this->assertEquals(
229 $ass->getProgressForNode(13)->getStatus()
230 );
231 }

References $ass, getProgressesWithDefaultStatus(), ilPRGAssignment\getProgressForNode(), ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_FAILED, ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGAssignment\withProgressTree().

+ Here is the call graph for this function:

Field Documentation

◆ $ass

◆ $events

ilStudyProgrammeEvents ilStudyProgrammeAssignmentActionsTest::$events
protected

Definition at line 30 of file ilStudyProgrammeAssignmentActionsTest.php.

◆ $messages

ilPRGMessageCollection ilStudyProgrammeAssignmentActionsTest::$messages
protected

◆ $settings_repo

ilStudyProgrammeSettingsRepository ilStudyProgrammeAssignmentActionsTest::$settings_repo
protected

Definition at line 27 of file ilStudyProgrammeAssignmentActionsTest.php.


The documentation for this class was generated from the following file: