From 8e46b7c740a9ead108f72dc949da4ba45bf3f043 Mon Sep 17 00:00:00 2001 From: Kaspars Dambis Date: Mon, 16 Dec 2024 19:22:39 +0200 Subject: [PATCH] Add tests --- .../class-integration-tablepress-test.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/phpunit/class-integration-tablepress-test.php diff --git a/tests/phpunit/class-integration-tablepress-test.php b/tests/phpunit/class-integration-tablepress-test.php new file mode 100644 index 0000000..5f49a89 --- /dev/null +++ b/tests/phpunit/class-integration-tablepress-test.php @@ -0,0 +1,48 @@ + [ + [ + '', + 'header cell', + ], + [ + 'first_name', + '' + ] + ] + ]; + + $form_data = [ + 'first_name' => 'John ', + 'age' => '25', + 'food_preferences' => [ + 'pizza', + 'pasta', + ], + ]; + + $this->assertEquals( + [ + [ '', 'header cell', 'first_name', 'age', 'food_preferences' ], + [ 'first_name', '', '', '', '' ], + [ '', '', 'John ', '25', 'pizza, pasta' ], + ], + $integration->get_data_for_table( $table, $form_data )['data'] + ); + } +}