示例#1
0
 /**
  * Test reading a customer.
  * @since 2.7.0
  */
 public function test_read_customer()
 {
     $username = '******' . time();
     $customer = new WC_Customer();
     $customer->set_username($username);
     $customer->set_email('*****@*****.**');
     $customer->set_password('hunter2');
     $customer->set_first_name('Bob');
     $customer->set_last_name('Bob');
     $customer->create();
     $customer_id = $customer->get_id();
     $customer_read = new WC_Customer();
     $customer_read->read($customer_id);
     $this->assertEquals($customer_id, $customer_read->get_id());
     $this->assertEquals('*****@*****.**', $customer_read->get_email());
     $this->assertEquals('Bob', $customer_read->get_first_name());
     $this->assertEquals('Bob', $customer_read->get_last_name());
     $this->assertEquals($username, $customer_read->get_username());
 }