Skip to content

Commit a59d00d

Browse files
committed
run create table dynamically (#69)
1 parent 3f87cf6 commit a59d00d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/base_dataprovider_test.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ public function test_sortable(): void {
203203
/**
204204
* Test wb base full text search.
205205
*
206+
* @param string $tablecallback
206207
* @param array $coursedata
207208
* @param array $expected
208209
*
@@ -216,7 +217,7 @@ public function test_sortable(): void {
216217
*
217218
* @dataProvider wb_table_common_settings_provider
218219
*/
219-
public function test_dataprovider(array $coursedata, array $expected): void {
220+
public function test_dataprovider(string $tablecallback, array $coursedata, array $expected): void {
220221
// Create the courses, depending on data provider.
221222
$courses = [];
222223
foreach ($coursedata as $coursearray) {
@@ -225,7 +226,7 @@ public function test_dataprovider(array $coursedata, array $expected): void {
225226

226227
$this->setAdminUser();
227228

228-
$table = $this->create_demo2_table();
229+
$table = $this->{$tablecallback}();
229230

230231
// Set pagesize.
231232
$table->pagesize = $expected['pagesize'] ?? 20;
@@ -594,6 +595,7 @@ public static function wb_table_common_settings_provider(): array {
594595
$returnarray = [
595596
// Test name (description).
596597
'filter_hierarchicalfilter' => [
598+
'tablecallback' => 'create_demo2_table',
597599
'courses' => $standardcourses,
598600
'expected' => [
599601
'getrowscount' => [
@@ -620,6 +622,7 @@ public static function wb_table_common_settings_provider(): array {
620622
],
621623
],
622624
'filter_callback' => [
625+
'tablecallback' => 'create_demo2_table',
623626
'courses' => $standardcourses,
624627
'expected' => [
625628
'getrowscount' => [
@@ -638,6 +641,7 @@ public static function wb_table_common_settings_provider(): array {
638641
],
639642
],
640643
'filter_datepicker_in_between' => [
644+
'tablecallback' => 'create_demo2_table',
641645
'courses' => $standardcourses,
642646
'expected' => [
643647
'getrowscount' => [
@@ -700,6 +704,7 @@ public static function wb_table_common_settings_provider(): array {
700704
],
701705
],
702706
'fulltextsearchcolumns' => [
707+
'tablecallback' => 'create_demo2_table',
703708
'courses' => $standardcourses,
704709
'expected' => [
705710
'getrowscount' => [
@@ -722,6 +727,7 @@ public static function wb_table_common_settings_provider(): array {
722727
],
723728
],
724729
'filter_standardfilter' => [
730+
'tablecallback' => 'create_demo2_table',
725731
'courses' => $standardcourses,
726732
'expected' => [
727733
'getrowscount' => [
@@ -748,6 +754,7 @@ public static function wb_table_common_settings_provider(): array {
748754
],
749755
],
750756
'filter_datepicker' => [
757+
'tablecallback' => 'create_demo2_table',
751758
'courses' => $standardcourses,
752759
'expected' => [
753760
'getrowscount' => [

0 commit comments

Comments
 (0)