ILIAS  release_7 Revision v7.30-3-g800a261c036
ilIndividualAssessmentUserGradingTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5use PHPUnit\Framework\TestCase;
6use \ILIAS\UI\Component\Input\Field\Section;
7
12{
13 public function test_create_instance()
14 {
15 $name = 'Hans Günther';
16 $record = 'The guy was really good';
17 $internal_note = 'This is a node just for me.';
18 $file = null;
19 $is_file_visible = false;
21 $place = 'Area 51';
22 $event_time = new DateTimeImmutable();
23 $notify = true;
24 $finalized = false;
26 $name,
27 $record,
28 $internal_note,
29 $file,
30 $is_file_visible,
31 $learning_progress,
32 $place,
33 $event_time,
34 $notify,
35 $finalized
36 );
37
38 $this->assertInstanceOf(ilIndividualAssessmentUserGrading::class, $grading);
39 $this->assertEquals($name, $grading->getName());
40 $this->assertEquals($record, $grading->getRecord());
41 $this->assertEquals($internal_note, $grading->getInternalNote());
42 $this->assertNull($grading->getFile());
43 $this->assertFalse($grading->isFileVisible());
44 $this->assertEquals($learning_progress, $grading->getLearningProgress());
45 $this->assertEquals($place, $grading->getPlace());
46 $this->assertEquals($event_time, $grading->getEventTime());
47 $this->assertTrue($grading->isNotify());
48 $this->assertFalse($grading->isFinalized());
49 }
50
52 {
53 $name = 'Hans Günther';
54 $record = 'The guy was really good';
55 $internal_note = 'This is a node just for me.';
56 $file = 'report.pdf';
57 $is_file_visible = true;
59 $place = 'Area 51 Underground';
60 $event_time = new DateTimeImmutable();
61 $notify = false;
62 $finalized = false;
64 $name,
65 $record,
66 $internal_note,
67 $file,
68 $is_file_visible,
69 $learning_progress,
70 $place,
71 $event_time,
72 $notify,
73 $finalized
74 );
75
76 $this->assertInstanceOf(ilIndividualAssessmentUserGrading::class, $grading);
77 $this->assertEquals($name, $grading->getName());
78 $this->assertEquals($record, $grading->getRecord());
79 $this->assertEquals($internal_note, $grading->getInternalNote());
80 $this->assertEquals($file, $grading->getFile());
81 $this->assertTrue($grading->isFileVisible());
82 $this->assertEquals($learning_progress, $grading->getLearningProgress());
83 $this->assertEquals($place, $grading->getPlace());
84 $this->assertEquals($event_time, $grading->getEventTime());
85 $this->assertFalse($grading->isNotify());
86 $this->assertFalse($grading->isFinalized());
87
88 $n_grading = $grading->withFinalized(true);
89 $this->assertEquals($name, $n_grading->getName());
90 $this->assertEquals($record, $n_grading->getRecord());
91 $this->assertEquals($internal_note, $n_grading->getInternalNote());
92 $this->assertEquals($file, $n_grading->getFile());
93 $this->assertTrue($n_grading->isFileVisible());
94 $this->assertEquals($learning_progress, $n_grading->getLearningProgress());
95 $this->assertEquals($place, $n_grading->getPlace());
96 $this->assertEquals($event_time, $n_grading->getEventTime());
97 $this->assertFalse($n_grading->isNotify());
98 $this->assertTrue($n_grading->isFinalized());
99
100 $this->assertNotSame($n_grading, $grading);
101 }
102
103 public function testToFormInput() : void
104 {
105 $lng = $this->createMock(ilLanguage::class);
106 $lng->expects($this->atLeastOnce())
107 ->method('txt')
108 ->willReturn("label")
109 ;
110 $file_handler = $this->createMock(ilIndividualAssessmentMemberGUI::class);
111 $df = new ILIAS\Data\Factory();
112 $refinery = new ILIAS\Refinery\Factory($df, $lng);
114 new ILIAS\UI\Implementation\Component\SignalGenerator(),
115 $df,
116 $refinery,
117 $lng
118 );
119
120 $name = 'Hans Günther';
121 $record = 'The guy was really good';
122 $internal_note = 'This is a node just for me.';
123 $file = 'report.pdf';
124 $is_file_visible = true;
126 $place = 'Area 51 Underground';
127 $event_time = new DateTimeImmutable();
128 $notify = false;
129 $finalized = false;
131 $name,
132 $record,
133 $internal_note,
134 $file,
135 $is_file_visible,
136 $learning_progress,
137 $place,
138 $event_time,
139 $notify,
140 $finalized
141 );
142
143 $input = $grading->toFormInput(
144 $f,
145 $df,
146 $lng,
147 $refinery,
148 [
152 ],
153 true,
154 false,
155 false,
156 $file_handler
157 );
158
159 $this->assertInstanceOf(Section::class, $input);
160 }
161}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20
if($format !==null) $name
Definition: metadata.php:230
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
$lng