diff --git a/plugins/woocommerce/tests/legacy/unit-tests/formatting/functions.php b/plugins/woocommerce/tests/legacy/unit-tests/formatting/functions.php index e613d9341ed..6496a0f903c 100644 --- a/plugins/woocommerce/tests/legacy/unit-tests/formatting/functions.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/formatting/functions.php @@ -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' ) ); } /** diff --git a/plugins/woocommerce/tests/php/includes/wc-formatting-functions-test.php b/plugins/woocommerce/tests/php/includes/wc-formatting-functions-test.php index 545f30e0a35..93dfda3b314 100644 --- a/plugins/woocommerce/tests/php/includes/wc-formatting-functions-test.php +++ b/plugins/woocommerce/tests/php/includes/wc-formatting-functions-test.php @@ -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' ) ); - - } }