Unit test for counts
This commit is contained in:
parent
00f5b24e33
commit
c5b31cee3d
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue