ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilIndividualAssessmentUserGradingTest.php
Go to the documentation of this file.
1 <?php
2 
20 declare(strict_types=1);
21 
25 
30 {
31  public function test_create_instance()
32  {
33  $name = 'Hans Günther';
34  $record = 'The guy was really good';
35  $internal_note = 'This is a node just for me.';
36  $file = null;
37  $is_file_visible = false;
39  $place = 'Area 51';
40  $event_time = new DateTimeImmutable();
41  $notify = true;
42  $finalized = false;
43  $grading = new ilIndividualAssessmentUserGrading(
44  $name,
45  $record,
46  $internal_note,
47  $file,
48  $is_file_visible,
50  $place,
51  $event_time,
52  $notify,
53  $finalized
54  );
55 
56  $this->assertInstanceOf(ilIndividualAssessmentUserGrading::class, $grading);
57  $this->assertEquals($name, $grading->getName());
58  $this->assertEquals($record, $grading->getRecord());
59  $this->assertEquals($internal_note, $grading->getInternalNote());
60  $this->assertNull($grading->getFile());
61  $this->assertFalse($grading->isFileVisible());
62  $this->assertEquals($learning_progress, $grading->getLearningProgress());
63  $this->assertEquals($place, $grading->getPlace());
64  $this->assertEquals($event_time, $grading->getEventTime());
65  $this->assertTrue($grading->isNotify());
66  $this->assertFalse($grading->isFinalized());
67  }
68 
69  public function test_with_finalized_changed()
70  {
71  $name = 'Hans Günther';
72  $record = 'The guy was really good';
73  $internal_note = 'This is a node just for me.';
74  $file = 'report.pdf';
75  $is_file_visible = true;
77  $place = 'Area 51 Underground';
78  $event_time = new DateTimeImmutable();
79  $notify = false;
80  $finalized = false;
81  $grading = new ilIndividualAssessmentUserGrading(
82  $name,
83  $record,
84  $internal_note,
85  $file,
86  $is_file_visible,
88  $place,
89  $event_time,
90  $notify,
91  $finalized
92  );
93 
94  $this->assertInstanceOf(ilIndividualAssessmentUserGrading::class, $grading);
95  $this->assertEquals($name, $grading->getName());
96  $this->assertEquals($record, $grading->getRecord());
97  $this->assertEquals($internal_note, $grading->getInternalNote());
98  $this->assertEquals($file, $grading->getFile());
99  $this->assertTrue($grading->isFileVisible());
100  $this->assertEquals($learning_progress, $grading->getLearningProgress());
101  $this->assertEquals($place, $grading->getPlace());
102  $this->assertEquals($event_time, $grading->getEventTime());
103  $this->assertFalse($grading->isNotify());
104  $this->assertFalse($grading->isFinalized());
105 
106  $n_grading = $grading->withFinalized(true);
107  $this->assertEquals($name, $n_grading->getName());
108  $this->assertEquals($record, $n_grading->getRecord());
109  $this->assertEquals($internal_note, $n_grading->getInternalNote());
110  $this->assertEquals($file, $n_grading->getFile());
111  $this->assertTrue($n_grading->isFileVisible());
112  $this->assertEquals($learning_progress, $n_grading->getLearningProgress());
113  $this->assertEquals($place, $n_grading->getPlace());
114  $this->assertEquals($event_time, $n_grading->getEventTime());
115  $this->assertFalse($n_grading->isNotify());
116  $this->assertTrue($n_grading->isFinalized());
117 
118  $this->assertNotSame($n_grading, $grading);
119  }
120 
121  public function testToFormInput(): void
122  {
123  $lng = $this->createMock(ilLanguage::class);
124  $lng->expects($this->atLeastOnce())
125  ->method('txt')
126  ->willReturn("label")
127  ;
128  $file_handler = $this->createMock(AbstractCtrlAwareUploadHandler::class);
129  $df = new ILIAS\Data\Factory();
132  $this->createMock(\ILIAS\UI\Implementation\Component\Input\UploadLimitResolver::class),
133  new ILIAS\UI\Implementation\Component\SignalGenerator(),
134  $df,
135  $refinery,
136  $lng
137  );
138 
139  $name = 'Hans Günther';
140  $record = 'The guy was really good';
141  $internal_note = 'This is a node just for me.';
142  $file = 'report.pdf';
143  $is_file_visible = true;
145  $place = 'Area 51 Underground';
146  $event_time = new DateTimeImmutable();
147  $notify = false;
148  $finalized = false;
149  $record_template = "Record Template";
150  $grading = new ilIndividualAssessmentUserGrading(
151  $name,
152  $record,
153  $internal_note,
154  $file,
155  $is_file_visible,
157  $place,
158  $event_time,
159  $notify,
160  $finalized
161  );
162 
163  $input = $grading->toFormInput(
164  $f,
165  $df,
166  $lng,
167  $refinery,
168  $file_handler,
169  $df->dateFormat()->standard(),
170  $record_template,
171  [
175  ]
176  );
177 
178  $this->assertInstanceOf(Section::class, $input);
179  }
180 }
Interface Observer Contains several chained tasks and infos about them.
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...
bool $notify
$learning_progress
Definition: plugin.php:30
global $lng
Definition: privfeed.php:32