Merge pull request #27671 from mahmoudsaeed/master
Make WC_Tax::get_tax_rate_classes() public
This commit is contained in:
commit
74bb66dc6d
|
@ -761,7 +761,7 @@ class WC_Tax {
|
||||||
* @since 3.7.0
|
* @since 3.7.0
|
||||||
* @return array Array of tax class objects consisting of tax_rate_class_id, name, and slug.
|
* @return array Array of tax class objects consisting of tax_rate_class_id, name, and slug.
|
||||||
*/
|
*/
|
||||||
protected static function get_tax_rate_classes() {
|
public static function get_tax_rate_classes() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$cache_key = 'tax-rate-classes';
|
$cache_key = 'tax-rate-classes';
|
||||||
|
|
|
@ -474,8 +474,25 @@ class WC_Tests_Tax extends WC_Unit_Test_Case {
|
||||||
$tax_classes = WC_Tax::get_tax_classes();
|
$tax_classes = WC_Tax::get_tax_classes();
|
||||||
$this->assertEquals( $tax_classes, array( 'Reduced rate', 'Zero rate' ) );
|
$this->assertEquals( $tax_classes, array( 'Reduced rate', 'Zero rate' ) );
|
||||||
|
|
||||||
$tax_classes = WC_Tax::get_tax_class_slugs();
|
$tax_class_slugs = WC_Tax::get_tax_class_slugs();
|
||||||
$this->assertEquals( $tax_classes, array( 'reduced-rate', 'zero-rate' ) );
|
$this->assertEquals( $tax_class_slugs, array( 'reduced-rate', 'zero-rate' ) );
|
||||||
|
|
||||||
|
$tax_rate_classes = WC_Tax::get_tax_rate_classes();
|
||||||
|
$this->assertEquals(
|
||||||
|
$tax_rate_classes,
|
||||||
|
array(
|
||||||
|
(object) array(
|
||||||
|
'tax_rate_class_id' => '1',
|
||||||
|
'name' => 'Reduced rate',
|
||||||
|
'slug' => 'reduced-rate',
|
||||||
|
),
|
||||||
|
(object) array(
|
||||||
|
'tax_rate_class_id' => '2',
|
||||||
|
'name' => 'Zero rate',
|
||||||
|
'slug' => 'zero-rate',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue