ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
SvyEvaluationGUIRequestTest.php
Go to the documentation of this file.
1 <?php
2 
4 
10 class SvyEvaluationGUIRequestTest extends TestCase
11 {
12  //protected $backupGlobals = false;
13 
14  protected function tearDown(): void
15  {
16  }
17 
18  protected function getRequest(array $get, array $post): \ILIAS\Survey\Evaluation\EvaluationGUIRequest
19  {
20  $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
21  $lng_mock = $this->createMock(ilLanguage::class);
22  $data = new \ILIAS\Data\Factory();
23  $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
24  return new \ILIAS\Survey\Evaluation\EvaluationGUIRequest(
25  $http_mock,
26  $refinery,
27  $get,
28  $post
29  );
30  }
31 
32  public function testShowTable(): void
33  {
34  $request = $this->getRequest(
35  [
36  "vw" => "t"
37  ],
38  []
39  );
40 
41  $this->assertEquals(
42  true,
43  $request->getShowTable()
44  );
45  }
46 
47  public function testShowChart(): void
48  {
49  $request = $this->getRequest(
50  [
51  "vw" => "c"
52  ],
53  []
54  );
55 
56  $this->assertEquals(
57  true,
58  $request->getShowChart()
59  );
60  }
61 
62  public function testShowAbsolute(): void
63  {
64  $request = $this->getRequest(
65  [
66  "cp" => "a"
67  ],
68  []
69  );
70 
71  $this->assertEquals(
72  true,
73  $request->getShowAbsolute()
74  );
75  }
76 
77  public function testShowPercentage(): void
78  {
79  $request = $this->getRequest(
80  [
81  "cp" => "p"
82  ],
83  []
84  );
85 
86  $this->assertEquals(
87  true,
88  $request->getShowPercentage()
89  );
90  }
91 
92  public function testAppraiseeId(): void
93  {
94  $request = $this->getRequest(
95  [
96  "appr_id" => 14
97  ],
98  []
99  );
100 
101  $this->assertEquals(
102  14,
103  $request->getAppraiseeId()
104  );
105  }
106 
107  public function testRaterId(): void
108  {
109  $request = $this->getRequest(
110  [
111  "rater_id" => "r12"
112  ],
113  []
114  );
115 
116  $this->assertEquals(
117  "r12",
118  $request->getRaterId()
119  );
120  }
121 
122  public function testRefId(): void
123  {
124  $request = $this->getRequest(
125  [
126  "ref_id" => 101
127  ],
128  []
129  );
130 
131  $this->assertEquals(
132  101,
133  $request->getRefId()
134  );
135  }
136 
137  public function testCompEvalMode(): void
138  {
139  $request = $this->getRequest(
140  [
141  "comp_eval_mode" => "evmode"
142  ],
143  []
144  );
145 
146  $this->assertEquals(
147  "evmode",
148  $request->getCompEvalMode()
149  );
150  }
151 
152  public function testSurveyCode(): void
153  {
154  $request = $this->getRequest(
155  [
156  "surveycode" => "code"
157  ],
158  []
159  );
160 
161  $this->assertEquals(
162  "code",
163  $request->getSurveyCode()
164  );
165  }
166 
167  public function testExportLabel(): void
168  {
169  $request = $this->getRequest(
170  [
171  "export_label" => "lab"
172  ],
173  []
174  );
175 
176  $this->assertEquals(
177  "lab",
178  $request->getExportLabel()
179  );
180  }
181 
182  public function testExportFormat(): void
183  {
184  $request = $this->getRequest(
185  [
186  ],
187  [
188  "export_format" => "xml"
189  ]
190  );
191 
192  $this->assertEquals(
193  "xml",
194  $request->getExportFormat()
195  );
196  }
197 }
Class ChatMainBarProvider .
Test evaluation request class.
$post
Definition: ltitoken.php:49
Refinery Factory $refinery