Commit Graph

1773 Commits

Author SHA1 Message Date
Gerhard Potgieter b2ed079520 Manual orders coupon usage limits by email (#23775)
* Add functionality to wp-admin order to check for coupon usage based on email addresses, similar to how WC_Cart handles this seperately, included unit tests.

* Only do the coupon by email usage check if order is from a guest. Fix issue with unit test.
2019-05-27 11:45:29 -03:00
Gerhard f6d9faa062 Introducde wc_load_cart to dynamically load the cart, this allows for functionality outside of frontend to initialise the cart. 2019-05-22 12:24:31 +02:00
Gerhard Potgieter afd7e72c03
Merge pull request #23690 from woocommerce/update/obw-stripe
Update OWB Payment Gateway structure
2019-05-16 18:26:29 +02:00
Gerhard ddcef3b34c Fix unit test for new scenarios 2019-05-16 16:26:34 +02:00
Gerhard Potgieter 30ce9ff6a3
Merge pull request #23689 from woocommerce/add/get_used_coupon_codes
Deprecate get_used_coupons in favor of get_coupon_codes
2019-05-15 15:34:40 +02:00
Rodrigo Primo 47188f05cb Fix unit tests after changes in the default enabled payment gateways 2019-05-14 19:46:38 -03:00
Rodrigo Primo c8b55ff62d Improve WC_Admin_Setup_Wizard::get_wizard_in_cart_payment_gateways() tests
This commit moves two functions declared inside a test method to their
own protected methods inside the same test class to make it easier to
read the tests and it fixes the order of the parameters for the calls to
Assert::assertEquals(). The first parameter passed to this method should
be the expected value and the second parameter should be the actual
value and not the opposite.
2019-05-14 18:38:53 -03:00
Rodrigo Primo ba792a6589 Fix PHPCS errors 2019-05-14 18:34:21 -03:00
Gerhard Potgieter b7facc0674
Merge pull request #23663 from danielbitzer/add_get_coupons_method
Add WC_Abstract_Order::get_coupons()
2019-05-14 11:35:21 +02:00
Gerhard 486321161c Update usage of get_used_coupon_codes to get_coupon_codes 2019-05-14 11:21:27 +02:00
Daniel Bitzer 3024043bb4 Add unit test for WC_Abstract_Order::get_coupons() 2019-05-14 15:46:49 +09:30
Gerhard 31acfbcb4a Deprecate WC_Abstract_Order::get_used_coupons in favor of WC_Abstract_Order::get_used_coupon_codes, this reflects the actual data being returned better. 2019-05-13 14:40:54 +02:00
Gerhard Potgieter d2c7d8c86e
Merge pull request #23535 from woocommerce/fix/23518
Fix: parameter values should be converted back as well when building form fields
2019-05-10 10:43:28 +02:00
Rodrigo Primo 18ee70918b Fix PHPCS violations in tests/ using PHPCBF
This commit fixes all 1533 PHPCS errors that PHPCBF can fix automatically in the tests/ directory. Before this change there was a total of 3106 PHPCS errors in the WooCommerce repository and now there is 1573 errors.
2019-05-01 19:05:00 -03:00
Rodrigo Primo 45c2c78ea2 Fix: parameter values should be converted back as well when building form fields
PR #23196 added a workaround to `parse_str()` limitation when dealing with full-stops, pluses, and spaces in the parameter key. This workaround involved temporarily replacing those three characters with placeholders before calling `parse_str()` and then replacing back to the original form. This commit fixes a bug in this logic that was replacing back only parameters keys and not parameters values.

For example, if the query string is `?query.parameter=foo.bar`, the resulting <input> field contained `foo{dot}bar`, instead of the expected `foo.bar`.
2019-04-26 13:58:27 -03:00
Rodrigo Primo e21430703c Remove redundant calls to var_export() in test_wc_query_string_form_fields()
It is not necessary to use the $message parameter of assertEquals() to output the value of $actual_html, as PHPUnit already output this variable value in case of error.
2019-04-26 11:49:30 -03:00
Mike Jolley 9bf2081869
Merge pull request #23477 from woocommerce/fix/23466
Default category sorting order should be overwritten if defined by get_terms
2019-04-24 16:00:33 +01:00
Mike Jolley 8ffc4fca71 menu_order test 2019-04-24 10:45:33 +01:00
Mike Jolley 8fe68400be name_num tests 2019-04-24 10:44:22 +01:00
Mike Jolley 3945aae94e Test cases for sorting 2019-04-24 10:38:38 +01:00
Mike Jolley a4ba20681e added failing test 2019-04-23 11:48:24 +01:00
Mike Jolley f306d3fc11
Merge pull request #23266 from woocommerce/fix/23234
Switch to subquery for sale product query
2019-04-18 12:36:22 +01:00
Mike Jolley cafd81e6e5
Merge pull request #23329 from woocommerce/fix/23327
Non int value handling in wc_let_to_num
2019-04-18 11:30:57 +01:00
Mike Jolley ceefe98bd0
Merge pull request #23297 from dkjensen/master
Remove tags from product titles when building PayPal request URL
2019-04-18 11:23:55 +01:00
Mike Jolley b686150655
Merge pull request #23196 from woocommerce/fix/23195
Replace full stops before running through `parse_str`
2019-04-18 11:01:59 +01:00
Gerhard 8ca0bd7b4d Add logic to wc_let_to_num to handle non int values, added unit tests to cover these scenarios 2019-04-17 10:30:49 +02:00
Timmy Crawford e12e4aaa25
Merge pull request #23304 from woocommerce/fix/link-all-variations
[3.6] Fix logic in link all variations
2019-04-15 11:16:22 -07:00
Timmy Crawford 438d22762e
Merge pull request #23246 from franticpsyx/issue-23245
Introduce IN and NOT IN clauses in `WC_Product_Data_Store_CPT::search_products
2019-04-15 11:08:32 -07:00
Mike Jolley 6c6785c844
Merge pull request #23269 from marcochiesi/patch-1
Added validation for Italian postcodes
2019-04-15 14:10:01 +01:00
Mike Jolley 1504f8af3e
Merge pull request #23011 from Tofandel/patch-2
Improve the speed of the admin dashboard by only updating transients once per class
2019-04-15 14:03:31 +01:00
Mike Jolley d0c6c54989 Moved link/create code to data store with new unit test
This code was not testable within ajax code, so moved to the data stores.
2019-04-15 11:59:57 +01:00
David Jensen 23bda4503e Add comment 2019-04-12 14:49:17 -07:00
David Jensen ac6da3cb55 Unit test strip HTML from product title when building PayPal request URL 2019-04-12 14:44:38 -07:00
Marco Chiesi 92c356021c
Added missing parameter comments 2019-04-11 01:12:27 +02:00
Marco Chiesi 2a784a3003
Added missing doc comments (coding standards) 2019-04-11 01:03:48 +02:00
Marco Chiesi cba442283c
Fixed wrong tests for Italian postcodes 2019-04-11 00:33:30 +02:00
Ian Jenkins dd67ee2e28 Minor fixes for things noticed when running tests locally.
Was using a directory other than /tmp for temp dir and it was failing,
this was the changes I had to make.
2019-04-10 23:01:44 +01:00
Mike Jolley d3e2d725e7 prevent test showing content 2019-04-10 13:50:42 +01:00
Manos Psychogyiopoulos 2fbb7bda5c Check coding stds 2019-04-10 13:02:52 +03:00
Manos Psychogyiopoulos c1b7c55768 Add exclude param tests 2019-04-10 12:47:31 +03:00
Manos Psychogyiopoulos a9f86ef202 Add include param tests 2019-04-10 12:47:19 +03:00
Manos Psychogyiopoulos e6f25b04d8 Add limit param tests 2019-04-10 12:47:06 +03:00
Timmy Crawford ef4f0f0c0f
Merge pull request #23197 from woocommerce/fix/23182
[3.6] Fix backwards compatibility issues for wc_get_template function w/ tests
2019-04-08 10:19:16 -07:00
Mike Jolley 1cd2959087 unset rather than prevent the template being included. 2019-04-03 16:08:12 +01:00
Mike Jolley 7feae340f2 Add tests 2019-04-03 11:58:15 +01:00
Mike Jolley 2e9ce0a061 unit tests 2019-04-02 15:18:06 +01:00
Mike Jolley c5b31cee3d Unit test for counts 2019-04-02 11:45:58 +01:00
Mike Jolley ad49085571 Append random number to reduce recusion 2019-03-27 12:22:15 +00:00
Mike Jolley 94466460ad Tests 2019-03-26 11:09:30 +00:00
Rodrigo Primo 61a096d871 Fix PHPCS in the Travis builds
PR https://github.com/woocommerce/woocommerce/pull/23082 made some changes to the Travis configuration and one of those changes broke the PHPCS when running inside Travis with the following error:

```
ERROR: Referenced sniff "WooCommerce-Core" does not exist
```

For example: https://travis-ci.org/woocommerce/woocommerce/jobs/509471213#L659

This problem went unnoticed during the PR review as no PHP file was modified in it and thus there was no file for PHPCS to check.

This commit fixes the error above by installing the Composer package `woocommerce/woocommerce-sniffs` which is the package that provides `WooCommerce-Core` sniffs and which installs `wp-coding-standards/wpcs` as one of its requirements. I couldn't find an easy way to make this work installing `woocommerce/woocommerce-sniffs` globally so that is why this commit also removes the `global` parameter when calling composer.
2019-03-21 15:23:42 -03:00