@@ -199,72 +199,6 @@ public function test_sortable(): void {
199
199
$ this ->assertEquals ("Test course 5 " , $ fullname );
200
200
}
201
201
202
- /**
203
- * Test wb filter functionality via webservice external class.
204
- *
205
- * @covers \local_wunderbyte_table\filters\types\callback
206
- *
207
- * @throws \coding_exception
208
- * @throws \dml_exception
209
- *
210
- */
211
- public function test_filter_callback (): void {
212
-
213
- // First, we create default test courses.
214
- $ courses = $ this ->create_test_courses (45 );
215
-
216
- $ user1 = $ this ->getDataGenerator ()->create_user ();
217
- $ user2 = $ this ->getDataGenerator ()->create_user ();
218
- $ user3 = $ this ->getDataGenerator ()->create_user ();
219
-
220
- // We enrol users to the course in order to test sorting.
221
- $ this ->getDataGenerator ()->enrol_user ($ user1 ->id , $ courses [8 ]->id );
222
- $ this ->getDataGenerator ()->enrol_user ($ user2 ->id , $ courses [8 ]->id );
223
- $ this ->getDataGenerator ()->enrol_user ($ user3 ->id , $ courses [8 ]->id );
224
- $ this ->getDataGenerator ()->enrol_user ($ user2 ->id , $ courses [5 ]->id );
225
- $ this ->getDataGenerator ()->enrol_user ($ user3 ->id , $ courses [5 ]->id );
226
- $ this ->getDataGenerator ()->enrol_user ($ user2 ->id , $ courses [4 ]->id );
227
- $ this ->getDataGenerator ()->enrol_user ($ user2 ->id , $ courses [3 ]->id );
228
-
229
- $ this ->setAdminUser ();
230
-
231
- $ table = $ this ->create_demo2_table ();
232
-
233
- $ table ->pagesize = 30 ;
234
- $ nrofrows = $ this ->get_rowscount_for_table ($ table );
235
-
236
- // Now we get back exactly 10.
237
- $ this ->assertEquals (30 , $ nrofrows );
238
-
239
- $ nrofrows = $ this ->get_rowscount_for_table (
240
- $ table ,
241
- null ,
242
- null ,
243
- null ,
244
- null ,
245
- null ,
246
- null ,
247
- "{ \"iddivisblebythree \":[ \"0 \"]} " ,
248
- );
249
-
250
- // Now we get back exactly 30.
251
- $ this ->assertEquals (30 , $ nrofrows );
252
-
253
- $ nrofrows = $ this ->get_rowscount_for_table (
254
- $ table ,
255
- null ,
256
- null ,
257
- null ,
258
- null ,
259
- null ,
260
- null ,
261
- "{ \"iddivisblebythree \":[ \"1 \"]} " ,
262
- );
263
-
264
- // Now we get back exactly 15.
265
- $ this ->assertEquals (15 , $ nrofrows );
266
- }
267
-
268
202
/**
269
203
* Test wb base full text search.
270
204
*
@@ -639,6 +573,24 @@ public static function wb_table_common_settings_provider(): array {
639
573
// Array of tests.
640
574
$ returnarray = [
641
575
// Test name (description).
576
+ 'filter_callback ' => [
577
+ 'courses ' => $ standardcourses ,
578
+ 'expected ' => [
579
+ 'getrowscount ' => [
580
+ [
581
+ 'assert ' => 16 ,
582
+ ],
583
+ [
584
+ 'filterobjects ' => '{"iddivisblebythree":["0"]} ' ,
585
+ 'assert ' => 10 ,
586
+ ],
587
+ [
588
+ 'filterobjects ' => '{"iddivisblebythree":["1"]} ' ,
589
+ 'assert ' => 6 ,
590
+ ],
591
+ ],
592
+ ],
593
+ ],
642
594
'filter_datepicker_in_between ' => [
643
595
'courses ' => $ standardcourses ,
644
596
'expected ' => [
0 commit comments