Commit Graph

174 Commits

Author SHA1 Message Date
Jonathan Sadowski cd7b8ee30f Fix unit tests for new default USD currency 2021-04-23 10:03:05 -05:00
Jonathan Sadowski 55ab8cb966 Set USD as default store currency 2021-04-23 09:29:12 -05:00
roykho ded5c9c7c4
Update unit tests to reflect new base address 2021-04-12 14:13:27 -07:00
roykho 6c7c420d25
Set US:CA as the default store location 2021-04-12 09:28:30 -07:00
Brian 778cf448cb
Update data.php
fix legacy code test
2021-04-06 23:56:28 +02:00
Brian 50b882905f
Update data.php
fix legacy tests
2021-04-06 23:44:36 +02:00
Brian 913c46ac91
Update functions.php
fix legacy test
2021-04-06 23:43:53 +02:00
Roy Ho 8b6e4ac519
Merge pull request #29542 from woocommerce/fix/23682.1
Update UID only for WooCommerce cookies
2021-03-31 16:05:28 -07:00
Claudio Sanches 2da3a37450 Added unit test 2021-03-30 14:11:33 -03:00
Nestor Soriano 2b8cac7cf2 Fix the REST API entry point to add coupons to an order.
- Check input (no 'id', has 'code') and throw an error if needed
  before removing the existing coupons, so an invalid input
  won't cause the loss of these existing coupons.
- Also, check that the coupon is actually valid as part of the
  input check.
- Cache the coupon objects that are created during the input check,
  and apply them directly.
- Don't check if 'coupon_lines' is an array and contains arrays,
  that's already done by the REST API engine by looking at the schema.
- Adjust unit tests.
2021-03-24 15:19:34 +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
louwie17 893fe6cc24
Merge pull request #29149 from woocommerce/update/28569_status_widget_net_sales_link
Woocommerce dashboard status widget net sales link and logic
2021-02-25 09:09:29 -04:00
Peter Fabian 35d4ee4073
Merge pull request #28699 from woocommerce/fix/absolute-download-paths
Prevent local relative downloadable products to be treated as "absolute"
2021-02-23 11:50:34 +01:00
Lourens Schep 966aca59ad Removed external class and moved logic to private functions 2021-02-18 16:05:00 -04:00
Lourens Schep 0fc81a27fc Add tests 2021-02-18 12:01:52 -04:00
Claudio Sanches 6fae8ca40b
Merge pull request #29146 from woocommerce/fix/27290-rest-api-order-updates
Throw an error if a coupon item ID (readonly) is specified during an order update | #27290
2021-02-16 17:04:49 -03:00
barryhughes f79b3f9120 Supporting tests for handling coupon-related order updates (via REST API) | #27290 2021-02-16 10:28:46 -08:00
artpi cca06857e9 Fix tests 2021-02-16 16:19:55 +01:00
artpi dc7410b6b3 Extra protections 2021-02-16 15:51:49 +01:00
artpi 774d7e38cd Better url parsing 2021-02-16 15:09:23 +01:00
artpi 3ffeeea8e4 Add a few tests 2021-02-16 10:52:34 +01:00
Claudio Sanches 74bb66dc6d
Merge pull request #27671 from mahmoudsaeed/master
Make WC_Tax::get_tax_rate_classes() public
2021-02-15 14:31:25 -03:00
Claudio Sanches ea54d5ad5f
Merge pull request #28679 from woocommerce/fix/woocommerce-gutenberg-products-block-issues-3565
Show correct WooCommerce pages status if they are using blocks vs shortcode.
2021-01-18 19:26:34 -03:00
budzanowski a283433f4d Add block utils unit tests. 2021-01-12 14:41:55 +01:00
Nestor Soriano f4a1f12824 Fix code sniffer errors 2021-01-05 17:23:23 +01:00
Nestor Soriano f284ae8af3 Fix end of line handling for PHP 8 in WC_Tests_Log_Handler_Email
In PHP 7 the mail function generates PHP-style end of lines (\n),
and that's what these unit tests were assuming; in PHP 8 however
the proper network-style end of lines (\r\n) are generated.
This commit fixes the tests to be compatible with both styles.
2021-01-05 16:04:30 +01:00
vedanshujain 9ca52ee73b Fix unit test to use new coupon error messages.
This also removes some cart operations which are not needed anymore to since cart already has items that we were adding in those tests.
2020-12-16 16:21:33 +05:30
Christopher Allford 30d2e278b9 Replaced the deprecated `WC_Admin_Note` class 2020-11-12 13:26:30 -08:00
Shiki 30854efc1b Replace assertStringContainsString with strpos
This is to make the PHP 7.0 CI pass.
2020-10-26 13:28:04 -03:00
Shiki ba3e107cb8 Orders V2 API: Add test for parent_name 2020-10-26 13:28:04 -03:00
Shiki 94ecfcab34 Orders API: Add parent_name to schema 2020-10-26 13:28:04 -03:00
Shiki c6f82b96a1 Orders API: Add unit test for parent_name line_item property 2020-10-26 13:28:04 -03:00
Shiki a05316878e Orders API Tests: Fix failing tests because of the new property 2020-10-26 13:28:04 -03:00
Shiki 3a1b125e3a Fix coding style 2020-10-26 13:28:04 -03:00
Mahmoud Saeed ad0eff11de Add unit test for WC_Tax::get_tax_rate_classes() 2020-10-15 07:34:20 +02:00
vedanshujain a332b399d3 Use variable instead of magic constants. 2020-10-14 18:50:44 +05:30
vedanshujain c01f32a390 Use default value if formatted value is not available 2020-10-14 14:51:19 +05:30
vedanshujain 8e12de5d3c Merge branch 'fix/api/229-unit-test' of https://github.com/shiki/woocommerce into fix/api/229 2020-10-14 13:53:03 +05:30
Shiki 1be78d1ebf Use different terms to avoid clash with the similar V2 test
I suppose I could have deleted the attribute and term first but I think
this is better and shorter. Maybe.
2020-10-13 22:32:32 +05:30
Shiki a9bf6b71ac OrdersV2: Add test for line items meta_data
This currently fails because it's not implemented yet.
2020-10-13 22:32:32 +05:30
Shiki 871a9e0b8f Add line items meta_data schema test for Orders V2 and V3
This currently fails because the expected meta_data properties are only
available in V3.
2020-10-13 22:32:32 +05:30
Shiki c5fd3ed21c WC_Tests_API_Orders: Add test data for site-level attributes 2020-10-13 22:32:31 +05:30
Shiki 62f1705690 WC_Tests_API_Orders: Rearrange order variable for clarity 2020-10-13 22:32:31 +05:30
Shiki c16ec9bf54 WC_Tests_API_Orders: Rename first_meta_data to size_* 2020-10-13 22:32:31 +05:30
Shiki a0d9b49e43 Add unit test for an Order's line item meta data. 2020-10-13 22:32:31 +05:30
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
Néstor Soriano e4b78cedbf
Merge pull request #27748 from woocommerce/remove-leftovers-from-improved-filtering-by-attribute-for-variations
Remove leftovers from the reverted improved filtering mechanism for variations
2020-10-08 15:45:09 +02:00
Nestor Soriano ed33a607a7 Remove a useless test assertion that fails in PHP 8
The assertion is useless (the constant is already tested a few Lines
above), and it was failing in PHP 8 because 'auto' < 2 is evaluated
as false, while it's evaluated to true in PHP 7.
2020-10-02 15:27:26 +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