19 declare(strict_types=1);
28 $database = $this->getMockBuilder(ilDBInterface::class)
29 ->disableOriginalConstructor()
33 ->expects($this->atLeastOnce())
36 $database->method(
'fetchAssoc')
37 ->willReturnOnConsecutiveCalls(
41 'title' =>
'CourseTest',
43 'acquired_timestamp' => 1_539_867_618,
44 'tile_image_path' =>
'some/path/test.svg',
45 'tile_image_ident' =>
'-',
46 'description' =>
'some description',
47 'firstname' =>
'ilyas',
48 'lastname' =>
'homer',
53 $logger = $this->getMockBuilder(ilLogger::class)
54 ->disableOriginalConstructor()
63 $dataSet =
$provider->fetchDataSet(100, [
'language' =>
'de'], []);
67 $expected[
'items'][] = [
69 'title' =>
'CourseTest',
72 'date' => 1_539_867_618,
73 'tile_image_path' =>
'some/path/test.svg',
74 'tile_image_ident' =>
'-',
75 'description' =>
'some description',
76 'firstname' =>
'ilyas',
77 'lastname' =>
'homer',
82 $this->assertSame($expected, $dataSet);
87 $database = $this->createMock(ilDBInterface::class);
90 ->expects($this->atLeastOnce())
93 $database->method(
'fetchAssoc')
94 ->willReturnOnConsecutiveCalls(
98 'title' =>
'CourseTest',
100 'acquired_timestamp' => 1_539_867_618,
101 'tile_image_path' =>
'some/path/test.svg',
102 'tile_image_ident' =>
'-',
103 'description' =>
'some description',
104 'firstname' =>
'ilyas',
105 'lastname' =>
'homer',
114 $logger = $this->getMockBuilder(ilLogger::class)
115 ->disableOriginalConstructor()
124 $dataSet =
$provider->fetchDataSet(100, [
'language' =>
'de',
'limit' => 2], []);
128 $expected[
'items'][] = [
130 'title' =>
'CourseTest',
133 'date' => 1_539_867_618,
134 'tile_image_path' =>
'some/path/test.svg',
135 'tile_image_ident' =>
'-',
136 'description' =>
'some description',
137 'firstname' =>
'ilyas',
138 'lastname' =>
'homer',
141 $expected[
'cnt'] = 5;
143 $this->assertSame($expected, $dataSet);
148 $database = $this->createMock(ilDBInterface::class);
151 ->expects($this->atLeastOnce())
154 $database->method(
'fetchAssoc')
155 ->willReturnOnConsecutiveCalls(
159 'title' =>
'CourseTest',
161 'acquired_timestamp' => 1_539_867_618,
162 'tile_image_path' =>
'some/path/test.svg',
163 'tile_image_ident' =>
'-',
164 'description' =>
'some description',
165 'firstname' =>
'ilyas',
166 'lastname' =>
'homer',
175 $logger = $this->getMockBuilder(ilLogger::class)
176 ->disableOriginalConstructor()
187 [
'language' =>
'de',
'limit' => 2,
'order_field' =>
'date'],
193 $expected[
'items'][] = [
195 'title' =>
'CourseTest',
198 'date' => 1_539_867_618,
199 'tile_image_path' =>
'some/path/test.svg',
200 'tile_image_ident' =>
'-',
201 'description' =>
'some description',
202 'firstname' =>
'ilyas',
203 'lastname' =>
'homer',
206 $expected[
'cnt'] = 5;
208 $this->assertSame($expected, $dataSet);
213 $this->expectException(InvalidArgumentException::class);
215 $database = $this->createMock(ilDBInterface::class);
218 ->expects($this->atLeastOnce())
221 $database->method(
'fetchAssoc')
222 ->willReturnOnConsecutiveCalls(
226 'title' =>
'CourseTest',
228 'acquired_timestamp' => 1_539_867_618
237 $logger = $this->getMockBuilder(ilLogger::class)
238 ->disableOriginalConstructor()
249 [
'language' =>
'de',
'limit' => 2,
'order_field' =>
'something'],
253 $this->fail(
'Should never happen');
258 $this->expectException(InvalidArgumentException::class);
260 $database = $this->createMock(ilDBInterface::class);
263 ->expects($this->atLeastOnce())
266 $database->method(
'fetchAssoc')
267 ->willReturnOnConsecutiveCalls(
271 'title' =>
'CourseTest',
273 'acquired_timestamp' => 1_539_867_618
282 $logger = $this->getMockBuilder(ilLogger::class)
283 ->disableOriginalConstructor()
294 [
'language' =>
'de',
'limit' => 2,
'order_field' =>
false],
298 $this->fail(
'Should never happen');
303 $this->expectException(InvalidArgumentException::class);
305 $database = $this->createMock(ilDBInterface::class);
308 ->expects($this->atLeastOnce())
311 $database->method(
'fetchAssoc')
312 ->willReturnOnConsecutiveCalls(
316 'title' =>
'CourseTest',
318 'acquired_timestamp' => 1_539_867_618
327 $logger = $this->getMockBuilder(ilLogger::class)
328 ->disableOriginalConstructor()
342 'order_field' =>
'date',
343 'order_direction' =>
'mac' 348 $this->fail(
'Should never happen');
353 $this->expectException(InvalidArgumentException::class);
355 $database = $this->createMock(ilDBInterface::class);
358 ->expects($this->atLeastOnce())
361 $database->method(
'fetchAssoc')
362 ->willReturnOnConsecutiveCalls(
366 'title' =>
'CourseTest',
368 'acquired_timestamp' => 1_539_867_618
377 $logger = $this->getMockBuilder(ilLogger::class)
378 ->disableOriginalConstructor()
391 'limit' =>
'something',
392 'order_field' =>
'date',
393 'order_direction' =>
'mac' 398 $this->fail(
'Should never happen');
403 $this->expectException(InvalidArgumentException::class);
405 $database = $this->createMock(ilDBInterface::class);
408 ->expects($this->atLeastOnce())
411 $database->method(
'fetchAssoc')
412 ->willReturnOnConsecutiveCalls(
416 'title' =>
'CourseTest',
418 'acquired_timestamp' => 1_539_867_618
427 $logger = $this->getMockBuilder(ilLogger::class)
428 ->disableOriginalConstructor()
442 'order_field' =>
'date',
443 'order_direction' =>
'mac',
444 'offset' =>
'something' 449 $this->fail(
'Should never happen');
testFetchingDataWithInvalidOrderFieldWillResultInException()
testFetchingDataWithWrongOrderDirectionWillResultInException()
Class ilCertificateBaseTestCase.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
testFetchingDataWithInvalidOffsetParameterWillResultInException()
testFetchingDataSetForTableWithOrderFieldDate()
testFetchingDataSetForTableWithLimitParameterAndWithoutFilters()
testFetchingDataWithInvalidLimitParameterWillResultInException()
testFetchingDataSetForTableWithoutParamtersAndWithoutFilters()
testFetchingDataWithEmptyOrderFieldWillResultInException()