File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class CouponStorage extends CommerceContentEntityStorage implements CouponStorag
1313 * {@inheritdoc}
1414 */
1515 public function loadByCode ($ code ) {
16- $ coupons = $ this ->loadByProperties (['code ' => $ code ]);
16+ $ coupons = $ this ->loadByProperties (['code ' => $ code, ' status ' => TRUE ]);
1717
1818 return reset ($ coupons );
1919 }
Original file line number Diff line number Diff line change @@ -66,6 +66,16 @@ public function testLoadByCode() {
6666
6767 $ coupon_loaded = $ this ->couponStorage ->loadByCode ($ coupon_code );
6868 $ this ->assertEquals ($ coupon ->id (), $ coupon_loaded ->id ());
69+
70+ $ coupon_code = $ this ->randomMachineName ();
71+ $ coupon = Coupon::create ([
72+ 'code ' => $ coupon_code ,
73+ 'status ' => FALSE ,
74+ ]);
75+ $ coupon ->save ();
76+
77+ $ coupon_loaded = $ this ->couponStorage ->loadByCode ($ coupon_code );
78+ $ this ->assertEmpty ($ coupon_loaded );
6979 }
7080
7181}
You can’t perform that action at this time.
0 commit comments