Commit Graph

6 Commits

Author SHA1 Message Date
Rodrigo Primo 0f79567d06 Merge branch 'master' into update/improve-get-downloads 2018-02-28 13:34:11 -03:00
Rodrigo Primo 07d00fc58e Make WC_Customer_Download() tests a bit faster
This commit simplifies WC_Customer_Download() tests by using hardcoded values for customer ID and e-mail instead of touching the database and creating a real customer for each test.
2018-01-26 15:44:23 -02:00
Rodrigo Primo 1195cf9eee Improve WC_Customer_Download_Data_Store::get_downloads() performance
This commit improves WC_Customer_Download_Data_Store::get_downloads() performance by changing the way the SQL query is built. Before this change, this method would get all table fields even when just the permission_id field is returned. Now the method will get from the database only the fields that will be returned. The fields retrieved from the database can be controlled using the parameter `$args['return']`:

- 'objects' (default): all fields are retrieved from the database and an array of WC_Customer_Download objects is returned.
- 'ids': gets and return only permision_ids
- comma separated list of fields (new option added by this commit): gets and return only the required fields. Examples: 'user_email,download_id,order_id' or 'order_id,download_count'.
2018-01-22 17:25:26 -02:00
Rodrigo Primo 656356530a Use setUp() method in WC_Customer_Download() tests to remove code duplication 2018-01-22 14:43:28 -02:00
Rodrigo Primo 9eeb4cd0bd Add assertion to check WC_Customer_Download_Data_Store::get_downloads() when called with the 'return' param set to 'ids' 2018-01-22 11:01:00 -02:00
Rodrigo Primo 6bb79681b9 Fix PHPCS violations in class-wc-tests-customer-download.php 2018-01-22 10:59:09 -02:00