function test_invalid_coupon_construct() { // Shouldn't allow non-numeric ID. $coupon = new WPSC_Coupon('XXX'); $data = $coupon->get_data(); $this->assertEmpty($data); // Shouldn't allow negative ID. $coupon = new WPSC_Coupon(-1); $data = $coupon->get_data(); $this->assertEmpty($data); }
<script type='text/javascript'> jQuery(".pickdate").datepicker(); /* jQuery datepicker selector */ if (typeof jQuery('.pickdate').datepicker != "undefined") { jQuery('.pickdate').datepicker({ dateFormat: 'yy-mm-dd' }); } </script> <form name='edit_coupon' method="post" action="<?php echo admin_url('edit.php?post_type=wpsc-product&page=wpsc-edit-coupons'); ?> "> <table class="form-table"> <tbody> <?php do_action('wpsc_coupon_edit_top', $coupon->get('id'), $coupon->get_data()); ?> <tr class="form-field"> <th scope="row" valign="top"> <label for="edit_coupon_code"><?php _e('Coupon Code', 'wpsc'); ?> </label> </th> <td> <input name="edit_coupon_code" id="edit_coupon_code" type="text" value="<?php esc_attr_e($coupon->get('coupon_code')); ?> " style="width: 300px;"/> <p class="description"><?php