From bc68976fb7329072b158535f1714a3ea37dac77d Mon Sep 17 00:00:00 2001 From: Peter Fabian Date: Fri, 11 Jan 2019 15:27:24 +0100 Subject: [PATCH] Updated schema tests to reflect latest changes. --- .../tests/api/reports-orders-stats.php | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/plugins/woocommerce-admin/tests/api/reports-orders-stats.php b/plugins/woocommerce-admin/tests/api/reports-orders-stats.php index 61184061a40..a4b24bacfd1 100644 --- a/plugins/woocommerce-admin/tests/api/reports-orders-stats.php +++ b/plugins/woocommerce-admin/tests/api/reports-orders-stats.php @@ -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 ); } }