Merge pull request #13531 from woocommerce/fix/legacy-coupon-amount-property

Fix direct property access for coupon amount.
This commit is contained in:
Claudiu Lodromanean 2017-03-09 11:47:36 -08:00 committed by GitHub
commit 6b959e8625
2 changed files with 4 additions and 0 deletions

View File

@ -30,6 +30,7 @@ abstract class WC_Legacy_Coupon extends WC_Data {
'type',
'discount_type',
'amount',
'coupon_amount',
'code',
'individual_use',
'product_ids',
@ -82,6 +83,7 @@ abstract class WC_Legacy_Coupon extends WC_Data {
$value = $this->get_discount_type();
break;
case 'amount' :
case 'coupon_amount' :
$value = $this->get_amount();
break;
case 'code' :

View File

@ -39,6 +39,7 @@ class WC_Tests_Coupon_Data extends WC_Unit_Test_Case {
'type',
'discount_type',
'amount',
'coupon_amount',
'code',
'individual_use',
'product_ids',
@ -68,6 +69,7 @@ class WC_Tests_Coupon_Data extends WC_Unit_Test_Case {
$this->assertEquals( $coupon->get_discount_type(), $coupon->type );
$this->assertEquals( $coupon->get_discount_type(), $coupon->discount_type );
$this->assertEquals( $coupon->get_amount(), $coupon->amount );
$this->assertEquals( $coupon->get_amount(), $coupon->coupon_amount );
$this->assertEquals( $coupon->get_code(), $coupon->code );
$this->assertEquals( $coupon->get_individual_use(), ( 'yes' === $coupon->individual_use ? true : false ) );
$this->assertEquals( $coupon->get_product_ids(), $coupon->product_ids );