ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilUserCertificateTableProviderTest Class Reference
+ Inheritance diagram for ilUserCertificateTableProviderTest:
+ Collaboration diagram for ilUserCertificateTableProviderTest:

Public Member Functions

 testFetchingDataSetForTableWithoutParamtersAndWithoutFilters ()
 
 testFetchingDataSetForTableWithLimitParameterAndWithoutFilters ()
 
 testFetchingDataSetForTableWithOrderFieldDate ()
 
 testFetchingDataWithInvalidOrderFieldWillResultInException ()
 
 testFetchingDataWithEmptyOrderFieldWillResultInException ()
 
 testFetchingDataWithWrongOrderDirectionWillResultInException ()
 
 testFetchingDataWithInvalidLimitParameterWillResultInException ()
 
 testFetchingDataWithInvalidOffsetParameterWillResultInException ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilCertificateBaseTestCase
 setUp ()
 
 setGlobalVariable (string $name, mixed $value)
 
- Protected Attributes inherited from ilCertificateBaseTestCase
Container $dic
 

Detailed Description

Definition at line 21 of file ilUserCertificateTableProviderTest.php.

Member Function Documentation

◆ testFetchingDataSetForTableWithLimitParameterAndWithoutFilters()

ilUserCertificateTableProviderTest::testFetchingDataSetForTableWithLimitParameterAndWithoutFilters ( )

Definition at line 82 of file ilUserCertificateTableProviderTest.php.

References $provider, and null.

82  : void
83  {
84  $database = $this->createMock(ilDBInterface::class);
85 
86  $database
87  ->expects($this->atLeastOnce())
88  ->method('quote');
89 
90  $database->method('fetchAssoc')
91  ->willReturnOnConsecutiveCalls(
92  [
93  'id' => 600,
94  'obj_id' => 100,
95  'title' => 'CourseTest',
96  'obj_type' => 'crs',
97  'acquired_timestamp' => 1_539_867_618,
98  'tile_image_path' => 'some/path/test.svg',
99  'tile_image_ident' => '-',
100  'description' => 'some description',
101  'firstname' => 'ilyas',
102  'lastname' => 'homer',
103  ],
104  null,
105  [
106  'cnt' => 5,
107  ],
108  null
109  );
110 
111  $logger = $this->getMockBuilder(ilLogger::class)
112  ->disableOriginalConstructor()
113  ->getMock();
114 
116  $database,
117  $logger,
118  'default_title'
119  );
120 
121  $dataSet = $provider->fetchDataSet(100, ['language' => 'de', 'limit' => 2], []);
122 
123  $expected = [];
124 
125  $expected['items'][] = [
126  'id' => 600,
127  'title' => 'CourseTest',
128  'obj_id' => 100,
129  'obj_type' => 'crs',
130  'date' => 1_539_867_618,
131  'tile_image_path' => 'some/path/test.svg',
132  'tile_image_ident' => '-',
133  'description' => 'some description',
134  'firstname' => 'ilyas',
135  'lastname' => 'homer',
136  ];
137 
138  $expected['cnt'] = 5;
139 
140  $this->assertSame($expected, $dataSet);
141  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$provider
Definition: ltitoken.php:80

◆ testFetchingDataSetForTableWithOrderFieldDate()

ilUserCertificateTableProviderTest::testFetchingDataSetForTableWithOrderFieldDate ( )

Definition at line 143 of file ilUserCertificateTableProviderTest.php.

References $provider, and null.

143  : void
144  {
145  $database = $this->createMock(ilDBInterface::class);
146 
147  $database
148  ->expects($this->atLeastOnce())
149  ->method('quote');
150 
151  $database->method('fetchAssoc')
152  ->willReturnOnConsecutiveCalls(
153  [
154  'id' => 600,
155  'obj_id' => 100,
156  'title' => 'CourseTest',
157  'obj_type' => 'crs',
158  'acquired_timestamp' => 1_539_867_618,
159  'tile_image_path' => 'some/path/test.svg',
160  'tile_image_ident' => '-',
161  'description' => 'some description',
162  'firstname' => 'ilyas',
163  'lastname' => 'homer',
164  ],
165  null,
166  [
167  'cnt' => 5,
168  ],
169  null
170  );
171 
172  $logger = $this->getMockBuilder(ilLogger::class)
173  ->disableOriginalConstructor()
174  ->getMock();
175 
177  $database,
178  $logger,
179  'default_title'
180  );
181 
182  $dataSet = $provider->fetchDataSet(
183  100,
184  ['language' => 'de', 'limit' => 2, 'order_field' => 'date'],
185  []
186  );
187 
188  $expected = [];
189 
190  $expected['items'][] = [
191  'id' => 600,
192  'title' => 'CourseTest',
193  'obj_id' => 100,
194  'obj_type' => 'crs',
195  'date' => 1_539_867_618,
196  'tile_image_path' => 'some/path/test.svg',
197  'tile_image_ident' => '-',
198  'description' => 'some description',
199  'firstname' => 'ilyas',
200  'lastname' => 'homer',
201  ];
202 
203  $expected['cnt'] = 5;
204 
205  $this->assertSame($expected, $dataSet);
206  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$provider
Definition: ltitoken.php:80

