Commit Graph

144 Commits

Author SHA1 Message Date
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
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
Nestor Soriano b1e81d02da Fix code style/sniffer errors in a few files. 2020-10-01 11:08:51 +02:00
Nestor Soriano a94ea7f51f Remove logic for storage of attribute terms for variations
A mechanism for improved filtering by attribute for variations was
introduced some time ago. This mechanism implied maintaining term
relationships for variations, where the terms were the attributes
that defined the variation.

The mechanism was reverted because it was complex and presented many
issues, but the code that created those term relationships was kept.
This pull request removes that code and the associated unit tests.
2020-09-22 16:31:06 +02:00
Ron Rennick 9915a5b142 merge master 2020-09-18 12:53:28 -03:00
Claudio Sanches 29b8b0d60d
Merge pull request #27701 from woocommerce/fix/rest-api-package-tag
Fixed usage of package tag in REST API and templates
2020-09-17 18:45:14 -03:00
Claudio Sanches 7fae819928 Fixed package tag 2020-09-17 14:34:36 -03:00
Claudio Sanches 3377c60c5e
Merge pull request #27433 from woocommerce/fix/remove-relative-include-paths
Change relative include paths to absolute include paths
2020-09-17 13:15:40 -03:00
Claudio Sanches 70c7adfeb7 Fixed usage of package tag in REST API and templates 2020-09-17 11:56:08 -03:00
jonathansadowski 2bcdbacc98
Merge pull request #27625 from woocommerce/revert-improved-filtering-for-variations
Revert improved filtering for variations
2020-09-10 12:42:15 -05:00
Christopher Allford ae697f9fe2 Prevented zero from being considered empty when validating posted variation attributes 2020-09-09 11:29:31 -07:00
Nestor Soriano 70a1cb2f1f Revert improved filtering for variations.
This commit reverts the functionality introduced in PR #26260
(later refined by #27175, #27190, #27508) in which filtering by
attribute using the layered nav widget was improved to handle the
cases of variations out of stock. The revert is a response to the
numerous problems reported by users in Woo 4.4 and 4.5

Not all the code has been reverted, only the code that resulted in
visible functionality changes. Thus, the code that generates
term relationships for variations is still in place to keep database
consistency and to keep the reverting changes to the minimum needed.
2020-09-09 17:36:26 +02:00
Shiki d6600d8338 Version3/orders.php: Re-add assertion for `meta_data` 2020-09-01 14:29:38 -06:00
Shiki 5651befdd9 Version3/orders.php: Remove assertion for `meta_data`
The new meta_data output will include keys like `display_key` and
`display_value`. The assertion will be re-added in a later commit.
2020-09-01 14:22:38 -06:00
Shiki 64bd1e0fd5 Fix formatting errors in orders.php 2020-09-01 14:21:14 -06:00
Ron Rennick 8fe3bcb90e rebase to current master 2020-08-28 10:59:43 -03:00
Claudio Sanches 085b4b53fa
Merge pull request #27487 from woocommerce/update/choice-of-words
Improve choice of words
2020-08-27 19:30:54 -03:00
Claudio Sanches c4ccc38780 Fixed use __DIR__ for relative paths 2020-08-26 18:46:44 -03:00
Shiki ecb2936f9e 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-08-26 23:51:36 +05:30
Shiki face3fe27e OrdersV2: Add test for line items meta_data
This currently fails because it's not implemented yet.
2020-08-26 23:51:36 +05:30
Shiki ad00eb3a98 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-08-26 23:51:36 +05:30
Shiki 2a01aa968f WC_Tests_API_Orders: Add test data for site-level attributes 2020-08-26 23:51:36 +05:30
Shiki dc2a4d1ccc WC_Tests_API_Orders: Rearrange order variable for clarity 2020-08-26 23:51:36 +05:30
Shiki 00a5c3101e WC_Tests_API_Orders: Rename first_meta_data to size_* 2020-08-26 23:51:36 +05:30
Shiki d681a8c7a4 Add unit test for an Order's line item meta data. 2020-08-26 23:51:36 +05:30
Claudio Sanches 5240682f38 Improve choice of words 2020-08-25 18:03:03 -03:00
Claudio Sanches a133e56ebd Fixed unit tests 2020-08-25 16:13:49 -03:00
Ron Rennick 81dae70033 phpcs fixes 2020-08-25 15:41:31 -03:00
Ron Rennick de79f1a3cd update unit tests for included Paypal gate name change 2020-08-25 15:36:50 -03:00
Ron Rennick 51afe3207a
Merge pull request #27023 from HikeMike/add/hidden-form-field
"Hidden" field type added to woocommerce_form_field() #26468
2020-08-20 11:48:26 -03:00
Claudio Sanches e102ec3d83 Merge branch 'master' into fix/25133 2020-08-17 14:59:49 -03:00
Claudio Sanches bb0c4406de
Merge pull request #27314 from woocommerce/add/unit-tests-27108
Added unit tests for #27244
2020-08-14 15:32:02 -03:00