Commit Graph

146 Commits

Author SHA1 Message Date
Peter Fabian 351c07d655 Improved tests, added save points, fixed comments. 2021-03-16 13:08:29 +01:00
Peter Fabian e6cdd74a79 Add parent's default for low stock if notthing is set on individual variation.
I.e. use variation low stock amount value, if not available, use parent product's value, if not available, use the store-wide default.
2021-03-15 18:31:31 +01:00
Peter Fabian 1b53b724b2 Fix existing tests. 2021-03-11 17:02:22 +01:00
Saggre 24167a5eed Fix typos in docs 2021-03-05 11:19:58 +02:00
Moon 00a272fa85
Merge pull request #29174 from woocommerce/add/28568-dashboard-widget-finish-setup
Add/28568 dashboard widget - setup
2021-03-02 16:46:51 -08:00
Timmy Crawford 64e934e79b Remove debug code in tests. 2021-02-25 15:19:27 -08:00
Timmy Crawford 5cf3c6be8c Fix tests. 2021-02-25 15:19:27 -08:00
Timmy Crawford c7a19b538a Updates per feedback. 2021-02-25 15:19:27 -08:00
Timmy Crawford 47a3d1bfb3 Tracker: Add tracking of woocommerce_admin_disabled usage. 2021-02-25 15:19:27 -08:00
Claudio Sanches c86b0c578a Fixed copy and paste 2021-02-23 19:55:54 -03:00
Claudio Sanches 76e1ba4bf0 Validate variation ID while adding products to the cart 2021-02-23 16:27:57 -03:00
Moon 5c99233905 Minor fixes
* Removed extra double quotation from the image tag

* Fixed typo in the init() method

* Moved init() method body into the constructor -- a separate method is not necessary
2021-02-22 20:33:02 -08:00
Moon 781c5e24d7 Status dashboard widget should be rendered only if onboarding tasks have been completed or hidden 2021-02-22 15:29:47 -08:00
Claudio Sanches f41250df39 Added unit test for cart validation 2021-02-22 13:14:43 -03:00
Moon bc3219e22e Add tests for the finish setup dashboard widget and clean up code 2021-02-17 16:07:50 -08:00
Nestor Soriano 436a3db6e4 Fix code standards errors 2021-02-16 09:23:50 +01:00
Nestor Soriano 00d6dc40f7 Fix wrong caching of taxonomy in terms and attributes controllers.
The WC_REST_Terms_Controller and WC_REST_Product_Attributes_V1_Controller
classes have a get_taxonomy method that gets the name of the taxonomy
to process from a taxonomy id passed in the request, but once the
taxonomy name has been obtained it's cached and sbsequently reused.
The problem is that these controller instances are reused if more than
one request is processed programmatically, and thus the taxonomy that
was cached once is always used even if the new request specifies a
different taxonomy id.

The fix consists of using a dictionary of taxonomy id - taxonomy name
instead of one single taxonomy for caching.

In the case of WC_REST_Terms_Controller there's a protected $taxonomy
property that needs to be kept for compatibility, it's now set to
the last taxonomy name that has been introduced in the dictionary.
2021-02-12 15:12:58 +01:00
Vedanshu Jain 5a707f3e74
Merge pull request #28849 from woocommerce/fix/27521-2
Verify country code on checkout
2021-02-11 18:59:04 +05:30
Nestor Soriano e82ab487b6 validate_posted_data: check if we actually need to validate the shipping country. 2021-02-10 10:05:24 +01:00
Nestor Soriano 07f3d9dee6 Add unit tests for the WC_Checkout class. 2021-02-08 15:49:38 +01:00
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
Nestor Soriano 2c957d2531 Merge branch 'master' into fix/25900-take-2 2021-01-29 10:00:51 +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 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
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
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
Nestor Soriano d620f1d232 Fix #25900 - image size customisation controls not shown
- Added the `ThemeSupport class`, with methods to add and get
  theme support options.
  - It also has a new `add_default_options` method that adds the
    options under a `_defaults` key.
- The `WC_Twenty_*` classes now use `ThemeSupport` instead of
  the `add_theme_support` function to define image and thumbnail sizes.
  - The values are defined as default options.
- The `WC_Shop_Customizer` class now uses `ThemeSupport` instead of
  `wc_get_theme_support` to check if image and thumbnail sizes UI
  should be rendered.
  - The check is made excluding default values.

With these changes the UI to change the image and thumbnail sizes
is hidden only if the options are added as non-defaults elsewhere.

Additional changes:

- The code of the `wc_get_theme_support` function is replaced with
  a simple call to `get_option` in `ThemeSupport`.