◆ testFetchingDataSetForTableWithoutParamtersAndWithoutFilters()

ilUserCertificateTableProviderTest::testFetchingDataSetForTableWithoutParamtersAndWithoutFilters ( )

Definition at line 23 of file ilUserCertificateTableProviderTest.php.

References $provider, and null.

23  : void
24  {
25  $database = $this->getMockBuilder(ilDBInterface::class)
26  ->disableOriginalConstructor()
27  ->getMock();
28 
29  $database
30  ->expects($this->atLeastOnce())
31  ->method('quote');
32 
33  $database->method('fetchAssoc')
34  ->willReturnOnConsecutiveCalls(
35  [
36  'id' => 600,
37  'obj_id' => 100,
38  'title' => 'CourseTest',
39  'obj_type' => 'crs',
40  'acquired_timestamp' => 1_539_867_618,
41  'tile_image_path' => 'some/path/test.svg',
42  'tile_image_ident' => '-',
43  'description' => 'some description',
44  'firstname' => 'ilyas',
45  'lastname' => 'homer',
46  ],
47  null
48  );
49 
50  $logger = $this->getMockBuilder(ilLogger::class)
51  ->disableOriginalConstructor()
52  ->getMock();
53 
55  $database,
56  $logger,
57  'default_title'
58  );
59 
60  $dataSet = $provider->fetchDataSet(100, ['language' => 'de'], []);
61 
62  $expected = [];
63 
64  $expected['items'][] = [
65  'id' => 600,
66  'title' => 'CourseTest',
67  'obj_id' => 100,
68  'obj_type' => 'crs',
69  'date' => 1_539_867_618,
70  'tile_image_path' => 'some/path/test.svg',
71  'tile_image_ident' => '-',
72  'description' => 'some description',
73  'firstname' => 'ilyas',
74  'lastname' => 'homer',
75  ];
76 
77  $expected['cnt'] = 1;
78 
79  $this->assertSame($expected, $dataSet);
80  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$provider
Definition: ltitoken.php:80

◆ testFetchingDataWithEmptyOrderFieldWillResultInException()

ilUserCertificateTableProviderTest::testFetchingDataWithEmptyOrderFieldWillResultInException ( )

Definition at line 253 of file ilUserCertificateTableProviderTest.php.

References $provider, and null.

253  : never
254  {
255  $this->expectException(InvalidArgumentException::class);
256 
257  $database = $this->createMock(ilDBInterface::class);
258 
259  $database
260  ->expects($this->atLeastOnce())
261  ->method('quote');
262 
263  $database->method('fetchAssoc')
264  ->willReturnOnConsecutiveCalls(
265  [
266  'id' => 600,
267  'obj_id' => 100,
268  'title' => 'CourseTest',
269  'obj_type' => 'crs',
270  'acquired_timestamp' => 1_539_867_618
271  ],
272  null,
273  [
274  'cnt' => 5,
275  ],
276  null
277  );
278 
279  $logger = $this->getMockBuilder(ilLogger::class)
280  ->disableOriginalConstructor()
281  ->getMock();
282 
284  $database,
285  $logger,
286  'default_title'
287  );
288 
289  $provider->fetchDataSet(
290  100,
291  ['language' => 'de', 'limit' => 2, 'order_field' => false],
292  []
293  );
294 
295  $this->fail('Should never happen');
296  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$provider
Definition: ltitoken.php:80

◆ testFetchingDataWithInvalidLimitParameterWillResultInException()

ilUserCertificateTableProviderTest::testFetchingDataWithInvalidLimitParameterWillResultInException ( )

Definition at line 348 of file ilUserCertificateTableProviderTest.php.

References $provider, and null.

348  : never
349  {
350  $this->expectException(InvalidArgumentException::class);
351 
352  $database = $this->createMock(ilDBInterface::class);
353 
354  $database
355  ->expects($this->atLeastOnce())
356  ->method('quote');
357 
358  $database->method('fetchAssoc')
359  ->willReturnOnConsecutiveCalls(
360  [
361  'id' => 600,
362  'obj_id' => 100,
363  'title' => 'CourseTest',
364  'obj_type' => 'crs',
365  'acquired_timestamp' => 1_539_867_618
366  ],
367  null,
368  [
369  'cnt' => 5,
370  ],
371  null
372  );
373 
374  $logger = $this->getMockBuilder(ilLogger::class)
375  ->disableOriginalConstructor()
376  ->getMock();
377 
379  $database,
380  $logger,
381  'default_title'
382  );
383 
384  $provider->fetchDataSet(
385  600,
386  [
387  'language' => 'de',
388  'limit' => 'something',
389  'order_field' => 'date',
390  'order_direction' => 'mac'
391  ],
392  []
393  );
394 
395  $this->fail('Should never happen');
396  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$provider
Definition: ltitoken.php:80

