Skip to content

Commit

Permalink
run create table dynamically (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
semteacher committed Feb 1, 2025
1 parent 3f87cf6 commit a59d00d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/base_dataprovider_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ public function test_sortable(): void {
/**
* Test wb base full text search.
*
* @param string $tablecallback
* @param array $coursedata
* @param array $expected
*
Expand All @@ -216,7 +217,7 @@ public function test_sortable(): void {
*
* @dataProvider wb_table_common_settings_provider
*/
public function test_dataprovider(array $coursedata, array $expected): void {
public function test_dataprovider(string $tablecallback, array $coursedata, array $expected): void {
// Create the courses, depending on data provider.
$courses = [];
foreach ($coursedata as $coursearray) {
Expand All @@ -225,7 +226,7 @@ public function test_dataprovider(array $coursedata, array $expected): void {

$this->setAdminUser();

$table = $this->create_demo2_table();
$table = $this->{$tablecallback}();

// Set pagesize.
$table->pagesize = $expected['pagesize'] ?? 20;
Expand Down Expand Up @@ -594,6 +595,7 @@ public static function wb_table_common_settings_provider(): array {
$returnarray = [
// Test name (description).
'filter_hierarchicalfilter' => [
'tablecallback' => 'create_demo2_table',
'courses' => $standardcourses,
'expected' => [
'getrowscount' => [
Expand All @@ -620,6 +622,7 @@ public static function wb_table_common_settings_provider(): array {
],
],
'filter_callback' => [
'tablecallback' => 'create_demo2_table',
'courses' => $standardcourses,
'expected' => [
'getrowscount' => [
Expand All @@ -638,6 +641,7 @@ public static function wb_table_common_settings_provider(): array {
],
],
'filter_datepicker_in_between' => [
'tablecallback' => 'create_demo2_table',
'courses' => $standardcourses,
'expected' => [
'getrowscount' => [
Expand Down Expand Up @@ -700,6 +704,7 @@ public static function wb_table_common_settings_provider(): array {
],
],
'fulltextsearchcolumns' => [
'tablecallback' => 'create_demo2_table',
'courses' => $standardcourses,
'expected' => [
'getrowscount' => [
Expand All @@ -722,6 +727,7 @@ public static function wb_table_common_settings_provider(): array {
],
],
'filter_standardfilter' => [
'tablecallback' => 'create_demo2_table',
'courses' => $standardcourses,
'expected' => [
'getrowscount' => [
Expand All @@ -748,6 +754,7 @@ public static function wb_table_common_settings_provider(): array {
],
],
'filter_datepicker' => [
'tablecallback' => 'create_demo2_table',
'courses' => $standardcourses,
'expected' => [
'getrowscount' => [
Expand Down

0 comments on commit a59d00d

Please sign in to comment.