Add tests
This commit is contained in:
parent
b1a811ca46
commit
7feae340f2
|
@ -115,4 +115,31 @@ class WC_Tests_Template_Functions extends WC_Unit_Test_Case {
|
|||
|
||||
unset( $_REQUEST['attribute_pa_size'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test wc_query_string_form_fields.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_wc_query_string_form_fields() {
|
||||
$actual_html = wc_query_string_form_fields( '?test=1', array(), '', true );
|
||||
$expected_html = '<input type="hidden" name="test" value="1" />';
|
||||
$this->assertEquals( $expected_html, $actual_html, var_export( $actual_html, true ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export
|
||||
|
||||
$actual_html = wc_query_string_form_fields( '?test=1&test2=something', array(), '', true );
|
||||
$expected_html = '<input type="hidden" name="test" value="1" /><input type="hidden" name="test2" value="something" />';
|
||||
$this->assertEquals( $expected_html, $actual_html, var_export( $actual_html, true ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export
|
||||
|
||||
$actual_html = wc_query_string_form_fields( '?test.something=something', array(), '', true );
|
||||
$expected_html = '<input type="hidden" name="test.something" value="something" />';
|
||||
$this->assertEquals( $expected_html, $actual_html, var_export( $actual_html, true ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export
|
||||
|
||||
$actual_html = wc_query_string_form_fields( '?test+something=something', array(), '', true );
|
||||
$expected_html = '<input type="hidden" name="test+something" value="something" />';
|
||||
$this->assertEquals( $expected_html, $actual_html, var_export( $actual_html, true ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export
|
||||
|
||||
$actual_html = wc_query_string_form_fields( '?test%20something=something', array(), '', true );
|
||||
$expected_html = '<input type="hidden" name="test%20something" value="something" />';
|
||||
$this->assertEquals( $expected_html, $actual_html, var_export( $actual_html, true ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue