Customers::test_get_customer PHP Method

test_get_customer() public method

Test getting a single customer.
Since: 2.7.0
public test_get_customer ( )
    public function test_get_customer()
    {
        wp_set_current_user(1);
        $customer = WC_Helper_Customer::create_customer('get_customer_test', 'test123', '[email protected]');
        $response = $this->server->dispatch(new WP_REST_Request('GET', '/wc/v1/customers/' . $customer->get_id()));
        $data = $response->get_data();
        $this->assertEquals(array('id' => $data['id'], 'date_created' => $data['date_created'], 'date_modified' => $data['date_modified'], 'email' => '[email protected]', 'first_name' => 'Justin', 'billing' => array('first_name' => '', 'last_name' => '', 'company' => '', 'address_1' => '123 South Street', 'address_2' => 'Apt 1', 'city' => 'Philadelphia', 'state' => 'PA', 'postcode' => '19123', 'country' => 'US', 'email' => '', 'phone' => ''), 'shipping' => array('first_name' => '', 'last_name' => '', 'company' => '', 'address_1' => '123 South Street', 'address_2' => 'Apt 1', 'city' => 'Philadelphia', 'state' => 'PA', 'postcode' => '19123', 'country' => 'US'), 'is_paying_customer' => false, 'meta_data' => array(), 'last_name' => '', 'role' => 'customer', 'username' => 'get_customer_test', 'orders_count' => 0, 'total_spent' => '0.00', 'avatar_url' => $data['avatar_url']), $data);
    }