ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilUserCertificateTableProviderTest Class Reference
+ Inheritance diagram for ilUserCertificateTableProviderTest:
+ Collaboration diagram for ilUserCertificateTableProviderTest:

Public Member Functions

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

Detailed Description

Member Function Documentation

◆ testFetchingDataSetForTableWithLimitParamterAndWithoutFilters()

ilUserCertificateTableProviderTest::testFetchingDataSetForTableWithLimitParamterAndWithoutFilters ( )

Definition at line 83 of file ilUserCertificateTableProviderTest.php.

References $provider.

83  : void
84  {
85  $database = $this->createMock(ilDBInterface::class);
86 
87  $database
88  ->expects($this->atLeastOnce())
89  ->method('quote');
90 
91  $database->method('fetchAssoc')
92  ->willReturnOnConsecutiveCalls(
93  [
94  'id' => 600,
95  'obj_id' => 100,
96  'title' => 'CourseTest',
97  'obj_type' => 'crs',
98  'acquired_timestamp' => 1539867618,
99  'thumbnail_image_path' => 'some/path/test.svg',
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' => 1539867618,
131  'thumbnail_image_path' => 'some/path/test.svg',
132  'description' => 'some description',
133  'firstname' => 'ilyas',
134  'lastname' => 'homer',
135  ];
136 
137  $expected['cnt'] = 5;
138 
139  $this->assertSame($expected, $dataSet);
140  }
$provider
Definition: ltitoken.php:83

◆ testFetchingDataSetForTableWithOrderFieldDate()

ilUserCertificateTableProviderTest::testFetchingDataSetForTableWithOrderFieldDate ( )

Definition at line 142 of file ilUserCertificateTableProviderTest.php.

References $provider.

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

◆ testFetchingDataSetForTableWithoutParamtersAndWithoutFilters()

ilUserCertificateTableProviderTest::testFetchingDataSetForTableWithoutParamtersAndWithoutFilters ( )

Definition at line 26 of file ilUserCertificateTableProviderTest.php.

References $provider.

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

◆ testFetchingDataWithEmptyOrderFieldWillResultInException()

ilUserCertificateTableProviderTest::testFetchingDataWithEmptyOrderFieldWillResultInException ( )

Definition at line 250 of file ilUserCertificateTableProviderTest.php.

References $provider.

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

◆ testFetchingDataWithInvalidLimitParameterWillResultInException()

ilUserCertificateTableProviderTest::testFetchingDataWithInvalidLimitParameterWillResultInException ( )

Definition at line 345 of file ilUserCertificateTableProviderTest.php.

References $provider.

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

◆ testFetchingDataWithInvalidOffsetParameterWillResultInException()

ilUserCertificateTableProviderTest::testFetchingDataWithInvalidOffsetParameterWillResultInException ( )

Definition at line 395 of file ilUserCertificateTableProviderTest.php.

References $provider.

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

◆ testFetchingDataWithInvalidOrderFieldWillResultInException()

ilUserCertificateTableProviderTest::testFetchingDataWithInvalidOrderFieldWillResultInException ( )

Definition at line 205 of file ilUserCertificateTableProviderTest.php.

References $provider.

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

◆ testFetchingDataWithWrongOrderDirectionWillResultInException()

ilUserCertificateTableProviderTest::testFetchingDataWithWrongOrderDirectionWillResultInException ( )

Definition at line 295 of file ilUserCertificateTableProviderTest.php.

References $provider.

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

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