Updated customer REST API unit tests

This commit is contained in:
Claudio Sanches 2017-03-10 19:51:33 -03:00
parent 3fbb8415d6
commit 5b798332d2
1 changed files with 68 additions and 58 deletions

View File

@ -52,8 +52,10 @@ class Customers extends WC_REST_Unit_Test_Case {
$this->assertContains( array(
'id' => $customer_1->get_id(),
'date_created' => wc_rest_prepare_date_response( date( 'Y-m-d H:i:s', $customer_1->get_date_created() ) ),
'date_modified' => wc_rest_prepare_date_response( date( 'Y-m-d H:i:s', $customer_1->get_date_modified() ) ),
'date_created' => wc_rest_prepare_date_response( $customer_1->get_date_created(), false ),
'date_created_gmt' => wc_rest_prepare_date_response( $customer_1->get_date_created() ),
'date_modified' => wc_rest_prepare_date_response( $customer_1->get_date_modified(), false ),
'date_modified_gmt' => wc_rest_prepare_date_response( $customer_1->get_date_modified() ),
'email' => 'test@woo.local',
'first_name' => 'Justin',
'last_name' => '',
@ -136,7 +138,9 @@ class Customers extends WC_REST_Unit_Test_Case {
$this->assertEquals( array(
'id' => $data['id'],
'date_created' => $data['date_created'],
'date_created_gmt' => $data['date_created_gmt'],
'date_modified' => $data['date_modified'],
'date_modified_gmt' => $data['date_modified_gmt'],
'email' => 'create_customer_test@woo.local',
'first_name' => '',
'last_name' => '',
@ -197,7 +201,9 @@ class Customers extends WC_REST_Unit_Test_Case {
$this->assertEquals( array(
'id' => $data['id'],
'date_created' => $data['date_created'],
'date_created_gmt' => $data['date_created_gmt'],
'date_modified' => $data['date_modified'],
'date_modified_gmt' => $data['date_modified_gmt'],
'email' => 'create_customer_test2@woo.local',
'first_name' => 'Test',
'last_name' => 'McTestFace',
@ -278,7 +284,9 @@ class Customers extends WC_REST_Unit_Test_Case {
$this->assertEquals( array(
'id' => $data['id'],
'date_created' => $data['date_created'],
'date_created_gmt' => $data['date_created_gmt'],
'date_modified' => $data['date_modified'],
'date_modified_gmt' => $data['date_modified_gmt'],
'email' => 'get_customer_test@woo.local',
'first_name' => 'Justin',
'billing' => array(
@ -491,10 +499,12 @@ class Customers extends WC_REST_Unit_Test_Case {
$data = $response->get_data();
$properties = $data['schema']['properties'];
$this->assertEquals( 16, count( $properties ) );
$this->assertEquals( 18, count( $properties ) );
$this->assertArrayHasKey( 'id', $properties );
$this->assertArrayHasKey( 'date_created', $properties );
$this->assertArrayHasKey( 'date_created_gmt', $properties );
$this->assertArrayHasKey( 'date_modified', $properties );
$this->assertArrayHasKey( 'date_modified_gmt', $properties );
$this->assertArrayHasKey( 'email', $properties );
$this->assertArrayHasKey( 'first_name', $properties );
$this->assertArrayHasKey( 'last_name', $properties );