Merge pull request #10356 from woothemes/unit-test-country-state-string

Adds a unit test for wc_format_country_state_string().
This commit is contained in:
Mike Jolley 2016-02-16 12:36:38 +00:00
commit c7a1d1af29
1 changed files with 12 additions and 0 deletions

View File

@ -153,5 +153,17 @@ class Core_Functions extends \WC_Unit_Test_Case {
$this->assertEquals( '', $default['state'] );
}
/**
* Test wc_format_country_state_string().
*
* @since 2.6.0
*/
public function test_wc_format_country_state_string() {
// Test with correct values.
$this->assertEquals( array( 'country' => 'US', 'state' => 'CA' ), wc_format_country_state_string( 'US:CA' ) );
// Test what happens when we pass an incorrect value.
$this->assertEquals( array( 'country' => 'US-CA', 'state' => '' ), wc_format_country_state_string( 'US-CA' ) );
}
}