2016-03-08 21:44:28 +00:00
|
|
|
<?php
|
|
|
|
namespace WooCommerce\Tests\Customer;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class CustomerCRUD.
|
|
|
|
* @package WooCommerce\Tests\Customer
|
|
|
|
*/
|
|
|
|
class CustomerCRUD extends \WC_Unit_Test_Case {
|
|
|
|
|
2016-03-11 18:28:34 +00:00
|
|
|
/**
|
|
|
|
* Test creating a new customer.
|
|
|
|
* @since 2.7.0
|
|
|
|
*/
|
|
|
|
public function test_create_customer() {
|
|
|
|
$username = 'testusername-' . time();
|
|
|
|
$customer = new \WC_Customer();
|
|
|
|
$customer->set_username( 'testusername-' . time() );
|
|
|
|
$customer->set_password( 'test123' );
|
|
|
|
$customer->set_email( 'test@woo.local' );
|
|
|
|
$customer->save();
|
|
|
|
$wp_user = new \WP_User( $customer->get_id() );
|
|
|
|
|
|
|
|
$this->assertEquals( $username, $customer->get_username() );
|
|
|
|
$this->assertNotEquals( 0, $customer->get_id() );
|
|
|
|
$this->assertEquals( strtotime( $wp_user->user_registered ), $customer->get_date_created() );
|
|
|
|
}
|
|
|
|
|
2016-03-08 21:44:28 +00:00
|
|
|
}
|