-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
use SebastianBergmann\RecursionContext\InvalidArgumentException; | ||
use PHPUnit\Framework\ExpectationFailedException; | ||
|
||
/** | ||
* Test the main plugin class. | ||
*/ | ||
class Integration_TablePress_Test extends WP_UnitTestCase { | ||
|
||
/** | ||
* Can merge form data with table data. | ||
*/ | ||
public function test_can_merge_new_fields() { | ||
$integration = new Cf7_Extras_Integration_TablePress(); | ||
|
||
$table = [ | ||
'data' => [ | ||
[ | ||
'', | ||
'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'] | ||
); | ||
} | ||
} |