Commit Graph

382 Commits

Author SHA1 Message Date
Joshua Flowers 61492c5f10 Add import cancel tests 2019-04-30 10:17:09 -06:00
Jeff Stieler a3fdd72ba5 Merge pull request woocommerce/woocommerce-admin#1907 from woocommerce/fix/1615-order-number-filter
Support Sequential Order Numbers in Downloads Report order number filter
2019-04-30 10:10:39 -06:00
Jeff Stieler 4a85b012b5 Add tests for customer import using new parameters. 2019-04-30 09:46:14 -06:00
Jeff Stieler 3bfc53c9cf Reintroduce the customer lookup init to report regeneration.
With the new date range and “skip existing” logic.
2019-04-30 09:17:12 -06:00
Joshua T Flowers 53a4098de1 Fix missing leaderboard schema options (https://github.com/woocommerce/woocommerce-admin/pull/2059)
* Add missing schema properties

* Add missing leaderboard schema tests
2019-04-26 10:43:52 -07:00
Kelly Dwan 18bb29e35d Fix warnings in travis: CSS lint error & phpunit warning (https://github.com/woocommerce/woocommerce-admin/pull/2109)
* Fix stylelint issue

* Use WC_Helper_Order to create the order, which will correctly populate customer info
2019-04-25 10:22:57 -04:00
Joshua T Flowers c17baa02cd Encode and decode persited query as JSON string in the leaderboards controller (https://github.com/woocommerce/woocommerce-admin/pull/2100)
* Encode and decode persited query as JSON string in leaderboards controller

* Update peristed query tests to use JSON string
2019-04-24 04:38:49 +08:00
Joshua Flowers 7a41da3058 Bust cache for orders query in import tests 2019-04-12 16:50:43 +08:00
Joshua Flowers 5838e2ab48 Add import controller tests 2019-04-12 16:50:42 +08:00
Joshua T Flowers e31be343e2 Make customer name extendable (https://github.com/woocommerce/woocommerce-admin/pull/1976)
* Make customer name extendable

* Update get_customer_name to favor user profile information

* Update customer name on profile update

* Add tests around customer name getting and setting

* Prefix customer name filter with woocommerce_reports_
2019-04-09 11:39:39 +08:00
Joshua T Flowers f682fe76be Add leaderboard controller and endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1995)
* Add leaderboard controller and endpoint

* Add existing leaderboard stats to leaderboard endpoint

* Add persisted query to leaderboard params

* Add leaderboard endpoint tests

* Check if extended_info params are set before assigning

* Change number param input format to mixed inside wc_admin_number_format
2019-04-09 11:34:56 +08:00
Joshua T Flowers 753780bf7b Onboarding: Add levels REST API (https://github.com/woocommerce/woocommerce-admin/pull/1938)
* Add levels rest controller

* Add default levels

* Add onboarding level API tests

* Drop all since tags

* Make pre-response levels array associative for easier formatting

* Fix level tests for associative array
2019-04-05 10:35:30 +08:00
Ron Rennick b384571afe Merge pull request woocommerce/woocommerce-admin#1984 from woocommerce/phpcs/tests
phpcs fixes class-wc-tests-reports-orders-stats.php
2019-04-03 10:21:38 -03:00
Joshua T Flowers 0c5c1c3db4 Remove coupon_total from order stats table (https://github.com/woocommerce/woocommerce-admin/pull/1975)
* Remove coupons_total from order stats table

* Replace discount amount with coupon objects in stat tests
2019-04-03 09:37:17 +08:00
Ron Rennick 26b5ba2b89 phpcs fixes class-wc-tests-reports-orders-stats.php 2019-04-02 16:22:55 -03:00
Joshua T Flowers 9c3faea12f Refactor notes controller and add ordering params (https://github.com/woocommerce/woocommerce-admin/pull/1878)
* Separate notes controller request args and add collection params

* Fix page param var

* Fix collection params sanitization

* Allow array of note types to be queried

* Add order and orderby collection params to notes controller

* Allow sorting by order and orderby params in notes data store

* Make sure notes are ordered by date and unread matches inbox note types

* Allow status or type params to use an array of items

* Add tests for notes ordering

* Remove unnecessary query arg assignment in the notes data store

* Update get_notes_count to use array for status and type
2019-04-01 10:53:34 +08:00
Joshua T Flowers 42ddfc0108 Add coupons count to data store and hook up to summary numbers in orders report (https://github.com/woocommerce/woocommerce-admin/pull/1912)
* Change coupons sum to distinct coupon count in REST API

* Hook up unique coupon count to orders summary numbers

* Add coupons count to order segmenting

* Add coupons count to expected stats in order test and revenue tests
2019-04-01 10:16:57 +08:00
Jeff Stieler 164a55b0d2 Allow strings in downloads report order number filter. 2019-03-26 16:04:36 -06:00
Jeff Stieler 7742a7d65e Add test coverage for “unsnoozing” notes. 2019-03-20 08:52:27 -06:00
Jeff Stieler 2a08ba20e8 Add a snoozed note to test data. 2019-03-20 08:52:27 -06:00
Albert Juhé Lluveras e6cf40e3f0 Allow sorting by tax_code in Taxes report (https://github.com/woocommerce/woocommerce-admin/pull/1812) 2019-03-15 21:44:03 +01:00
Jeff Stieler bfe5a75e98 Update text domain. (https://github.com/woocommerce/woocommerce-admin/pull/1795)
* Translation call text domain change from “wc-admin” to “woocommerce-admin”.

* Fix .pot file generation.

* Fix errantly closed array item in /revenue/stats controller.

* Rename plugin zip, main file, and repo name to "woocommerce-admin".
2019-03-13 11:14:02 -06:00
Justin Shreve 1348245406 Add store notice around processing historical data. (https://github.com/woocommerce/woocommerce-admin/pull/1763)
* Add store notice around processing historical data.

* Cleanup

* Handle PR feedback.

* Clean up `add` logic and add empty content_data. Also add logic to get_notes_count so that we can hide unactioned statuses.

* Add the ability to update a note, and to also mark a status when an alert is clicked.

* Remove mark_actioned call on sync

* add missing todo
2019-03-12 09:13:20 -04:00
Albert Juhé Lluveras 6c9b96f49a Make variations and coupons endpoints return zero-value items (https://github.com/woocommerce/woocommerce-admin/pull/1765)
* Make categories endpoint return zero-value items

* Rename PHP variable to make it more specific

* Remove uneeded lines

* Make variations and coupons endpoints return zero-value items

* Remove second parameter from get_ids_table
2019-03-12 11:11:28 +01:00
Albert Juhé Lluveras d3230d8dae Make categories endpoint return zero-value items (https://github.com/woocommerce/woocommerce-admin/pull/1755)
* Make categories endpoint return zero-value items

* Rename PHP variable to make it more specific

* Remove uneeded lines

* Remove second parameter from get_ids_table
2019-03-12 10:50:53 +01:00
Albert Juhé Lluveras cf162dda7f Taxes report: sort tax rates numerically instead of alphabetically (https://github.com/woocommerce/woocommerce-admin/pull/1766)
* Taxes report: sort tax rates numerically instead of alphabetically

* Use DECIMAL(7,4) for tax_rate sorting
2019-03-12 10:31:19 +01:00
Jeff Stieler a50a9bccb1 Ensure that other scheduled actions are claimed before WC Admin actions. (https://github.com/woocommerce/woocommerce-admin/pull/1759)
* Use menu_order to lower the claim priority of WC Admin scheduled actions.

* Use a ActionScheduler_Store subclass to modify menu_order.

* Check to make sure we’re overriding only AS’s built in WP Post data store.
2019-03-08 11:59:32 -07:00
Albert Juhé Lluveras d2c0dd5555 Make products and rates endpoints return zero-value items (https://github.com/woocommerce/woocommerce-admin/pull/1722)
* Make products endpoint return zero-value items

* Make rates endpoint return zero-value items

* Several fixes

* Add tests

* Simplify code

* Merge both queries into one to simplify code

* Rename 'get_outer_from_sql_params' to 'get_from_sql_params'
2019-03-06 12:36:43 +01:00
Peter Fabian 99e88706ad Merge pull request woocommerce/woocommerce-admin#1681 from woocommerce/fix/1476-2
Updated is_returning_customer definition to use refactored function.
2019-03-05 13:00:07 +01:00
Justin Shreve fce16ade7a Display order number on reports (https://github.com/woocommerce/woocommerce-admin/pull/1706)
* Display order number on reports, and add to API response.

* Add method for getting order number, avoiding loading the data store if no filter is attached.
2019-02-28 09:14:21 -05:00
Ron Rennick 6969f841fa update unit tests for batch group 2019-02-25 09:34:59 -04:00
Peter Fabian 43e49ca704 Added test for registered customer. 2019-02-23 00:03:53 +01:00
Peter Fabian 4668734af7 Removed debugging var from test. 2019-02-23 00:02:40 +01:00
Peter Fabian 3ce686e6cd Updated is_returning_customer definition to use refactored function. 2019-02-22 22:06:21 +01:00
Joshua T Flowers aef11ef586 Refactor customer ID creation (https://github.com/woocommerce/woocommerce-admin/pull/1619)
* Fix indendtation for table creations

* Refactor how customers are created on order update

* Check if user has a role of customer or previous orders before storing

* Add tests for user creation

* Allow null emails for customers

* Only select customer_id in guest ID query
2019-02-20 10:30:00 +08:00
Joshua T Flowers 44604bcd02 Reduce net order total by refunded amount less tax and shipping refunds (https://github.com/woocommerce/woocommerce-admin/pull/1600)
* Reduce net order total by refunded amount less tax and shipping refunds

* Fix net_totals in tests with refunds
2019-02-20 09:39:42 +08:00
Justin Shreve 4f64358c8e Fix customer filters and download user filtering (https://github.com/woocommerce/woocommerce-admin/pull/1618)
* Add the ability to search name, username, and email fields on the customer endpoint, update autocompletors, add in include parameter.

* Update the username to be returned in the download response, update download filtering based on customer id, and only rename include parameter on main customers endpoint.
2019-02-19 14:35:29 -05:00
Joshua T Flowers f0ec3c49a1 Add tax refund calculations (https://github.com/woocommerce/woocommerce-admin/pull/1556)
* Add item and shipping refund calucations to taxes on order update

* Sync taxes on refund delete

* Fix up tax stats API testing

* Add refunds to tax stats API tests
2019-02-18 10:20:16 +08:00
Ron Rennick e2b220bb54 Merge pull request woocommerce/woocommerce-admin#1570 from woocommerce/phpcs/tests
Phpcs sniff fixes for unit tests
2019-02-15 14:50:50 -04:00
Peter Fabian f7d0d2379f Merge branch 'master' into fix/489-date_date_gmt
# Conflicts:
#	includes/class-wc-admin-api-init.php
2019-02-15 17:07:38 +01:00
Joshua T Flowers cba9ab61b2 Update returning customer values to respect excluded statuses (https://github.com/woocommerce/woocommerce-admin/pull/1557)
* Excluded statuses from customers oldest orders

* Fix tests for returning customer where excluded statuses are used

* Remove save_post hook used for testing

* Extract conditions for first order swapping
2019-02-15 10:09:16 +08:00
Ron Rennick 767b047f4b phpcs for admin-notess.php 2019-02-14 19:20:47 -04:00
Ron Rennick 45acf57c22 phpcs for product-reviews.php 2019-02-14 19:19:22 -04:00
Ron Rennick 7a255d7490 phpcs for products.php 2019-02-14 19:18:34 -04:00
Ron Rennick b69f8fdbf2 phpcs for reports-customers-stats.php 2019-02-14 19:17:05 -04:00
Ron Rennick e91f7f6d00 phpcs for reports-customers.php 2019-02-14 19:14:43 -04:00
Ron Rennick cd1fdef99d phpcs for reports-download-stats.php 2019-02-14 19:13:18 -04:00
Ron Rennick a89083077e phpcs for reports-interval.php 2019-02-14 19:12:15 -04:00
Ron Rennick db568ec9af phpcs for report-order-stats.php 2019-02-14 19:11:17 -04:00
Ron Rennick ece6fb1a91 phpcs for report-performance-indicators.php 2019-02-14 19:08:25 -04:00
Ron Rennick 8ce7af9f61 phpcs for report-stock-stats.php 2019-02-14 19:06:11 -04:00
Ron Rennick 7910e76d8c phpcs for bootstrap.php 2019-02-14 19:04:30 -04:00
Ron Rennick 58cfde18a4 phpcs print_R use in class-wc-tests-reports-order-stats.php 2019-02-14 18:54:45 -04:00
Ron Rennick 12c42c7967 phpcs for class-wc-tests-reports-orders-stats.php except print_r 2019-02-14 17:14:52 -04:00
Ron Rennick 16c5cf8c77 phpcs for class-wc-tests-reports-revenue-stats.php 2019-02-14 16:34:38 -04:00
Justin Shreve 24301e0090 Add stock stats endpoint and hook up to the stock report. (https://github.com/woocommerce/woocommerce-admin/pull/1535)
* Add stock stats endpoint and hook up to the stock report.

* Handle PR feedback
2019-02-13 22:31:27 -05:00
Joshua T Flowers 746d062f09 Check and update customer first orders to fix returning_customers (https://github.com/woocommerce/woocommerce-admin/pull/1517)
* Add get_oldest_orders function to customer data store

* Check if is first order in is_returning_customer()

* Check if the customers first order has changed and update all orders respectively

* Fix check for empty oldest_orders array

* Change avg_items_per_order to number instead of integer

* Fix failing tests for new/returning customers

Only the first orders with product 1 and without coupons should be new per each customer

* Remove sleep functions from tests

* Assign second order to a variable for legibility

* Fix second order assignment and check if set
2019-02-14 11:14:01 +08:00
Jeff Stieler c862de29d3 Merge pull request woocommerce/woocommerce-admin#1534 from woocommerce/fix/1455-customers-report-name-search
Hook up customers report table search box
2019-02-13 13:55:47 -08:00
Jeff Stieler 73c430b9b8 Merge pull request woocommerce/woocommerce-admin#1510 from woocommerce/fix/532-wc-install-approach
Use a WC_Install-like approach to initialize WC Admin data
2019-02-12 13:05:48 -08:00
Justin Shreve 60d364d329 Update 5.0.0 version check and add basic readme.txt (https://github.com/woocommerce/woocommerce-admin/pull/1521)
* Update version check, add basic WP.org readme

* Clean up test depedency since we are supporting 5.0.0 or greater

* add some additional keywords

* update greater than message
2019-02-12 15:22:16 -05:00
Justin Shreve 0fe061b97d Add Feature Flags (https://github.com/woocommerce/woocommerce-admin/pull/1500)
* First pass at adding feature flags. Accessible over PHP and JS.

* Hook up dev config to test enviornments, hook up features to their flags.

* Cleanup some code and add documentation. Remove beta config.

* Handle PR Feedback: Add devdocs flag, remove categories flag, fix auto-generated PHP warning.

* Add todo for beta phase.

* Handle PR feedback: Simplify is_array check, update build command, simplify test mock, remove empty webpack line.
2019-02-12 15:02:02 -05:00
Jeff Stieler e36d25e112 Make customer object IDs compatible with `wc-api`/`fresh-data`. 2019-02-12 11:08:03 -08:00
Jeff Stieler 926fdcfb97 Hook `v4/customers` endpoint up to customers report/lookup table and change name search to be fuzzy. 2019-02-12 11:06:22 -08:00
Peter Fabian a6761fc606 Merge branch 'master' into fix/489-date_date_gmt 2019-02-10 17:24:54 +01:00
Jeff Stieler 884825f325 Fix method calls in test suite (functions moved classes). 2019-02-08 13:19:20 -08:00
Peter Fabian 5fbf5b62d7 Normalize datetimes before doing any further processing with the input from the user.
Also, passing DateTime objects around instead of string so that timezone info can be easily attached to it.
2019-02-08 18:11:04 +01:00
Claudio Sanches ec43d58973 Fixed WordPress database error in unit tests
Fixes the follow error:

```
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'THIS WONT MATCH' at line 1]
```

Fixes woocommerce/woocommerce-admin#1489
2019-02-07 19:48:16 -02:00
Albert Juhé Lluveras e2b10bdb49 Fix test_variable_product_extended_info (https://github.com/woocommerce/woocommerce-admin/pull/1498) 2019-02-07 10:49:50 +01:00
Joshua T Flowers 8c3973a445 Add manage_stock to stock controller response (https://github.com/woocommerce/woocommerce-admin/pull/1475)
* Add manage_stock to stock controller response

* Add manage_stock property to stock report tests

* Add changelog entry

* Make stock quantity float instead of int

* Add manage_stock to the products API response

* Check for manage_stock in products table

* Add manage_stock property to product API tests
2019-02-07 16:29:01 +08:00
Albert Juhé Lluveras 79738b2022 Add 'variations' attribute in products 'extended_info' (https://github.com/woocommerce/woocommerce-admin/pull/1478)
* Add 'variations' attribute in products 'extended_info'

* Add tests
2019-02-07 09:27:02 +01:00
Joshua T Flowers 2b0c8089c0 Try: Fix failing returning customer test (https://github.com/woocommerce/woocommerce-admin/pull/1496)
* Don't check against same order when checking for returning customer

* Sleep between order creation

* Add todo removal comments for sleep functions
2019-02-07 15:49:56 +08:00
Peter Fabian 79e22bcefd Switched to creating orders from oldest to newest, not the other way around. (https://github.com/woocommerce/woocommerce-admin/pull/1495)
That should hopefully take care of the problem with strange new/returning customer values and failing tests.
2019-02-07 15:41:09 +08:00
Joshua T Flowers b7379def1b Format todo comments to match WC Core format (https://github.com/woocommerce/woocommerce-admin/pull/1474)
* Format todo comments to match WC Core format

* Remove variations todo comment
2019-02-06 14:41:53 +08:00
Claudio Sanches b7c40c2c29 Merge pull request woocommerce/woocommerce-admin#1461 from woocommerce/fix/1460
Fixed database prefixes for admin notes tables
2019-02-05 16:21:43 -02:00
Claudio Sanches d26e82b526 Merge branch 'master' into fix/1307 2019-02-05 16:20:08 -02:00
Claudio Sanches 86c3c00480 Clean tables when order is deleted 2019-02-05 16:15:39 -02:00
Justin Shreve 949afce248 Add Product Detail Report & Finish Comparison Chart Mode Functionality (https://github.com/woocommerce/woocommerce-admin/pull/1391)
Product detail report and comparison

Code cleanup

Fix 404 on product variations endpoint after rebase

Fix up tests

Fix loading indicators and add some checks around malformed variation response

Add date filtering SQL bits to the variations query

Handle PR feedback: Fix viewport, fix duplicate product issue, fix legend display reset, fix bargraph overflow, fix some coding standards/whitespace, add extra variation santiziation.

Fix scroll on wide charts, and fix undefined prop getting passed into report chart render
2019-02-05 13:12:58 -05:00
Claudio Sanches 10f40d4cf3 Merge branch 'master' into fix/1307 2019-02-05 15:48:59 -02:00
Peter Fabian 98e91966d5 Updated tests for code in master:
- added segment arrays and
- forced sync before running asserts.
2019-02-05 18:46:42 +01:00
Peter Fabian b69d2aa2ab Merge branch 'master' into fix/1012-2
# Conflicts:
#	tests/reports/class-wc-tests-reports-orders-stats.php
2019-02-05 18:34:15 +01:00
Jeff Stieler 7664612b57 Fix order stats report status filtering test case (returning customer value incorrect). 2019-02-04 16:59:08 -07:00
Jeff Stieler f938dd5708 Invoke queue test helper in new Order Stats and Products Report tests. 2019-02-04 11:46:46 -07:00
Jeff Stieler bebe1bdead Add test for scheduling a retry job when order syncing fails. 2019-02-04 09:18:51 -07:00
Jeff Stieler 21572698d8 Fix unit tests that rely on queued data updates. 2019-02-04 09:18:50 -07:00
Jeff Stieler 9b1f6999aa Add action argument support when scheduling dependent actions. 2019-02-04 09:06:44 -07:00
Joshua T Flowers 0d4e42def0 Add segments to expected response in order stats (https://github.com/woocommerce/woocommerce-admin/pull/1466) 2019-02-04 18:39:33 +08:00
Joshua T Flowers 17179d41ff Add order status tests and refund tests (https://github.com/woocommerce/woocommerce-admin/pull/1443)
* Add default order status tests

* Test querying an excluded status

* Add tests for product line item refunds

* Update status test method comment

* Drop @since versioning from doc blocks
2019-02-04 10:52:29 +08:00
Claudio Sanches c1bb5802d1 Fixed coding standards 2019-02-01 18:48:54 -02:00
Claudio Sanches 31e8dc9332 Merge branch 'master' into fix/1307 2019-02-01 18:24:26 -02:00
Peter Fabian 32f851be5b Merge pull request woocommerce/woocommerce-admin#1286 from woocommerce/fix/1035
Added segmenting support to REST API
2019-02-01 20:50:38 +01:00
Claudio Sanches 4c71e78222 Fixed database prefixes
Moved from woocommerce_ to wc_
2019-02-01 17:23:07 -02:00
Peter Fabian 2bc99cdb31 Added basic tests for zero filling when sorting intervals by non-date property. 2019-02-01 18:16:39 +01:00
Peter Fabian c2bcad2e50 Merge branch 'master' into fix/1012-2 2019-02-01 13:32:35 +01:00
Joshua T Flowers e65247c54e Add SKU to product variations table (https://github.com/woocommerce/woocommerce-admin/pull/1422)
* Add SKU to product variations data store extended info

* Show SKU in product variations table

* Add sku tests for product variation reports
2019-01-31 09:27:15 +08:00
Peter Fabian e433609d9d Updated test of schema for taxes/stats. 2019-01-30 18:46:06 +01:00
Claudio Sanches d1fef77ed0 Added unit tests for order deletation 2019-01-29 20:21:09 -02:00
Paul Sealock 4854933485 Merge pull request woocommerce/woocommerce-admin#1404 from woocommerce/fix/customers-date-between-args
Customers Report: REST API: Fix between argument handling
2019-01-30 10:32:54 +13:00
Timmy Crawford 10c6016d4c Update usage of lib/number to @woocommerce/number (https://github.com/woocommerce/woocommerce-admin/pull/1400)
* Remove usage of lib/number

* Remove formatNumber usage when currency is used.

* Add wc-number as a dependency of wc-currency.

* Add locutus as a dev dependency.

* Add number to test helper.
2019-01-29 08:48:46 -08:00
Peter Fabian e4e09b4c39 Merge branch 'master' into fix/1035 2019-01-29 10:01:41 +01:00
Paul Sealock 3e16a37be0 add tests 2019-01-29 11:01:25 +13:00
Paul Sealock 483c199fbf tests working 2019-01-29 10:53:56 +13:00
Paul Sealock 2f022ffdba dry interval.php 2019-01-29 10:23:44 +13:00
Paul Sealock 3d0890a704 basic working 2019-01-29 09:21:11 +13:00
Paul Sealock bca0785e64 Customers Report: support between args for dates 2019-01-29 08:58:07 +13:00
Jeff Stieler 7592dae4bb Merge pull request woocommerce/woocommerce-admin#1385 from woocommerce/add/customers-report-table-summary
Add table summary to Customers Report
2019-01-28 09:59:52 -07:00
Jeff Stieler 2703a0da4c Merge pull request woocommerce/woocommerce-admin#1370 from woocommerce/fix/942-phpunit-gutenberg-dependency
Conditionally include Gutenberg plugin in test suite
2019-01-28 09:59:13 -07:00
Peter Fabian 05aedb2a63 Added tests for ASC ordering. 2019-01-25 17:40:33 +01:00
Jeff Stieler 8207bd7649 Add tests for customers report stats endpoint. 2019-01-23 17:48:22 -07:00
Jeff Stieler 4cfa082d0f Load gutenberg from test plugins directory if required. 2019-01-23 16:59:10 -07:00
Peter Fabian c96b291a6c Added a bit of test for interval=hour order_by=date desc. 2019-01-23 22:13:00 +01:00
Peter Fabian d61a4dd5bd Updated tests to be more stable around hour end. 2019-01-25 00:06:59 +01:00
Peter Fabian 71a9be299a Updated tests to pass before implementing the updated new/returning customer definition.
Context: https://github.com/woocommerce/wc-admin/issues/558#issuecomment-447782060
2019-01-23 13:29:40 +01:00
Peter Fabian 83a0d96f68 Added segmenting to response for revenue/stats test. 2019-01-23 10:37:09 +01:00
Peter Fabian e432a17f1e Added segmenting to response for products/stats test. 2019-01-23 10:36:50 +01:00
Peter Fabian f190c1bad1 Fixed copy-paste bug for testing subtotals in REST response. 2019-01-23 10:36:27 +01:00
Peter Fabian bcb7513f34 Added segmenting to response for coupons/stats test.
Fixed copy-paste error in test for subtotals.
2019-01-23 10:35:48 +01:00
Peter Fabian fed94cbd0c Added segmenting to response for coupons/stats test.
Changed return type for currency.
2019-01-23 10:34:07 +01:00
Peter Fabian 507ee13825 Merge branch 'master' into fix/1035
# Conflicts:
#	client/analytics/report/customers/table.js
#	includes/api/class-wc-admin-rest-reports-orders-stats-controller.php
#	tests/reports/class-wc-tests-reports-orders-stats.php
2019-01-23 10:13:55 +01:00
Jeff Stieler 2d4aea1971 Only install/activate Gutenberg plugin if WP version under test is earlier than 5.0. 2019-01-22 10:44:00 -07:00
Peter Fabian 8a9a2c0673 Fixed interval arithmetic for hours and days. 2019-01-22 17:49:02 +01:00
Justin Shreve 1f8caf106e Fix performance-indicators/allowed schema. 2019-01-21 12:28:32 -05:00
Justin Shreve 01b96ebea5 Hook up performance indicators to the REST API 2019-01-18 08:19:19 -05:00
Justin Shreve 96fc10747f Add label and generated report URL to the performance indicator response. 2019-01-18 08:16:52 -05:00
Joshua T Flowers 7cdbbf87e8 Update all wc-admin endpoints to v4 (https://github.com/woocommerce/woocommerce-admin/pull/1298)
* Update all wc-admin endpoints to v4

* Add namespace for products and customers controllers

* Include product quantity in orders data store

* Add coupons to extended data in the orders data store

* Format order statuses response from database

* Hook up orders table to orders endpoint

* Add namespace to data endpoint controller

* Add namespaces to remaining extended controllers

* Use NAMESPACE var in place of wc/v4

* Update product links in orders table to products reports

* Add coupons rest controller override

* Format coupon code in response

Co-Authored-By: joshuatf <joshuatf@gmail.com>
2019-01-18 10:52:58 +08:00
Jeff Stieler 4407e05bc4 Merge pull request woocommerce/woocommerce-admin#1342 from woocommerce/fix/1090-currency-settings-formatting
Honor WooCommerce Settings When Formatting Currency/Price
2019-01-17 17:06:13 -07:00
Jeff Stieler 6ed8ea117a Refactor formatCurrency() to use store settings for formatting rather than store locale. 2019-01-17 00:04:57 -07:00
Joshua T Flowers da22cbdc9d Update returning customer data to use customer ID (https://github.com/woocommerce/woocommerce-admin/pull/1180)
* Change check for returning customers to check customer_id

* Count distinct returning and new customers in totals

* Fix priority action misplacement and order date timestamp

* Change expected num returning/new customers to fix failing tests

Previously these included references to number of returning vs new orders.  Update to refer to the newly updated customer count.

* Use new get_customer_id_by_user_id() to get customer ID

* Fix 0 returning customers expectation

* Move returning customer function to order stats data store

* Sync order stats on order delete

* Change date compare for is_returning_customer

* Add test case for returning customer order

* Add references to  instead of 2
2019-01-17 10:47:30 +08:00
Jeff Stieler c0e6a097fd Fix orders report test. 2019-01-16 09:45:52 -07:00
Jeff Stieler 5c6174066e Add tests for report regeneration batch queuing methods. 2019-01-16 09:45:04 -07:00
Jeff Stieler 1a5af7094d Add WC_Action_Queue test helper class.
The test helper allows inspection of the action queue.
2019-01-16 09:45:04 -07:00
Jeff Stieler 4786938bdf Fix customers report tests. 2019-01-16 09:45:03 -07:00
Peter Fabian 05c7670090 Merge branch 'master' into fix/1035
# Conflicts:
#	includes/class-wc-admin-reports-interval.php
#	includes/data-stores/class-wc-admin-reports-data-store.php
#	includes/data-stores/class-wc-admin-reports-products-data-store.php
2019-01-16 12:51:23 +01:00
Joshua T Flowers 33a7cfa1b0 Store all order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1285)
* Store all orders regardless of status in wc_order_stats

* Only query select statuses if status_is or status_is_not is not set

* Fix order stats example query

* Filter category store by default order statuses

* Add table_name to interval functions to avoid ambiguity

* Filter coupon store by default order statuses

* Fix interval stats by adding table_name to interval function

* Filter products store by default order statuses

* Remove unused order_status in coupons data store

* Store products with any order status

* Fix ambiguous order by call in products data store

* Apply status filter after other filters to avoid logical OR matching

* Store all coupon data regardless of order status

* Filter taxes by default order statuses

* Filter customer stats by default order status

* Filter default order statuses in variations data store

* Use excluded statuses to filter reports by default

* DRY up default excluded statuses query

* Fix up new orders data store after rebase
2019-01-16 10:23:00 +08:00
Peter Fabian 29f07f8c57 Re-enable temporarily disabled tests. 2019-01-15 11:51:43 +01:00
Peter Fabian 5ba443fca8 Updated data store used in test to reflect the rename of class. 2019-01-15 11:50:53 +01:00
Peter Fabian c324157483 Merge branch 'master' into fix/1035
# Conflicts:
#	includes/data-stores/class-wc-admin-reports-orders-data-store.php
#	includes/data-stores/class-wc-admin-reports-orders-stats-data-store.php
2019-01-15 11:39:39 +01:00
Peter Fabian f84efa3a58 Added test for segmenting /orders/stats by product. 2019-01-15 11:16:31 +01:00
Joshua T Flowers 14f8f08edf Add v4 orders endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1246)
* Rename orders controllers and data store to order stats

* Add orders data store and controller

* Add coupon, product, and status filters

* Add customer type query filter

* Add extended info for products and categories

* Bump API namespace to v4

* Add missing schema properties

* Set default customer_type and extended_info params

* Add orders endpoint tests

* Only use one JOIN if both excluded and included queries are used

* Optimize query calls to get product and category data

* Split product and category fetch and limit to product_cat taxonomy
2019-01-15 09:53:02 +08:00
Peter Fabian 20090a90e4 Added segments property to revenue test. 2019-01-11 18:39:57 +01:00
Peter Fabian 8059251656 Updated type for products field in response. 2019-01-11 15:29:03 +01:00
Peter Fabian ab4eb674e2 Added segments fields to expected response in tests. 2019-01-11 15:28:28 +01:00
Peter Fabian bc68976fb7 Updated schema tests to reflect latest changes. 2019-01-11 15:27:24 +01:00
Jeff Stieler adf8bbeb23 Merge pull request woocommerce/woocommerce-admin#1260 from woocommerce/fix/1239-handle-between-rest-api-param
Handle *_between params in Reports controllers
2019-01-10 10:52:08 -07:00
Jeff Stieler 2246a1e075 Expect array value for _between params.
Add param validation method and normalize to min/max based by comparing values.
2019-01-09 14:19:37 -07:00
Justin Shreve d46ce1df7a Add store performance indicator endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1255)
* Add store performance REST API endpoint

* Clean up validation, add list of allowed stats to OPTIONS endpoint, and rename endpoint to performance-indicators

* Add tests

* Add additional filters to make extending the performance indiciators area easier.

* Add docblocks for filters
2019-01-09 16:08:39 -05:00
Jeff Stieler b15a4bc804 Add utility method to normalize numeric “between” parameters in REST API requests. 2019-01-08 17:41:24 -07:00
Jeff Stieler d42e04cd59 Short circuit registered customer data update when the given ID is bad. 2019-01-08 10:29:44 -07:00
Jeff Stieler d000d3e42a Add cases using ‘name’ and a date parameter to customers report endpoint tests. 2019-01-08 10:29:42 -07:00
Jeff Stieler 737331dd3b Add missing _gmt date fields to customers report response items. 2019-01-08 10:29:41 -07:00
Jeff Stieler 1a4b890660 Add unit tests for customers report endpoint. 2019-01-08 10:29:41 -07:00
Justin Shreve f37b9319e1 Download Report API: Add path to response, fix ordering, and fix schema typo (https://github.com/woocommerce/woocommerce-admin/pull/1248)
* Add download_path to download report endpoint and fix schema typo

* Fix ordering and add tests
2019-01-08 09:51:28 -05:00
Justin Shreve e3e9ccb6a4 Add `reports/downloads/stats` REST API Endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1142)
* First pass at downloads REST API

* Add reports/downloads/stats endpoint.

* Add tests

* Update cache key
2019-01-03 13:00:48 -05:00
Joshua T Flowers 7bbdd78bde Add missing intervals to product reports (https://github.com/woocommerce/woocommerce-admin/pull/1200)
* Add missing intervals to product reports

* Fix failing tests for product stats API

Before and after query should be within today's date since missing intervals for other days will be filled in with remaining dates.
2018-12-31 13:20:22 +08:00
Joshua T Flowers 268182e75f Add invalid note ID test (https://github.com/woocommerce/woocommerce-admin/pull/1197) 2018-12-28 09:44:53 -08:00
Peter Fabian 48dfb54a48 Switched average order value from gross to net revenue (https://github.com/woocommerce/woocommerce-admin/pull/1158)
* Switched Average order value calculation from gross to net revenue.

* Updated tests to reflect switch of average order value from gross to net revenue.
2018-12-26 15:49:46 -08:00
Joshua T Flowers dcaa35c7bf Add product SKU to products report (https://github.com/woocommerce/woocommerce-admin/pull/1161)
* Add product SKU to products report

* Add tests for SKU data
2018-12-25 11:02:06 +08:00
Justin Shreve 579113910d Add remaining filters to the downloads report (https://github.com/woocommerce/woocommerce-admin/pull/1141)
* Add order number, username, and IP address filters to the downloads report.

* Adds tests
2018-12-21 16:40:41 -08:00
Justin Shreve 49a0f0f6d2 Add `reports/downloads` REST API endpoint. (https://github.com/woocommerce/woocommerce-admin/pull/1122)
* First pass at downloads REST API

* Handle PR feedback
2018-12-21 14:57:46 -08:00
Joshua T Flowers f83b0e0615 Add product categories wc-api and breadcrumbs (https://github.com/woocommerce/woocommerce-admin/pull/1131)
* Add support for product cats in wp rest api

* Add categories to WC API

* Add category breadcrumbs component

* Increase per_page limit size for product cat API

* Use wc/v3 API to pull product categories

* Return category IDs in API

* Add categories to product reports

* Add category IDs test for REST API

* Switch to getResource instead of require for total count selector
2018-12-21 10:44:27 +08:00
Peter Fabian dff8b63271 Merge pull request woocommerce/woocommerce-admin#1010 from woocommerce/fix/845
Added /reports/coupons and /reports/coupons/stats endpoints
2018-12-19 13:55:28 +01:00
Peter Fabian 4802736a0e Switched from using coupon code filter to coupon id filter by query parameter. 2018-12-19 13:37:54 +01:00
Joshua T Flowers 08d3e2c38d Change product_gross_revenue to product_net_revenue (https://github.com/woocommerce/woocommerce-admin/pull/1105)
* Change product_gross_revenue to product_net_revenue

* Change product_gross_revenue to product_net_revenue in category data store

* Change to net_revenue in frontend category report
2018-12-19 08:56:27 +08:00
Jeff Stieler 9581a658f5 Add expected locale settings to JS test setup. 2018-12-18 15:46:46 -07:00
Paul Sealock 15bbbe739d Hook up Categories table to endpoint 2018-12-19 08:36:42 +13:00
Peter Fabian 6c456657e8 Changed coupon_gross_discount to amount. 2018-12-18 12:01:42 +08:00
Peter Fabian db8004aaf7 PHPCS fixes. 2018-12-18 12:01:41 +08:00
Peter Fabian 28f6f7ece5 PHPCS changes so that I will be able to merge master into this branch.
Otherwise I get errors during merge commit.
2018-12-18 12:01:41 +08:00
Peter Fabian 46bf4bedc8 Added basic tests for coupons and coupons/stats. 2018-12-18 12:01:40 +08:00
Peter Fabian 6950522f91 Removed timezone info that was added incorrectly 2018-12-18 12:01:39 +08:00
Joshua T Flowers 9486ab7896 Update/taxes endpoint hookup/941 (https://github.com/woocommerce/woocommerce-admin/pull/1008)
* Hook up taxes to endpoint

* Hook up tax stats endpoint

* Add default tax stat totals for empty results

* Create subtotals from intervals in API

* Change orders to orders_count to keep consistent naming
2018-12-18 10:26:46 +08:00
Claudio Sanches 80f1b2f256 [REST API] Stock endpoint (https://github.com/woocommerce/woocommerce-admin/pull/974)
* New reports stock endpoint

* Register new endpoint

* Unit tests

* Included "name" into stock results

* Fixed sku type

* Improve stock _links returning properly links for variations and parent products

* Fixed docblock

* Sort stock by stock_quantity by default

* Fixed orderby

* Ignore sticky posts

* Fixed variable names
2018-12-14 07:43:39 -08:00
Timmy Crawford 88b899f7cb Remove trailing slash on base_dir variable. (https://github.com/woocommerce/woocommerce-admin/pull/1078) 2018-12-12 13:13:49 -08:00
Peter Fabian 43b60489ff Merge pull request woocommerce/woocommerce-admin#1060 from woocommerce/fix/remove-force-update-in-tests
Removed force update in tests
2018-12-12 19:47:16 +01:00
Justin Shreve 20e202080a Add Live Data to Reviews Panel (https://github.com/woocommerce/woocommerce-admin/pull/1055)
* Add Live Data to Reviews Panel
Adds the ability to embed the product in a product review response

* Clean up code needed to embed some product fields.

* Add API response tests
2018-12-12 08:35:56 -05:00
Peter Fabian 256a7fd708 Test should run without explicitly calling update for lookups.
Same as code in general, tests should also check whether the lookups are updated correctly without explicitly needing to call update on data stores.
2018-12-11 12:41:47 +01:00
Peter Fabian deba4a354a PHPCS updates. 2018-12-11 12:41:35 +01:00
Peter Fabian c612f85c6c PHPCS updates. 2018-12-11 12:39:44 +01:00
Allen Snook de105648be Activity Panel: Inbox: Filter update and error notes out of the inbox (https://github.com/woocommerce/woocommerce-admin/pull/893)
* Filter update and error notes out of the inbox

* Remove redundant trim().

* Fix test for admin notes API type parameter.
2018-12-11 09:00:57 +08:00
Joshua T Flowers 04d3ce6eb1 Add taxes endpoint and data store (https://github.com/woocommerce/woocommerce-admin/pull/1000)
* Add taxes endpoint and data store

* Add sorting options and normalize orderby param

* Add report taxes unit tests

* Add tax rate to response

* Add country, state, priority, and name to response

* Fix tax codes query param

* Add class comment

* Add missing  to record query

* Add comment about ambiguous column
2018-12-11 08:58:05 +08:00
Joshua T Flowers 557cec57cb Add tax stats endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1019) 2018-12-11 08:55:05 +08:00
Paul Sealock 93a7472e54 REST API: Add stock info to products and variations 2018-12-11 07:19:46 +13:00
Joshua T Flowers 755b9c94f7 Reduce order table net revenue by refund total (https://github.com/woocommerce/woocommerce-admin/pull/988)
* Reduce order table net revenue by refund total

* Use order utils to get refund total
2018-12-05 10:06:00 +08:00
Peter Fabian 1c8459244a Merge branch 'master' into fix/749
# Conflicts:
#	includes/data-stores/class-wc-admin-reports-products-data-store.php
2018-12-04 12:07:43 +01:00
Paul Sealock bf0e025b05 REST API: isolate extened info in /reports/products 2018-12-04 13:01:36 +13:00
Peter Fabian 1acb9827e7 Merge branch 'master' into fix/749
# Conflicts:
#	includes/data-stores/class-wc-admin-reports-products-data-store.php
2018-12-03 16:21:04 +01:00
Peter Fabian 6e68247701 Merge pull request woocommerce/woocommerce-admin#953 from woocommerce/fix/740
Added support for ordering by product name in products endpoint.
2018-12-03 11:56:28 +01:00
Paul Sealock 516062975b try/variations-endpoint 2018-12-03 12:02:58 +13:00
Peter Fabian 8b80de9bc2 Added support for ordering by product name in products endpoint. 2018-11-28 15:14:34 +01:00
Paul Sealock 0ab5c735be Remove order statuses wc- prefix 2018-11-28 15:58:17 +13:00
Peter Fabian 688b47aa7c Added tests for advanced filters of orders report. 2018-11-27 17:04:16 +01:00
Peter Fabian 26debd77c3 WIP on advanced filters.
Plus fixing bugs:
- fixed tests
- fixed schema definition to reflect response data
- split WHERE SQL clause into time constraints and rest
2018-11-16 17:51:33 +01:00
Kelly Dwan 2a9cb6509b Build: Move components to packages dir (https://github.com/woocommerce/woocommerce-admin/pull/804)
* Move components to packages folder

* Update documentation generator to handle packages/components and client/components

* Update component locations

* Update CSS build process

* Remove react-dates css, this is already included by gutenberg

* Fix CSS style - single quotes

* Fix incorrect imports

* Update package-lock with new dependencies

* Update component locations for devdocs

* Fix location of tests
2018-11-15 13:16:23 -05:00
Allen Snook e150ce4034 Merge pull request woocommerce/woocommerce-admin#851 from woocommerce/add/admin-notices-rest-api-unit-tests-2
Add admin notices REST API unit tests
2018-11-15 09:24:17 -08:00
Peter Fabian 0374119245 Added zero padding to hours in unit tests. (https://github.com/woocommerce/woocommerce-admin/pull/858) 2018-11-15 08:19:13 -05:00
Allen Snook aeb7d15c9a Deeply test the structure of a single note for expected values 2018-11-14 11:17:01 -08:00
Allen Snook 40376c23e1 Add unit tests for admin notes REST API 2018-11-14 11:06:53 -08:00
Jonathan Belcher 0193e73a87 Merge Commit 2018-11-12 14:50:13 -05:00
Kelly Dwan 8af82f3dee Build: Move `lib/csv` to packages (https://github.com/woocommerce/woocommerce-admin/pull/756)
* Move CSV to packages

* Update CSV imports

* Add some basic usage documentation

* Add csv lib to the enqueued assets

* Change name to `csv-export`

* Update webpack build process to allow for package names with dashes

* Fix capitalization

* Update readme with docs extracted from jsdoc

* Fix merge conflict commit 😣

* Check that generateCSVFileName is called with correct params
2018-11-06 16:53:22 -05:00
Kelly Dwan d27cb26ef7 Build: Move `lib/nav-utils` and `lib/history` to `@woocommerce/navigation` (https://github.com/woocommerce/woocommerce-admin/pull/763)
* Move nav-utils and history to new package

* Update config to build and use new navigation package

* Update all imports to use new navigation package

* Remove unnecessary README

* Update nav-utils path
2018-11-05 16:02:04 -05:00
Peter Fabian a1f2c867f4 Corrected failing tests. 2018-11-02 12:24:21 +01:00