Commit Graph

113 Commits

Author SHA1 Message Date
Nestor Soriano 3976abffd6 Fix price filtering when there are variations.
The price filtering query wasn't working properly when there are
variations with different prices: if at least one variation was
outside of the price range but other were inside, the product wasn't
being listed.
2021-02-05 16:34:42 +01:00
Claudio Sanches 6701ce9c9d
Merge pull request #26983 from woocommerce/fix/25082
Use tax location from order while computing tax in discount.
2021-01-28 16:59:59 -03:00
Roy Ho 4c548951f4
Merge pull request #28521 from woocommerce/fix/26475
Create additional download permissions on product save if needed
2021-01-18 06:51:57 -08:00
Roy Ho 56e67b1ef8
Merge pull request #28814 from woocommerce/fix/migration/27688
Add migration to fix incorrect product review count.
2021-01-18 06:48:46 -08:00
vedanshujain 2240d3a6e4 Fix typos. 2021-01-18 19:52:20 +05:30
vedanshujain 1758c2b58c Add tests for #28835 2021-01-18 17:26:19 +05:30
vedanshujain 2dce182cf8 Add unit tests for review count methods. 2021-01-14 18:31:02 +05:30
Nestor Soriano 8b0bd248d6 Attach hook for adjust_download_permissions from within init_hooks
The DownloadPermissionsAdjuster class hooks to adjust_download_permissions
from within its init method. However this method is executed only
if the class is resolved, otherwise the hooks doesn't get attached
and then the scheduled action is not serviced.

To solve this, the class is resolved from WooCommerce::init_hooks.
This requires a change in DownloadPermissionsAdjuster::init
to use wc_get_container()->get( LegacyProxy::class )->get_instance_of
instead of WC()->get_instance_of, since WC() can't be used from
WooCommerce::construct (which invokes init_hooks).
2021-01-14 11:40:11 +01:00
Nestor Soriano 2ec002defa Add unit tests for DownloadPermissionsAdjuster::adjust_download_permissions 2021-01-13 12:11:15 +01:00
Steve Grunwell e32dd6c4d3 Add a new WC_Shipping_Zone_Data_Store_CPT_Test class to support the refactoring of WC_Shipping_Zone_Data_Store_CPT::read() 2021-01-12 18:26:00 +00:00
Nestor Soriano 2d83db8b66 Add tests for DownloadPermissionsAdjuster::maybe_schedule_adjust_download_permissions
Also replace direct invocations of functions with usages of the
LegacyProxy whenever needed, and code style ajustments.
2021-01-12 12:07:38 +01:00
Nestor Soriano afe7bdc6b3 Add a test for the added functionality of LegacyProxy. 2021-01-12 10:16:00 +01:00
Roy Ho d4849c598c
Merge pull request #28692 from woocommerce/fix/28582
Add protective check to make sure WC()->session is initialized before  loading the data store.
2021-01-08 07:55:35 -08:00
vedanshujain b0cc43a188 More for individual fields in responses for V2 and V3 products and orders endpoints. 2021-01-06 16:04:56 +05:30
vedanshujain e546c237b7 Add tests for checking all fields are returned even requested individually. 2021-01-06 15:12:55 +05:30
vedanshujain 1fdc24daa9 Add unit test for verifying that all expected fields are present. 2021-01-06 14:19:26 +05:30
jonathansadowski 1e267980e8
Merge pull request #28723 from woocommerce/feature/issue-27208
Feature/issue 27208
2021-01-05 14:00:55 -06:00
roykho b25f01d2f3
Add unit tests 2021-01-05 08:14:39 -08:00
vedanshujain 9e3cdd4ae7 Add tests for #28692 2020-12-30 19:29:22 +05:30
vedanshujain 818e24d5c5 Add protection around `func_get_arg` method for backward compatibility.
We are using func_get_arg method to receive argument in a backward compatible way since we cannot modify function signature to add more params even with default params. Earlier I was hoping to use DI to create another child class with modified signature and load it depending upon where we are executing from, however since we had to revert DI, we add this workaround to unblock #27735.
2020-12-28 14:10:22 +05:30
Vedanshu Jain 800c6a61b7
Merge pull request #28620 from woocommerce/fix/28505
Stock management regression fixes
2020-12-21 22:36:53 +05:30
Claudio Sanches 8568a9b9ff Fixed coding standards 2020-12-21 12:46:01 -03:00
vedanshujain 5171108967 Better docs for test functions to specify expectations. 2020-12-21 15:51:07 +05:30
vedanshujain 84d60e5fcf Add unit tests for all status change ops.
This loops and tests stock changes through ALL supported WooCommerce statuses. Hopefully this will make our inventory tracking more robust.
2020-12-17 22:28:21 +05:30
vedanshujain 981d494d52 Add unit tests for #28592 2020-12-16 19:37:01 +05:30
Vedanshu Jain ae163eb28b
Merge pull request #27734 from woocommerce/enhancement/optimize-wc-order
Optimize function `wc_get_orders` by priming caches beforehand
2020-11-14 12:37:44 +05:30
vedanshujain 13f2dd6be9 Add unit tests towards issue #28100 2020-11-13 01:02:16 +05:30
vedanshujain a2231c4387 Add unit test 2020-11-12 22:58:05 +05:30
vedanshujain 04fe12b5fb Add proper params because otherwise this query will not set caches. 2020-11-12 15:10:16 +05:30
vedanshujain fdceac9866 Delete refund cache for parent order when its deleted. 2020-11-12 10:01:15 +05:30
roykho 4ec270b93d Add unit tests for the fix 2020-11-11 15:28:06 -06:00
vedanshujain 62ae94d93e Add shipping, tax and fee lines to refund response for better information. 2020-11-11 18:47:48 +05:30
roykho 996d206ce5
Add unit test for #27756 2020-10-26 12:32:15 -07:00
Nestor Soriano 042e2cd0bb Fixes in the dependency injection engine for PHP 8 compatibility
- One dummy class used for tests had a 'final private' method, this
  is not allowed in PHP 8 and so the method is now just 'private'.

