2014-09-01 06:00:12 +00:00
|
|
|
<?php
|
|
|
|
|
2014-09-01 06:59:23 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Class Core_Functions.
|
2015-03-06 15:32:40 +00:00
|
|
|
* @package WooCommerce\Tests\Util
|
2014-09-01 06:59:23 +00:00
|
|
|
* @since 2.2
|
|
|
|
*/
|
2016-03-23 12:14:13 +00:00
|
|
|
class WC_Tests_Core_Functions extends WC_Unit_Test_Case {
|
2014-09-01 06:59:23 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Test get_woocommerce_currency().
|
2014-09-01 06:59:23 +00:00
|
|
|
*
|
|
|
|
* @since 2.2
|
|
|
|
*/
|
2014-09-01 06:00:12 +00:00
|
|
|
public function test_get_woocommerce_currency() {
|
|
|
|
|
|
|
|
$this->assertEquals( 'GBP', get_woocommerce_currency() );
|
|
|
|
}
|
|
|
|
|
2014-09-01 06:59:23 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Test get_woocommerce_currencies().
|
2014-09-01 06:59:23 +00:00
|
|
|
*
|
|
|
|
* @since 2.2
|
|
|
|
*/
|
2014-09-01 06:00:12 +00:00
|
|
|
public function test_get_woocommerce_currencies() {
|
|
|
|
|
|
|
|
$expected_currencies = array(
|
2016-10-12 10:16:30 +00:00
|
|
|
'AED' => 'United Arab Emirates dirham',
|
|
|
|
'AFN' => 'Afghan afghani',
|
|
|
|
'ALL' => 'Albanian lek',
|
|
|
|
'AMD' => 'Armenian dram',
|
|
|
|
'ANG' => 'Netherlands Antillean guilder',
|
|
|
|
'AOA' => 'Angolan kwanza',
|
|
|
|
'ARS' => 'Argentine peso',
|
|
|
|
'AUD' => 'Australian dollar',
|
|
|
|
'AWG' => 'Aruban florin',
|
|
|
|
'AZN' => 'Azerbaijani manat',
|
|
|
|
'BAM' => 'Bosnia and Herzegovina convertible mark',
|
|
|
|
'BBD' => 'Barbadian dollar',
|
|
|
|
'BDT' => 'Bangladeshi taka',
|
|
|
|
'BGN' => 'Bulgarian lev',
|
|
|
|
'BHD' => 'Bahraini dinar',
|
|
|
|
'BIF' => 'Burundian franc',
|
|
|
|
'BMD' => 'Bermudian dollar',
|
|
|
|
'BND' => 'Brunei dollar',
|
|
|
|
'BOB' => 'Bolivian boliviano',
|
|
|
|
'BRL' => 'Brazilian real',
|
|
|
|
'BSD' => 'Bahamian dollar',
|
|
|
|
'BTC' => 'Bitcoin',
|
|
|
|
'BTN' => 'Bhutanese ngultrum',
|
|
|
|
'BWP' => 'Botswana pula',
|
|
|
|
'BYR' => 'Belarusian ruble',
|
|
|
|
'BZD' => 'Belize dollar',
|
|
|
|
'CAD' => 'Canadian dollar',
|
|
|
|
'CDF' => 'Congolese franc',
|
|
|
|
'CHF' => 'Swiss franc',
|
|
|
|
'CLP' => 'Chilean peso',
|
|
|
|
'CNY' => 'Chinese yuan',
|
|
|
|
'COP' => 'Colombian peso',
|
|
|
|
'CRC' => 'Costa Rican colón',
|
|
|
|
'CUC' => 'Cuban convertible peso',
|
|
|
|
'CUP' => 'Cuban peso',
|
|
|
|
'CVE' => 'Cape Verdean escudo',
|
|
|
|
'CZK' => 'Czech koruna',
|
|
|
|
'DJF' => 'Djiboutian franc',
|
|
|
|
'DKK' => 'Danish krone',
|
|
|
|
'DOP' => 'Dominican peso',
|
|
|
|
'DZD' => 'Algerian dinar',
|
|
|
|
'EGP' => 'Egyptian pound',
|
|
|
|
'ERN' => 'Eritrean nakfa',
|
|
|
|
'ETB' => 'Ethiopian birr',
|
|
|
|
'EUR' => 'Euro',
|
|
|
|
'FJD' => 'Fijian dollar',
|
|
|
|
'FKP' => 'Falkland Islands pound',
|
|
|
|
'GBP' => 'Pound sterling',
|
|
|
|
'GEL' => 'Georgian lari',
|
|
|
|
'GGP' => 'Guernsey pound',
|
|
|
|
'GHS' => 'Ghana cedi',
|
|
|
|
'GIP' => 'Gibraltar pound',
|
|
|
|
'GMD' => 'Gambian dalasi',
|
|
|
|
'GNF' => 'Guinean franc',
|
|
|
|
'GTQ' => 'Guatemalan quetzal',
|
|
|
|
'GYD' => 'Guyanese dollar',
|
|
|
|
'HKD' => 'Hong Kong dollar',
|
|
|
|
'HNL' => 'Honduran lempira',
|
|
|
|
'HRK' => 'Croatian kuna',
|
|
|
|
'HTG' => 'Haitian gourde',
|
|
|
|
'HUF' => 'Hungarian forint',
|
|
|
|
'IDR' => 'Indonesian rupiah',
|
|
|
|
'ILS' => 'Israeli new shekel',
|
|
|
|
'IMP' => 'Manx pound',
|
|
|
|
'INR' => 'Indian rupee',
|
|
|
|
'IQD' => 'Iraqi dinar',
|
|
|
|
'IRR' => 'Iranian rial',
|
2017-01-03 11:57:21 +00:00
|
|
|
'IRT' => 'Iranian toman',
|
2016-10-12 10:16:30 +00:00
|
|
|
'ISK' => 'Icelandic króna',
|
|
|
|
'JEP' => 'Jersey pound',
|
|
|
|
'JMD' => 'Jamaican dollar',
|
|
|
|
'JOD' => 'Jordanian dinar',
|
|
|
|
'JPY' => 'Japanese yen',
|
|
|
|
'KES' => 'Kenyan shilling',
|
|
|
|
'KGS' => 'Kyrgyzstani som',
|
|
|
|
'KHR' => 'Cambodian riel',
|
|
|
|
'KMF' => 'Comorian franc',
|
|
|
|
'KPW' => 'North Korean won',
|
|
|
|
'KRW' => 'South Korean won',
|
|
|
|
'KWD' => 'Kuwaiti dinar',
|
|
|
|
'KYD' => 'Cayman Islands dollar',
|
|
|
|
'KZT' => 'Kazakhstani tenge',
|
|
|
|
'LAK' => 'Lao kip',
|
|
|
|
'LBP' => 'Lebanese pound',
|
|
|
|
'LKR' => 'Sri Lankan rupee',
|
|
|
|
'LRD' => 'Liberian dollar',
|
|
|
|
'LSL' => 'Lesotho loti',
|
|
|
|
'LYD' => 'Libyan dinar',
|
|
|
|
'MAD' => 'Moroccan dirham',
|
|
|
|
'MDL' => 'Moldovan leu',
|
|
|
|
'MGA' => 'Malagasy ariary',
|
|
|
|
'MKD' => 'Macedonian denar',
|
|
|
|
'MMK' => 'Burmese kyat',
|
|
|
|
'MNT' => 'Mongolian tögrög',
|
|
|
|
'MOP' => 'Macanese pataca',
|
|
|
|
'MRO' => 'Mauritanian ouguiya',
|
|
|
|
'MUR' => 'Mauritian rupee',
|
|
|
|
'MVR' => 'Maldivian rufiyaa',
|
|
|
|
'MWK' => 'Malawian kwacha',
|
|
|
|
'MXN' => 'Mexican peso',
|
|
|
|
'MYR' => 'Malaysian ringgit',
|
|
|
|
'MZN' => 'Mozambican metical',
|
|
|
|
'NAD' => 'Namibian dollar',
|
|
|
|
'NGN' => 'Nigerian naira',
|
|
|
|
'NIO' => 'Nicaraguan córdoba',
|
|
|
|
'NOK' => 'Norwegian krone',
|
|
|
|
'NPR' => 'Nepalese rupee',
|
|
|
|
'NZD' => 'New Zealand dollar',
|
|
|
|
'OMR' => 'Omani rial',
|
|
|
|
'PAB' => 'Panamanian balboa',
|
|
|
|
'PEN' => 'Peruvian nuevo sol',
|
|
|
|
'PGK' => 'Papua New Guinean kina',
|
|
|
|
'PHP' => 'Philippine peso',
|
|
|
|
'PKR' => 'Pakistani rupee',
|
|
|
|
'PLN' => 'Polish złoty',
|
|
|
|
'PRB' => 'Transnistrian ruble',
|
|
|
|
'PYG' => 'Paraguayan guaraní',
|
|
|
|
'QAR' => 'Qatari riyal',
|
|
|
|
'RON' => 'Romanian leu',
|
|
|
|
'RSD' => 'Serbian dinar',
|
|
|
|
'RUB' => 'Russian ruble',
|
|
|
|
'RWF' => 'Rwandan franc',
|
|
|
|
'SAR' => 'Saudi riyal',
|
|
|
|
'SBD' => 'Solomon Islands dollar',
|
|
|
|
'SCR' => 'Seychellois rupee',
|
|
|
|
'SDG' => 'Sudanese pound',
|
|
|
|
'SEK' => 'Swedish krona',
|
|
|
|
'SGD' => 'Singapore dollar',
|
|
|
|
'SHP' => 'Saint Helena pound',
|
|
|
|
'SLL' => 'Sierra Leonean leone',
|
|
|
|
'SOS' => 'Somali shilling',
|
|
|
|
'SRD' => 'Surinamese dollar',
|
|
|
|
'SSP' => 'South Sudanese pound',
|
|
|
|
'STD' => 'São Tomé and Príncipe dobra',
|
|
|
|
'SYP' => 'Syrian pound',
|
|
|
|
'SZL' => 'Swazi lilangeni',
|
|
|
|
'THB' => 'Thai baht',
|
|
|
|
'TJS' => 'Tajikistani somoni',
|
|
|
|
'TMT' => 'Turkmenistan manat',
|
|
|
|
'TND' => 'Tunisian dinar',
|
|
|
|
'TOP' => 'Tongan paʻanga',
|
|
|
|
'TRY' => 'Turkish lira',
|
|
|
|
'TTD' => 'Trinidad and Tobago dollar',
|
|
|
|
'TWD' => 'New Taiwan dollar',
|
|
|
|
'TZS' => 'Tanzanian shilling',
|
|
|
|
'UAH' => 'Ukrainian hryvnia',
|
|
|
|
'UGX' => 'Ugandan shilling',
|
|
|
|
'USD' => 'United States dollar',
|
|
|
|
'UYU' => 'Uruguayan peso',
|
|
|
|
'UZS' => 'Uzbekistani som',
|
|
|
|
'VEF' => 'Venezuelan bolívar',
|
|
|
|
'VND' => 'Vietnamese đồng',
|
|
|
|
'VUV' => 'Vanuatu vatu',
|
|
|
|
'WST' => 'Samoan tālā',
|
|
|
|
'XAF' => 'Central African CFA franc',
|
|
|
|
'XCD' => 'East Caribbean dollar',
|
|
|
|
'XOF' => 'West African CFA franc',
|
|
|
|
'XPF' => 'CFP franc',
|
|
|
|
'YER' => 'Yemeni rial',
|
|
|
|
'ZAR' => 'South African rand',
|
|
|
|
'ZMW' => 'Zambian kwacha',
|
2014-09-01 06:00:12 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$this->assertEquals( $expected_currencies, get_woocommerce_currencies() );
|
|
|
|
}
|
|
|
|
|
2014-09-01 06:59:23 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Test get_woocommerce_currency_symbol().
|
2014-09-01 06:59:23 +00:00
|
|
|
*
|
|
|
|
* @since 2.2
|
|
|
|
*/
|
2014-09-01 06:00:12 +00:00
|
|
|
public function test_get_woocommerce_currency_symbol() {
|
|
|
|
|
2014-09-01 06:59:23 +00:00
|
|
|
// default currency
|
2014-09-01 06:00:12 +00:00
|
|
|
$this->assertEquals( '£', get_woocommerce_currency_symbol() );
|
|
|
|
|
2014-09-01 06:59:23 +00:00
|
|
|
// given specific currency
|
|
|
|
$this->assertEquals( '$', get_woocommerce_currency_symbol( 'USD' ) );
|
2014-09-01 06:00:12 +00:00
|
|
|
|
2014-09-01 06:59:23 +00:00
|
|
|
// each case
|
|
|
|
foreach ( array_keys( get_woocommerce_currencies() ) as $currency_code ) {
|
|
|
|
$this->assertInternalType( 'string', get_woocommerce_currency_symbol( $currency_code ) );
|
|
|
|
}
|
2014-09-01 06:00:12 +00:00
|
|
|
}
|
|
|
|
|
2014-09-01 06:59:23 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Test get_woocommerce_api_url().
|
2014-09-01 06:59:23 +00:00
|
|
|
*
|
|
|
|
* @since 2.2
|
|
|
|
*/
|
|
|
|
public function test_get_woocommerce_api_url() {
|
2014-09-01 06:00:12 +00:00
|
|
|
|
2014-09-05 15:17:53 +00:00
|
|
|
$base_uri = get_home_url();
|
|
|
|
|
2014-09-01 06:59:23 +00:00
|
|
|
// base uri
|
2015-06-18 22:24:57 +00:00
|
|
|
$this->assertEquals( "$base_uri/wc-api/v3/", get_woocommerce_api_url( null ) );
|
2014-09-01 06:00:12 +00:00
|
|
|
|
2014-09-01 06:59:23 +00:00
|
|
|
// path
|
2015-06-18 22:24:57 +00:00
|
|
|
$this->assertEquals( "$base_uri/wc-api/v3/orders", get_woocommerce_api_url( 'orders' ) );
|
2014-09-01 06:00:12 +00:00
|
|
|
}
|
|
|
|
|
2015-04-08 15:55:54 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Test wc_get_log_file_path().
|
2015-04-08 15:55:54 +00:00
|
|
|
*
|
|
|
|
* @since 2.4
|
|
|
|
*/
|
|
|
|
public function test_wc_get_log_file_path() {
|
|
|
|
$log_dir = trailingslashit( WC_LOG_DIR );
|
|
|
|
$hash_name = sanitize_file_name( wp_hash( 'unit-tests' ) );
|
|
|
|
|
|
|
|
$this->assertEquals( $log_dir . 'unit-tests-' . $hash_name . '.log', wc_get_log_file_path( 'unit-tests' ) );
|
|
|
|
}
|
|
|
|
|
2016-12-15 19:52:24 +00:00
|
|
|
/**
|
|
|
|
* Test wc_get_logger().
|
|
|
|
*
|
2016-12-19 20:28:55 +00:00
|
|
|
* @since 2.7.0
|
2016-12-15 19:52:24 +00:00
|
|
|
*/
|
|
|
|
public function test_wc_get_logger() {
|
2017-01-14 17:45:51 +00:00
|
|
|
// This filter should have no effect because the class does not implement WC_Logger_Interface
|
|
|
|
add_filter( 'woocommerce_logging_class', array( $this, 'return_bad_logger' ) );
|
|
|
|
|
|
|
|
$this->setExpectedIncorrectUsage( 'wc_get_logger' );
|
2016-12-15 19:52:24 +00:00
|
|
|
$log_a = wc_get_logger();
|
|
|
|
$log_b = wc_get_logger();
|
|
|
|
|
2016-12-16 20:37:58 +00:00
|
|
|
$this->assertInstanceOf( 'WC_Logger', $log_a );
|
|
|
|
$this->assertInstanceOf( 'WC_Logger', $log_b );
|
2016-12-15 19:52:24 +00:00
|
|
|
$this->assertSame( $log_a, $log_b, '`wc_get_logger()` should return the same instance' );
|
|
|
|
}
|
|
|
|
|
2017-01-14 17:45:51 +00:00
|
|
|
/**
|
|
|
|
* Return class which does not implement WC_Logger_Interface
|
|
|
|
*
|
|
|
|
* This is a helper function to test woocommerce_logging_class filter and wc_get_logger.
|
|
|
|
*
|
|
|
|
* @return string Class name
|
|
|
|
*/
|
|
|
|
public function return_bad_logger() {
|
|
|
|
return __CLASS__;
|
|
|
|
}
|
|
|
|
|
2014-09-01 06:59:23 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Test wc_get_core_supported_themes().
|
2014-09-01 06:59:23 +00:00
|
|
|
*
|
|
|
|
* @since 2.2
|
|
|
|
*/
|
2014-09-01 06:00:12 +00:00
|
|
|
public function test_wc_get_core_supported_themes() {
|
|
|
|
|
2016-12-07 13:46:01 +00:00
|
|
|
$expected_themes = array( 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' );
|
2014-09-01 06:00:12 +00:00
|
|
|
|
|
|
|
$this->assertEquals( $expected_themes, wc_get_core_supported_themes() );
|
|
|
|
}
|
2014-09-01 06:59:23 +00:00
|
|
|
|
2014-11-18 14:56:13 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Test wc_get_base_location().
|
2014-11-18 14:56:13 +00:00
|
|
|
*
|
|
|
|
* @since 2.3.0
|
|
|
|
*/
|
2015-01-05 10:26:35 +00:00
|
|
|
public function test_wc_get_base_location() {
|
|
|
|
$default = wc_get_base_location();
|
2014-11-18 14:56:13 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 'GB', $default['country'] );
|
|
|
|
$this->assertEquals( '', $default['state'] );
|
|
|
|
}
|
|
|
|
|
2016-02-16 07:31:29 +00:00
|
|
|
/**
|
|
|
|
* Test wc_format_country_state_string().
|
|
|
|
*
|
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
|
|
|
public function test_wc_format_country_state_string() {
|
2016-02-16 09:05:32 +00:00
|
|
|
// Test with correct values.
|
2016-02-16 07:31:29 +00:00
|
|
|
$this->assertEquals( array( 'country' => 'US', 'state' => 'CA' ), wc_format_country_state_string( 'US:CA' ) );
|
2016-02-16 09:05:32 +00:00
|
|
|
// Test what happens when we pass an incorrect value.
|
|
|
|
$this->assertEquals( array( 'country' => 'US-CA', 'state' => '' ), wc_format_country_state_string( 'US-CA' ) );
|
2016-02-16 07:31:29 +00:00
|
|
|
}
|
|
|
|
|
2016-05-25 21:29:38 +00:00
|
|
|
/**
|
|
|
|
* Test wc_get_shipping_method_count()
|
|
|
|
*
|
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
|
|
|
public function test_wc_get_shipping_method_count() {
|
|
|
|
// Without legacy methods.
|
|
|
|
$this->assertEquals( 0, wc_get_shipping_method_count( false ) );
|
|
|
|
|
|
|
|
// With legacy methods.
|
|
|
|
$this->assertEquals( 0, wc_get_shipping_method_count( true ) );
|
|
|
|
}
|
2016-12-17 20:16:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test wc_print_r()
|
|
|
|
*
|
2016-12-19 20:28:55 +00:00
|
|
|
* @since 2.7.0
|
2016-12-17 20:16:26 +00:00
|
|
|
*/
|
|
|
|
public function test_wc_print_r() {
|
|
|
|
$arr = array( 1, 2, 'a', 'b', 'c' => 'd' );
|
|
|
|
|
|
|
|
// This filter will sequentially remove handlers, allowing us to test as though our
|
|
|
|
// functions were accumulatively blacklisted, adding one on each call.
|
|
|
|
add_filter( 'woocommerce_print_r_alternatives', array( $this, 'filter_wc_print_r_alternatives' ) );
|
|
|
|
|
|
|
|
$this->expectOutputString(
|
|
|
|
print_r( $arr, true ),
|
|
|
|
$return_value = wc_print_r( $arr )
|
|
|
|
);
|
|
|
|
$this->assertTrue( $return_value );
|
|
|
|
ob_clean();
|
|
|
|
|
|
|
|
$this->expectOutputString(
|
|
|
|
var_export( $arr, true ),
|
|
|
|
$return_value = wc_print_r( $arr )
|
|
|
|
);
|
|
|
|
$this->assertTrue( $return_value );
|
|
|
|
ob_clean();
|
|
|
|
|
|
|
|
$this->expectOutputString(
|
|
|
|
json_encode( $arr ),
|
|
|
|
$return_value = wc_print_r( $arr )
|
|
|
|
);
|
|
|
|
$this->assertTrue( $return_value );
|
|
|
|
ob_clean();
|
|
|
|
|
|
|
|
$this->expectOutputString(
|
|
|
|
serialize( $arr ),
|
|
|
|
$return_value = wc_print_r( $arr )
|
|
|
|
);
|
|
|
|
$this->assertTrue( $return_value );
|
|
|
|
ob_clean();
|
|
|
|
|
|
|
|
$this->expectOutputString(
|
|
|
|
'',
|
|
|
|
$return_value = wc_print_r( $arr )
|
|
|
|
);
|
|
|
|
$this->assertFalse( $return_value );
|
|
|
|
ob_clean();
|
|
|
|
|
|
|
|
// Reset filter to include all handlers
|
|
|
|
$this->filter_wc_print_r_alternatives( array(), true );
|
|
|
|
|
|
|
|
$this->assertEquals( print_r( $arr, true ), wc_print_r( $arr, true ) );
|
|
|
|
$this->assertEquals( var_export( $arr, true ), wc_print_r( $arr, true ) );
|
|
|
|
$this->assertEquals( json_encode( $arr ), wc_print_r( $arr, true ) );
|
|
|
|
$this->assertEquals( serialize( $arr ), wc_print_r( $arr, true ) );
|
|
|
|
$this->assertFalse( wc_print_r( $arr, true ) );
|
|
|
|
|
|
|
|
remove_filter( 'woocommerce_print_r_alternatives', array( $this, 'filter_wc_print_r_alternatives' ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Filter function to help test wc_print_r alternatives via filter.
|
|
|
|
*
|
|
|
|
* On the first run, all alternatives are returned.
|
|
|
|
* On each successive run, an alternative is excluded from the beginning.
|
|
|
|
* Eventually, no handlers are returned.
|
|
|
|
*
|
|
|
|
* @param array $alternatives Input array of alternatives.
|
|
|
|
* @param bool $reset Optional. Default false. True to reset excluded alternatives.
|
|
|
|
* @return array|bool Alternatives. True on reset.
|
|
|
|
*/
|
|
|
|
public function filter_wc_print_r_alternatives( $alternatives, $reset = false ) {
|
|
|
|
static $skip = 0;
|
|
|
|
if ( $reset ) {
|
|
|
|
$skip = 0;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return array_slice( $alternatives, $skip++ );
|
|
|
|
}
|
|
|
|
|
2017-01-22 01:24:20 +00:00
|
|
|
/**
|
|
|
|
* Test wc_get_wildcard_postcodes
|
|
|
|
*/
|
|
|
|
public function test_wc_get_wildcard_postcodes() {
|
|
|
|
$postcode = 'cb23 6as';
|
|
|
|
$country = 'GB';
|
|
|
|
$wildcards = array( 'cb23 6as', 'CB23 6AS', 'CB23 6AS*', 'CB23 6A*', 'CB23 6*', 'CB23 *', 'CB23*', 'CB2*', 'CB*', 'C*', '*' );
|
|
|
|
$this->assertEquals( $wildcards, wc_get_wildcard_postcodes( $postcode, $country ) );
|
|
|
|
|
|
|
|
$postcode = 'GIJóN';
|
|
|
|
$country = '';
|
|
|
|
$wildcards = array( 'GIJóN', 'GIJÓN', 'GIJÓN*', 'GIJÓ*', 'GIJ*', 'GI*', 'G*', '*' );
|
|
|
|
$this->assertEquals( $wildcards, wc_get_wildcard_postcodes( $postcode, $country ) );
|
|
|
|
}
|
2014-09-01 06:00:12 +00:00
|
|
|
}
|