示例#1
0
 /**
  * Test setting custom fields.
  * @since 2.7.0
  */
 public function test_set_custom_fields()
 {
     $coupon = WC_Helper_Coupon::create_coupon();
     $coupon_id = $coupon->get_id();
     $meta_value = time() . '-custom-value';
     $coupon->add_meta_data('my-custom-field', $meta_value, true);
     $coupon->save();
     $coupon = new WC_Coupon($coupon_id);
     $this->assertEquals($meta_value, $coupon->get_meta('my-custom-field'));
 }