<?php | |
/** | |
* Legacy Customers API Tests | |
* @package WooCommerce\Tests\API | |
*/ | |
class WC_Tests_API_Legacy_Customers extends WC_API_Unit_Test_Case { | |
/** @var WC_API_Customers instance */ | |
protected $endpoint; | |
/** | |
* Setup test customer data. | |
*/ | |
public function setUp() { | |
parent::setUp(); | |
$this->endpoint = WC()->api->WC_API_Customers; | |
} | |
/** | |
* Test GET customers filtering | |
*/ | |
public function test_filter_customer() { | |
global $wpdb; | |
wp_insert_user( array( | |
'user_email' => 'test_filter_customer_2@woo.local', | |
'user_login' => 'test_filter_customer_2', | |
'user_pass' => 'hunter2', | |
'user_registered' => '2016-01-01T12:12:12Z', | |
'role' => 'customer', | |
) ); | |
wp_insert_user( array( | |
'user_email' => 'test_filter_customer_1@woo.local', | |
'user_login' => 'test_filter_customer_1', | |
'user_pass' => 'hunter2', | |
'user_registered' => '2016-01-03T12:12:12Z', | |
'role' => 'customer', | |
) ); | |
$response = $this->endpoint->get_customers( null, array( 'created_at_min' => '2016-01-01 00:00:00', 'created_at_max' => '2016-01-01 23:59:59' ) ); | |
$this->assertEquals( 1, count( $response) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment