Skip to content

Commit a9b2903

Browse files
committed
Fixed deposit tests class
1 parent 18af61d commit a9b2903

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

tests/unit/helpers/class-wc-helper-deposit-product-manager.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,25 @@
1111
* This helper class should ONLY be used for unit tests!.
1212
*/
1313
class WC_Deposits_Product_Manager {
14-
public static function get_deposit_type( WC_Product_Simple $product ) {
14+
/**
15+
* @param WC_Product_Simple|int $product
16+
* @return mixed
17+
*/
18+
public static function get_deposit_type( $product ) {
19+
if ( is_int( $product ) ) {
20+
$product = wc_get_product( $product );
21+
}
1522
return $product->get_meta( '_wc_deposit_type' );
1623
}
17-
public static function deposits_enabled( WC_Product_Simple $product ) {
24+
25+
/**
26+
* @param WC_Product_Simple|int $product
27+
* @return bool
28+
*/
29+
public static function deposits_enabled( $product ) {
30+
if ( is_int( $product ) ) {
31+
$product = wc_get_product( $product );
32+
}
1833
return true === $product->get_meta( '_wc_deposits_enabled' );
1934
}
2035
}

0 commit comments

Comments
 (0)