Skip to content

Commit 1d4624d

Browse files
committed
remove duplication of tests (#69)
1 parent 072624d commit 1d4624d

File tree

1 file changed

+0
-233
lines changed

1 file changed

+0
-233
lines changed

tests/base_test.php

Lines changed: 0 additions & 233 deletions
Original file line numberDiff line numberDiff line change
@@ -263,239 +263,6 @@ public function test_filter_callback(): void {
263263
$this->assertEquals(15, $nrofrows);
264264
}
265265

266-
/**
267-
* Test wb datepicker filter functionality via webservice external class.
268-
*
269-
* @covers \local_wunderbyte_table\filters\types\datepicker
270-
*
271-
* @throws \coding_exception
272-
* @throws \dml_exception
273-
*
274-
*/
275-
public function test_filter_datepicker(): void {
276-
277-
// First, we create default test courses.
278-
$courses = $this->create_test_courses(10);
279-
// Create 3 courses for end date filtering.
280-
$this->create_test_courses(1, [
281-
'fullname' => 'ended1',
282-
'startdate' => strtotime('2 May 2010'),
283-
'enddate' => strtotime('20 May 2010'),
284-
]);
285-
$this->create_test_courses(1, [
286-
'fullname' => 'ended2',
287-
'startdate' => strtotime('5 Jun 2020 14:00'),
288-
'enddate' => strtotime('15 Jun 2020 15:00'),
289-
]);
290-
$plusfifftymonth = strtotime('+50 month');
291-
$plussixtymonth = strtotime('+60 month');
292-
$this->create_test_courses(1, [
293-
'fullname' => 'future1',
294-
'startdate' => $plusfifftymonth,
295-
'enddate' => $plussixtymonth,
296-
]);
297-
298-
$user = $this->getDataGenerator()->create_user();
299-
$this->setUser($user);
300-
301-
$table = $this->create_demo2_table();
302-
$table->pagesize = 20;
303-
304-
$nrofrows = $this->get_rowscount_for_table(
305-
$table,
306-
0,
307-
null,
308-
null,
309-
null,
310-
null,
311-
null,
312-
'{"enddate":{"Course end date":{">":' . $plusfifftymonth . '}}}'
313-
);
314-
$this->assertEquals(1, $nrofrows);
315-
316-
$nrofrows = $this->get_rowscount_for_table(
317-
$table,
318-
0,
319-
null,
320-
null,
321-
null,
322-
null,
323-
null,
324-
'{"enddate":{"Course end date":{"<":' . strtotime('1 January 2020') . '}}}'
325-
);
326-
$this->assertEquals(11, $nrofrows);
327-
328-
$nrofrows = $this->get_rowscount_for_table(
329-
$table,
330-
0,
331-
null,
332-
null,
333-
null,
334-
null,
335-
null,
336-
'{"enddate":{"Course end date":{"<":' . strtotime('+1 year') . '}}}'
337-
);
338-
$this->assertEquals(12, $nrofrows);
339-
}
340-
341-
/**
342-
* Test wb base full text search.
343-
*
344-
* @covers \local_wunderbyte_table\filters\types\standardfilter
345-
*
346-
* @throws \coding_exception
347-
* @throws \dml_exception
348-
*
349-
*/
350-
public function test_filter_standardfilter(): void {
351-
// First, we create ten courses.
352-
$this->create_test_courses(10);
353-
// Now we create another six courses for basic searching and filtering.
354-
$this->create_test_courses(3, ['fullname' => 'filtercourse']);
355-
$this->create_test_courses(1, ['fullname' => 'ended1']);
356-
$this->create_test_courses(1, ['fullname' => 'ended2']);
357-
$this->create_test_courses(1, ['fullname' => 'future1']);
358-
359-
$user = $this->getDataGenerator()->create_user();
360-
$this->setUser($user);
361-
362-
$table = $this->create_demo2_table();
363-
$table->pagesize = 20;
364-
365-
$nrofrows = $this->get_rowscount_for_table($table);
366-
$this->assertEquals(16, $nrofrows);
367-
368-
// Validate basic filtering by course fullname.
369-
$nrofrows = $this->get_rowscount_for_table(
370-
$table,
371-
0,
372-
null,
373-
null,
374-
null,
375-
null,
376-
null,
377-
'{"fullname":["filtercourse"]}'
378-
);
379-
$this->assertEquals(3, $nrofrows);
380-
381-
$nrofrows = $this->get_rowscount_for_table(
382-
$table,
383-
0,
384-
null,
385-
null,
386-
null,
387-
null,
388-
null,
389-
'{"fullname":["ended2"]}'
390-
);
391-
$this->assertEquals(1, $nrofrows);
392-
393-
$nrofrows = $this->get_rowscount_for_table(
394-
$table,
395-
0,
396-
null,
397-
null,
398-
null,
399-
null,
400-
null,
401-
'{"fullname":["ended%"]}'
402-
);
403-
$this->assertEquals(2, $nrofrows);
404-
}
405-
406-
/**
407-
* Test wb base full text search.
408-
*
409-
* @covers \wunderbyte_table::query_db_cached
410-
* @covers \wunderbyte_table::define_fulltextsearchcolumns
411-
*
412-
* @throws \coding_exception
413-
* @throws \dml_exception
414-
*
415-
*/
416-
public function test_fulltextsearchcolumns(): void {
417-
// First, we create ten courses.
418-
$this->create_test_courses(10);
419-
// Now we create another six courses for basic searching and filtering.
420-
$this->create_test_courses(3, ['fullname' => 'filtercourse']);
421-
$this->create_test_courses(1, ['fullname' => 'ended1']);
422-
$this->create_test_courses(1, ['fullname' => 'ended2']);
423-
$this->create_test_courses(1, ['fullname' => 'future1']);
424-
425-
$user = $this->getDataGenerator()->create_user();
426-
$this->setUser($user);
427-
428-
$table = $this->create_demo2_table();
429-
430-
$nrofrows = $this->get_rowscount_for_table($table);
431-
$this->assertEquals(16, $nrofrows);
432-
433-
// Search for courses by name.
434-
$nrofrows = $this->get_rowscount_for_table(
435-
$table,
436-
0,
437-
null,
438-
null,
439-
null,
440-
null,
441-
null,
442-
null,
443-
'filtercourse'
444-
);
445-
$this->assertEquals(3, $nrofrows);
446-
447-
$nrofrows = $this->get_rowscount_for_table(
448-
$table,
449-
0,
450-
null,
451-
null,
452-
null,
453-
null,
454-
null,
455-
null,
456-
'Test course 9'
457-
);
458-
$this->assertEquals(1, $nrofrows);
459-
460-
$nrofrows = $this->get_rowscount_for_table(
461-
$table,
462-
0,
463-
null,
464-
null,
465-
null,
466-
null,
467-
null,
468-
null,
469-
'ended'
470-
);
471-
$this->assertEquals(2, $nrofrows);
472-
473-
// Validate basic filtering by course fullname.
474-
$nrofrows = $this->get_rowscount_for_table(
475-
$table,
476-
0,
477-
null,
478-
null,
479-
null,
480-
null,
481-
null,
482-
'{"fullname":["filtercourse"]}'
483-
);
484-
$this->assertEquals(3, $nrofrows);
485-
486-
$nrofrows = $this->get_rowscount_for_table(
487-
$table,
488-
0,
489-
null,
490-
null,
491-
null,
492-
null,
493-
null,
494-
'{"fullname":["ended2"]}'
495-
);
496-
$this->assertEquals(1, $nrofrows);
497-
}
498-
499266
/**
500267
* Function to create and return wunderbyte table class.
501268
*

0 commit comments

Comments
 (0)