- The AbstractServiceProvider class was using
  ReflectionParameter::getClass. This is deprecated in PHP8 and thus
  that usage has been replaced with an utility method that uses
  the recommended replacement.
2020-10-16 11:31:26 +02:00
Néstor Soriano e4a109f0d1
Merge pull request #27763 from woocommerce/fix/27445
Remove protection as we already diff and update only if needed.
2020-10-15 10:01:34 +02:00
Néstor Soriano c15488d840
Merge pull request #27830 from woocommerce/php8/fix-round-function-with-non-numeric-argument 2020-10-09 08:01:44 +02:00
Nestor Soriano ac0641d02a Fix a couple of incompatibilities with NumberUtils::round
- Passing a string that represents a number but has spaces (e.g. ' 1 ')
  now works as expected (the number is properly interpreted)
- Passing the boolean true now returns 1, not 0
- Passing an object throws an error, instead of returning 0
2020-10-08 13:13:53 +02:00
Nestor Soriano b71f876cba Reintroduce the dependency injection related code.
After the League's Container package has been reintroduced, all the
code that implements the dependency injection mechanism in woocommerce
can be brought back as well.
2020-10-08 09:28:05 +02:00
Nestor Soriano 52eed70f04 Add a 'NumberUtil' class with a 'round' method.
There's a number of places in the WooCommerce codebase where the
built-in function 'round' is executed passing a non-numeric value
(not a number and not a string that can be parsed as a number),
for example round(''). In PHP 7 this yields a value of 0, but in
PHP 8 this throws an error.

This commit adds a 'NumberUtil' class with a static 'round' method,
this method checks if the passed value is numeric and if so it just
executes the built-in function, otherwise it returns 0. And all the
calls to 'round' in the codebase are replaced with 'NumberUtil::round'.
2020-10-01 11:08:51 +02:00
vedanshujain d51dd26816 Add unit tests. 2020-09-25 19:41:20 +05:30
Rodrigo Primo 197e8d274c
Merge pull request #27616 from woocommerce/fix/26960
Paypal gateway: protect code against a fatal error if WooCommerce is unable to communicate with PayPal
2020-09-18 09:34:57 -03:00
vedanshujain 140dafb704 Add unit tests for when PayPal API will return error 2020-09-18 17:12:33 +05:30
Claudio Sanches ed1a59b39b
Merge pull request #27416 from woocommerce/fix/27415
Fixed country list sorting
2020-09-17 10:35:43 -03:00
Claudio Sanches b5d8d94bc8 Use reference in wc_asort_by_locale 2020-09-10 16:02:39 -03:00
vedanshujain 6a2ea0e27a Add unit test for show_shipping for different countries. 2020-09-09 19:53:21 +05:30
Claudio Sanches 47aaac8600 Introduced wc_asort_by_locale() function 2020-08-19 20:22:18 -03:00
Claudio Sanches b5221ab479 Added unit tests for changes in wc_ascii_uasort_comparison 2020-08-19 19:00:18 -03:00
Christopher Allford 358db5dc3e Removed the internals of the Container pending package conflict resolution
Since reverting the PR at this point would be a mess I've gone ahead and removed the internals of the container. We should aim to keep the class since it's now part of our public API but it won't work as expected anymore. This is fine for now since we don't actually have anything in it!
2020-08-18 20:39:48 -07:00
Claudio Sanches e102ec3d83 Merge branch 'master' into fix/25133 2020-08-17 14:59:49 -03:00
Christopher Allford 7340c9af44
Merge pull request #27171 from woocommerce/fix/25543
Added the parent's SKU to product searches for variations
2020-08-12 12:58:00 -07:00