2020-08-19 22:00:18 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Core functions tests
|
|
|
|
*
|
|
|
|
* @package WooCommerce\Tests\Functions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class WC_Core_Functions_Test
|
|
|
|
*/
|
|
|
|
class WC_Core_Functions_Test extends \WC_Unit_Test_Case {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test wc_ascii_uasort_comparison() function.
|
|
|
|
*/
|
|
|
|
public function test_wc_ascii_uasort_comparison() {
|
|
|
|
$unsorted_values = array(
|
|
|
|
'ET' => 'Éthiopie',
|
|
|
|
'ES' => 'Espagne',
|
|
|
|
'AF' => 'Afghanistan',
|
|
|
|
'AX' => 'Åland Islands',
|
|
|
|
);
|
|
|
|
|
|
|
|
$sorted_values = $unsorted_values;
|
|
|
|
uasort( $sorted_values, 'wc_ascii_uasort_comparison' );
|
|
|
|
|
|
|
|
$this->assertSame( array( 'Afghanistan', 'Åland Islands', 'Espagne', 'Éthiopie' ), array_values( $sorted_values ) );
|
|
|
|
}
|
2020-08-19 23:22:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test wc_asort_by_locale() function.
|
|
|
|
*/
|
|
|
|
public function test_wc_asort_by_locale() {
|
|
|
|
$unsorted_values = array(
|
|
|
|
'ET' => 'Éthiopie',
|
|
|
|
'ES' => 'Espagne',
|
|
|
|
'AF' => 'Afghanistan',
|
|
|
|
'AX' => 'Åland Islands',
|
|
|
|
);
|
|
|
|
|
2020-09-10 19:02:39 +00:00
|
|
|
$sorted_values = $unsorted_values;
|
|
|
|
wc_asort_by_locale( $sorted_values );
|
2020-08-19 23:22:18 +00:00
|
|
|
|
|
|
|
$this->assertSame( array( 'Afghanistan', 'Åland Islands', 'Espagne', 'Éthiopie' ), array_values( $sorted_values ) );
|
|
|
|
}
|
2020-08-19 22:00:18 +00:00
|
|
|
}
|