Merge latvian formatting test with other tests for DRY.

This commit is contained in:
vedanshujain 2022-04-27 11:40:51 +05:30
parent 46ae32161c
commit 19d230af63
2 changed files with 6 additions and 27 deletions

View File

@ -803,6 +803,12 @@ class WC_Tests_Formatting_Functions extends WC_Unit_Test_Case {
// Test empty NL postcode.
$this->assertEquals( '', wc_format_postcode( '', 'NL' ) );
// Test LV postcode without mandatory country code.
$this->assertEquals( 'LV-1337', wc_format_postcode( '1337', 'LV' ) );
// Test LV postcode with incorrect format (no dash).
$this->assertEquals( 'LV-1337', wc_format_postcode( 'lv1337', 'LV' ) );
}
/**

View File

@ -17,31 +17,4 @@ class WC_Formatting_Functions_Test extends \WC_Unit_Test_Case {
$this->assertEquals( 'DUMMYCOUPON', wc_sanitize_coupon_code( 'DUMMYCOUPON' ) );
$this->assertEquals( 'a&a', wc_sanitize_coupon_code( 'a&a' ) );
}
/**
* Test wc_format_postcode() function.
*/
public function test_wc_format_postcode() {
// IE postcode.
$this->assertEquals( 'D02 AF30', wc_format_postcode( 'D02AF30', 'IE' ) );
// PT postcode.
$this->assertEquals( '1000-205', wc_format_postcode( '1000205', 'PT' ) );
// BR/PL postcode.
$this->assertEquals( '99999-999', wc_format_postcode( '99999999', 'BR' ) );
// JP postcode.
$this->assertEquals( '999-9999', wc_format_postcode( '9999999', 'JP' ) );
// Test LV postcode without mandatory country code.
$this->assertEquals( 'LV-1337', wc_format_postcode( '1337', 'LV' ) );
// Test LV postcode with incorrect format (no dash).
$this->assertEquals( 'LV-1337', wc_format_postcode( 'lv1337', 'LV' ) );
// Test empty NL postcode.
$this->assertEquals( '', wc_format_postcode( '', 'NL' ) );
}
}