public function set_billing_email($value) { if ($value && !is_email($value)) { $this->error('order_invalid_billing_email', __('Invalid billing email address', 'woocommerce')); } $this->set_address_prop('email', 'billing', sanitize_email($value)); }
/** * Test: get_billing_email */ function test_get_billing_email() { $object = new WC_Order(); $set_to = '*****@*****.**'; $object->set_billing_email($set_to); $this->assertEquals($set_to, $object->get_billing_email()); $set_to = 'not an email'; $this->setExpectedException('WC_Data_Exception'); $object->set_billing_email($set_to); $this->assertEquals('*****@*****.**', $object->get_billing_email()); }