Updated schema tests to reflect latest changes.

This commit is contained in:
Peter Fabian 2019-01-11 15:27:24 +01:00
parent 26925872ec
commit bc68976fb7
1 changed files with 17 additions and 3 deletions

View File

@ -3,7 +3,10 @@
* Reports Orders Stats REST API Test
*
* @package WooCommerce\Tests\API
* @since 3.5.0
*/
/**
* WC_Tests_API_Reports_Orders_Stats
*/
class WC_Tests_API_Reports_Orders_Stats extends WC_REST_Unit_Test_Case {
@ -86,11 +89,17 @@ class WC_Tests_API_Reports_Orders_Stats extends WC_REST_Unit_Test_Case {
$this->assertArrayHasKey( 'intervals', $properties );
$totals = $properties['totals']['properties'];
$this->assertEquals( 4, count( $totals ) );
$this->assertEquals( 10, count( $totals ) );
$this->assertArrayHasKey( 'net_revenue', $totals );
$this->assertArrayHasKey( 'avg_order_value', $totals );
$this->assertArrayHasKey( 'orders_count', $totals );
$this->assertArrayHasKey( 'avg_items_per_order', $totals );
$this->assertArrayHasKey( 'num_items_sold', $totals );
$this->assertArrayHasKey( 'coupons', $totals );
$this->assertArrayHasKey( 'num_returning_customers', $totals );
$this->assertArrayHasKey( 'num_new_customers', $totals );
$this->assertArrayHasKey( 'products', $totals );
$this->assertArrayHasKey( 'segments', $totals );
$intervals = $properties['intervals']['items']['properties'];
$this->assertEquals( 6, count( $intervals ) );
@ -102,10 +111,15 @@ class WC_Tests_API_Reports_Orders_Stats extends WC_REST_Unit_Test_Case {
$this->assertArrayHasKey( 'subtotals', $intervals );
$subtotals = $properties['intervals']['items']['properties']['subtotals']['properties'];
$this->assertEquals( 4, count( $subtotals ) );
$this->assertEquals( 9, count( $subtotals ) );
$this->assertArrayHasKey( 'net_revenue', $totals );
$this->assertArrayHasKey( 'avg_order_value', $totals );
$this->assertArrayHasKey( 'orders_count', $totals );
$this->assertArrayHasKey( 'avg_items_per_order', $totals );
$this->assertArrayHasKey( 'num_items_sold', $totals );
$this->assertArrayHasKey( 'coupons', $totals );
$this->assertArrayHasKey( 'num_returning_customers', $totals );
$this->assertArrayHasKey( 'num_new_customers', $totals );
$this->assertArrayHasKey( 'segments', $totals );
}
}