woocommerce/tests/php/includes/wc-core-functions-test.php

47 lines
1.1 KiB
PHP

<?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 ) );
}
/**
* 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',
);
$sorted_values = $unsorted_values;
wc_asort_by_locale( $sorted_values );
$this->assertSame( array( 'Afghanistan', 'Åland Islands', 'Espagne', 'Éthiopie' ), array_values( $sorted_values ) );
}
}