◆ testFetchingDataWithInvalidOffsetParameterWillResultInException()

ilUserCertificateTableProviderTest::testFetchingDataWithInvalidOffsetParameterWillResultInException ( )

Definition at line 398 of file ilUserCertificateTableProviderTest.php.

References $provider, and null.

398  : never
399  {
400  $this->expectException(InvalidArgumentException::class);
401 
402  $database = $this->createMock(ilDBInterface::class);
403 
404  $database
405  ->expects($this->atLeastOnce())
406  ->method('quote');
407 
408  $database->method('fetchAssoc')
409  ->willReturnOnConsecutiveCalls(
410  [
411  'id' => 600,
412  'obj_id' => 100,
413  'title' => 'CourseTest',
414  'obj_type' => 'crs',
415  'acquired_timestamp' => 1_539_867_618
416  ],
417  null,
418  [
419  'cnt' => 5,
420  ],
421  null
422  );
423 
424  $logger = $this->getMockBuilder(ilLogger::class)
425  ->disableOriginalConstructor()
426  ->getMock();
427 
429  $database,
430  $logger,
431  'default_title'
432  );
433 
434  $provider->fetchDataSet(
435  600,
436  [
437  'limit' => 3,
438  'language' => 'de',
439  'order_field' => 'date',
440  'order_direction' => 'mac',
441  'offset' => 'something'
442  ],
443  []
444  );
445 
446  $this->fail('Should never happen');
447  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$provider
Definition: ltitoken.php:80

◆ testFetchingDataWithInvalidOrderFieldWillResultInException()

ilUserCertificateTableProviderTest::testFetchingDataWithInvalidOrderFieldWillResultInException ( )

Definition at line 208 of file ilUserCertificateTableProviderTest.php.

References $provider, and null.

208  : never
209  {
210  $this->expectException(InvalidArgumentException::class);
211 
212  $database = $this->createMock(ilDBInterface::class);
213 
214  $database
215  ->expects($this->atLeastOnce())
216  ->method('quote');
217 
218  $database->method('fetchAssoc')
219  ->willReturnOnConsecutiveCalls(
220  [
221  'id' => 600,
222  'obj_id' => 100,
223  'title' => 'CourseTest',
224  'obj_type' => 'crs',
225  'acquired_timestamp' => 1_539_867_618
226  ],
227  null,
228  [
229  'cnt' => 5,
230  ],
231  null
232  );
233 
234  $logger = $this->getMockBuilder(ilLogger::class)
235  ->disableOriginalConstructor()
236  ->getMock();
237 
239  $database,
240  $logger,
241  'default_title'
242  );
243 
244  $provider->fetchDataSet(
245  100,
246  ['language' => 'de', 'limit' => 2, 'order_field' => 'something'],
247  []
248  );
249 
250  $this->fail('Should never happen');
251  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$provider
Definition: ltitoken.php:80

◆ testFetchingDataWithWrongOrderDirectionWillResultInException()

ilUserCertificateTableProviderTest::testFetchingDataWithWrongOrderDirectionWillResultInException ( )

Definition at line 298 of file ilUserCertificateTableProviderTest.php.

References $provider, and null.

298  : never
299  {
300  $this->expectException(InvalidArgumentException::class);
301 
302  $database = $this->createMock(ilDBInterface::class);
303 
304  $database
305  ->expects($this->atLeastOnce())
306  ->method('quote');
307 
308  $database->method('fetchAssoc')
309  ->willReturnOnConsecutiveCalls(
310  [
311  'id' => 600,
312  'obj_id' => 100,
313  'title' => 'CourseTest',
314  'obj_type' => 'crs',
315  'acquired_timestamp' => 1_539_867_618
316  ],
317  null,
318  [
319  'cnt' => 5,
320  ],
321  null
322  );
323 
324  $logger = $this->getMockBuilder(ilLogger::class)
325  ->disableOriginalConstructor()
326  ->getMock();
327 
329  $database,
330  $logger,
331  'default_title'
332  );
333 
334  $provider->fetchDataSet(
335  600,
336  [
337  'language' => 'de',
338  'limit' => 2,
339  'order_field' => 'date',
340  'order_direction' => 'mac'
341  ],
342  []
343  );
344 
345  $this->fail('Should never happen');
346  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$provider
Definition: ltitoken.php:80

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