2014-09-05 06:36:35 +00:00
|
|
|
<?php
|
2015-03-06 15:32:40 +00:00
|
|
|
|
|
|
|
namespace WooCommerce\Tests\Coupon;
|
|
|
|
|
2014-09-05 06:36:35 +00:00
|
|
|
/**
|
2015-03-06 15:32:40 +00:00
|
|
|
* Class Functions
|
|
|
|
* @package WooCommerce\Tests\Coupon
|
|
|
|
* @since 2.2
|
|
|
|
*/
|
|
|
|
class Functions extends \WC_Unit_Test_Case {
|
2014-09-05 06:36:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test wc_get_coupon_types()
|
|
|
|
*
|
|
|
|
* @since 2.2
|
|
|
|
*/
|
|
|
|
public function test_wc_get_coupon_types() {
|
|
|
|
|
|
|
|
$coupon_types = array(
|
|
|
|
'fixed_cart' => __( 'Cart Discount', 'woocommerce' ),
|
|
|
|
'percent' => __( 'Cart % Discount', 'woocommerce' ),
|
|
|
|
'fixed_product' => __( 'Product Discount', 'woocommerce' ),
|
|
|
|
'percent_product' => __( 'Product % Discount', 'woocommerce' )
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->assertEquals( $coupon_types, wc_get_coupon_types() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test wc_get_coupon_type()
|
|
|
|
*
|
|
|
|
* @since 2.2
|
|
|
|
*/
|
|
|
|
public function test_wc_get_coupon_type() {
|
|
|
|
|
|
|
|
$this->assertEquals( 'Cart Discount', wc_get_coupon_type( 'fixed_cart' ) );
|
|
|
|
$this->assertEmpty( wc_get_coupon_type( 'bogus_type' ) );
|
|
|
|
}
|
|
|
|
|
2015-10-28 18:09:53 +00:00
|
|
|
/**
|
|
|
|
* Test coupons_enabled method
|
|
|
|
*
|
|
|
|
* @since 2.5.0
|
|
|
|
*/
|
2015-10-29 19:23:10 +00:00
|
|
|
public function test_wc_coupons_enabled() {
|
|
|
|
$this->assertEquals( apply_filters( 'woocommerce_coupons_enabled', get_option( 'woocommerce_enable_coupons' ) == 'yes' ), wc_coupons_enabled() );
|
2015-10-28 18:09:53 +00:00
|
|
|
}
|
|
|
|
|
2014-09-05 06:36:35 +00:00
|
|
|
}
|