Unit test for counts

This commit is contained in:
Mike Jolley 2019-04-02 11:45:58 +01:00
parent 00f5b24e33
commit c5b31cee3d
1 changed files with 21 additions and 2 deletions

View File

@ -1,10 +1,14 @@
<?php
/**
* Class Functions.
* Attribute function tests.
*
* @package WooCommerce\Tests\Attributes
* @since 3.2.0
*/
/**
* WC_Tests_Attributes_Functions class.
*/
class WC_Tests_Attributes_Functions extends WC_Unit_Test_Case {
/**
@ -202,4 +206,19 @@ class WC_Tests_Attributes_Functions extends WC_Unit_Test_Case {
$result = wc_delete_attribute( 9999999 );
$this->assertFalse( $result );
}
/**
* Test counts of attributes.
*/
public function test_count_attribute_terms() {
$global_attribute_data = WC_Helper_Product::create_attribute( 'test', array( 'Chicken', 'Nuggets' ) );
$count = wp_count_terms(
$global_attribute_data['attribute_taxonomy'],
array(
'hide_empty' => false,
)
);
$this->assertEquals( 2, $count );
}
}