- Added the utility class `ArrayUtil`.
2020-11-04 13:01:53 +01:00
roykho 996d206ce5
Add unit test for #27756 2020-10-26 12:32:15 -07: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
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
Claudio Sanches 29bc98816e
Merge pull request #27143 from woocommerce/fix/26876
Fix "Hide shipping costs until an address is entered"
2020-08-11 20:06:17 -03:00
Claudio Sanches 02cf0dfaed
Merge pull request #27239 from woocommerce/fix/package-tag
Fix usage of "package" tag in file headers
2020-08-07 13:37:24 -03:00
Claudio Sanches 17f9883f00 Changed | to \ 2020-08-07 13:36:41 -03:00
Néstor Soriano 76cf1e4e93
Merge pull request #27140 from woocommerce/fix/23790
Always sanitize coupon code to prevent inconsistent between admins and shop owners
2020-08-07 12:42:02 +02:00
Christopher Allford 8e8698a3f6 Fixed test that used PHPUnit function from newer version 2020-08-05 15:43:08 -07:00
Nestor Soriano 200599f8e0 Add unit tests for the type of the value returned by 'get_available_variations' 2020-08-03 16:30:54 +02:00
Claudio Sanches 1cd84d6446 Merge branch 'master' into fix/23790 2020-07-30 16:46:01 -03:00
Claudio Sanches 3c1132e274 Added unit tests for wc_get_current_admin_url() 2020-07-29 21:02:52 -03:00
Christopher Allford 78bff3b2da Added the parent's SKU to product searches for variations
Since the parent's SKU is used when the variation does not have one, we should fall back when searching for consistency.
2020-07-29 16:53:36 -07:00
Claudio Sanches de383971eb Reset all after test 2020-07-27 22:07:46 -03:00
Claudio Sanches 2043954ceb
Fixed class name 2020-07-27 21:53:28 -03:00
Claudio Sanches 0f091406df Test WC_Cart::show_shipping() 2020-07-27 21:52:33 -03:00
Claudio Sanches 4048d19a39 Added unit tests for coupon code sanitization 2020-07-27 17:44:04 -03:00
Peter Fabian 03230ecf01
Merge pull request #26642 from woocommerce/fix/26607
Limit stock changes for order items to status methods for consistency.
2020-07-24 13:23:53 +02:00
Claudio Sanches 64f4fb85e2 Move variation validation logic to add to cart 2020-07-23 19:10:42 -03:00
Christopher Allford 636327c110
Merge pull request #27043 from woocommerce/fix/unit-test-suite
Test Suite & Namespace PHPCS Changes
2020-07-20 08:40:00 -07:00
Claudio Sanches 86311a9903
Merge pull request #27046 from woocommerce/fix/26860
[Importer/Exporter] Fixed the value display of "Published" for children of draft variable products
2020-07-16 13:15:31 -03:00
Néstor Soriano 24bd19c517
Merge pull request #27038 from woocommerce/add/26192
Add existing meta keys to woocommerce_duplicate_product_exclude_meta filter
2020-07-16 11:02:09 +02:00
Claudio Sanches 156b061602 Added unit tests for importer and exporter 2020-07-15 21:49:26 -03:00
Christopher Allford f72b8db576 Added some exceptions to the PHPCS standards for unit tests
The file comments and @throws tags are unnecessary in unit tests.
2020-07-15 14:29:13 -07:00
Christopher Allford 55385f6cec Moved the orphaned unit test into the correct directory 2020-07-15 14:21:34 -07:00
Christopher Allford 13536bef5b Corrected the WCInstallTest filename
It is in the `includes` test section and should have the same filename as the corresponding class.
2020-07-15 14:20:26 -07:00
Christopher Allford fdee8dceaf Moved test to correct directory 2020-07-15 07:08:09 -07:00
vedanshujain af401a7d80 Add unit test 2020-07-14 23:32:12 +05:30
vedanshujain 6a8f9a4abe Disabled flaky test 2020-07-01 19:09:50 +05:30
vedanshujain 836d764c67 Add tests 2020-07-01 19:09:07 +05:30
Vedanshu Jain 60ffc7ab99
Merge pull request #26583 from woocommerce/fix/26582
Fix regression caused by merging #25092 conflicting with #24828
2020-06-12 15:13:21 +05:30
Claudio Sanches 6afbed0c14 Fixed coding standards 2020-06-01 23:55:17 -03:00
vedanshujain bbb7600f87 Add unit test for calculation based on rounding pref 2020-05-27 23:55:46 +05:30
vedanshujain af942a131a Add test to ensure that verify_base_table also creates table if needed. 2020-05-26 23:46:58 +05:30
vedanshujain 418741a0b2 Add unit test for verify_base_tables function 2020-05-22 18:32:04 +05:30
Christopher Allford 7bf9c31f64 Adjusted the column name normalization to avoid squashing meta key case sensitivity
Since we were converting the field to lowercase we ended up inserting meta in all lowercase, regardless of what it was in the CSV file. We should only be using the normalized field name when looking at the default columns, and should instead rely on a case-insensitive regex for the special columns.

One thing to note is that we're still defaulting the $headers array to the normalized field, as we don't want to change what is being passed to the filter for unmapped columns.
2020-05-14 21:20:55 -07:00
Christopher Allford 63ba6f7ee0 Moved the PSR-4 namespaced test directory to the correct folder
I know this probably doesn't belong in this PR, but it has been thoroughly discussed and I don't think anyone will mind :)
2020-05-14 21:20:47 -07:00
vedanshujain 27ad4a552e Rename file and class to resemble PSR4 like convention for consistency. 2020-05-05 19:19:37 +05:30
vedanshujain f4e169f21e Moved test specific logic from bootstrap to test file 2020-05-02 00:31:54 +05:30
vedanshujain 13dfb8180f Add unit test and a sample Woo plugin file 2020-05-01 22:47:08 +05:30