Commit Graph

93 Commits

Author SHA1 Message Date
Rodrigo Primo 2329e4f526 Add exception message to fix failing test
This commit adds the exception message thrown when WC_Order::set_billing_email() is called with an invalid message to a test to fix it.

I couldn't find what change in WC codebase broke the test and I'm not sure why it is failing only when running using PHP 5.6:

https://travis-ci.org/woocommerce/woocommerce/jobs/315750242#L600
2017-12-13 12:28:48 -02:00
Rodrigo Primo ddc2d926fc PHPCS: fix violations manually 2017-12-13 12:19:51 -02:00
Rodrigo Primo c4665bff46 Automatic PHPCS fixes using phpcbf 2017-12-13 12:11:47 -02:00
Claudiu Lodromanean b05cd3f3a7
Merge pull request #17934 from woocommerce/fix/17925
Display product URL only if is not hidden in downloads list
2017-11-29 10:33:34 -08:00
Claudio Sanches d3a5a1bfd4 Fixed bugs caused after fixing coding standards 2017-11-29 10:32:35 -02:00
Rodrigo Primo 7b17b79460 Fix PHPCS violations in file tests/unit-tests/order/functions.php 2017-11-24 17:25:31 -02:00
Rodrigo Primo acb970dcf7 Add some basic test coverage for wc_order_search() 2017-11-24 17:04:14 -02:00
ragulka 4f2e1ee8d4 Ensure refund is deleted when exception is thrown during wc_create_refund 2017-11-22 17:03:58 +01:00
Mike Jolley 0198aa22ac Fix up test 2017-11-08 12:32:08 +00:00
Mike Jolley f5c7164ae5 Added a test to confirm this issue is specific to the API 2017-11-08 12:16:22 +00:00
Claudio Sanches e1a4f6e159
Merge pull request #17470 from woocommerce/pr/16959
Added actions before calculations order totals and taxes and is_vat_excempt support
2017-10-31 12:21:08 -02:00
Mike Jolley 95cad5fae0 Added unit test 2017-10-31 13:51:06 +00:00
Mike Jolley cb087a0755 fix tests and minify css 2017-10-31 12:26:59 +00:00
claudiulodro f06ecee1c5 Fix order methods and add tests 2017-10-27 13:37:00 -07:00
claudiulodro e6a9a5f79b Fix date query meta unset checking 2017-10-24 13:07:21 -07:00
Mike Jolley fe847630b2 Tests when tax is not enabled 2017-08-29 12:38:35 +01:00
Mike Jolley fb64e77f24 No tax tests 2017-08-29 12:32:02 +01:00
Mike Jolley dc9c14d574 Ex tax tests 2017-08-29 12:17:18 +01:00
Mike Jolley 97390eaf6e Tests 2017-08-25 18:21:29 +01:00
Mike Jolley be4ae42a59 Tests 2017-08-25 16:15:32 +01:00
Mike Jolley e99471c0cd Removed manual discounts code 2017-08-18 10:36:10 +01:00
Mike Jolley 33be0b5741 Remove todos 2017-08-14 16:44:59 +01:00
claudiulodro 6fa0e7a8f5 Update test 2017-08-11 11:27:11 -07:00
claudiulodro 591b71ecbc Add some tests 2017-08-10 14:37:40 -07:00
claudiulodro 3618ef1725 Handle couple todos 2017-08-10 13:37:05 -07:00
Mike Jolley 23660b9c68 test 2017-08-10 11:46:00 +01:00
claudiulodro a2b208d5b8 Include failing test 2017-08-09 15:00:13 -07:00
Claudio Sanches 1b93282245 Change note to content 2017-07-13 19:30:25 -03:00
Claudio Sanches 54d0d23f94 Order note helper tests 2017-07-12 18:46:52 -03:00
claudiulodro 863193bd34 Fix linting problems 2017-07-06 11:12:02 -07:00
Trey Richards f019070307 Fixed major issue with getting orders when both before_date and after_date args are set.
Modified unit tests to prevent from happening again.
2017-06-30 17:30:16 -07:00
Brent Shepherd 1992d90d37 Revert "Merge pull request #14706 from crodas/make_get_item_consistent"
This reverts commit 56ffa3d2aa, reversing
changes made to 64a60de24f.
2017-06-27 22:28:23 -07:00
claudiulodro 62064d56f8 Add edge case test 2017-06-13 14:00:12 -07:00
claudiulodro f1a9dbc69e Extra checks and tests 2017-06-13 13:32:21 -07:00
claudiulodro f020d54e67 Add support for paginate and return ids in wc_order_query 2017-06-12 13:26:29 -07:00
Cesar Rodas c96c62f380 Improved how taxes are applied
If by default the taxes are based on the shipping address and the current order doesn't have any, it would use the billing address rather than using the Shopping base location.

It's basically what WooCommerce is [doing already in Javascript](https://github.com/woocommerce/woocommerce/blob/master/assets/js/admin/meta-boxes-order.js#L526-L575). This kind of checks should be done in the backend, never in the client side.
2017-06-01 15:51:55 -04:00
Mike Jolley 56ffa3d2aa Merge pull request #14706 from crodas/make_get_item_consistent
Make get item consistent
2017-05-31 11:10:09 +01:00
Cesar Rodas bf095190c4 Improved data unit tests 2017-05-29 12:51:12 -04:00
claudiulodro 4faad7d964 Finish unit tests and bugfixes 2017-05-23 18:44:37 -07:00
claudiulodro 52fc3ad4c6 Good progress on order unit tests 2017-05-23 06:55:28 -07:00
claudiulodro fc365d29eb Change test to better check validity 2017-05-10 13:20:07 -07:00
claudiulodro 93835f69db New working date query format 2017-05-09 14:49:45 -07:00
claudiulodro c89e389b3f Good progress towards better date queries 2017-05-09 11:37:45 -07:00
Claudio Sanches 257594a67c Merge pull request #14945 from woocommerce/pr/14875
Pr/14875
2017-05-08 13:56:12 -03:00
Paul Kilmurray 71e462469a Problem in WC_Abstract_Order->get_items()
This only effects new items, which are given duplicate array keys, eg: `new:0`, `new:1` etc.
2017-05-04 19:12:19 +09:00
Paul Kilmurray b5f182e14d Problem in WC_Abstract_Order->get_items()
This test will fail.

If the order is created with different item types, eg: *line_item* and *fee*, they will both be given the key `new:0`. Items with duplicate keys are not combined in the `get_items` function ([line 703](https://github.com/woocommerce/woocommerce/blob/master/includes/abstracts/abstract-wc-order.php#L703)).
2017-05-04 18:47:43 +09:00
claudiulodro 11c7722eff Update tests 2017-04-27 14:46:00 -07:00
claudiulodro 6aecb15505 Reduce scope 2017-04-27 08:38:18 -07:00
claudiulodro 9f0f0cd246 Polish and cleanup 2017-04-26 10:49:19 -07:00
Cesar Rodas 38f379a7d7 Make get_item() consistent (like get_items())
Right now get_item() is loading an item from the database directly. It doesn't
take advantage of our cache and it doesn't check if the item is already loaded in memory.

There is also another bug (or feature?) that it will let you load any item, even if the item is not related to the current order. I believe this is a bug, if somebody really wants to load any item regardless of the order they should use `WC_Order_Factory::get_order_item`.

Another bug is that items loaded with get_item() are not related to the order object, therefore any calls to Order::save() won't persist the changes made to the item.

This commits makes sure the item returned by get_item is loaded similarly like get_items() does, taking advantage of the cache and the $items protected property (chances are the item is already in memory, ready to be used).

If a given item is not found false will be returned. If item exists but it is not related to the current object it will return false as well (If this behaviour is wanted, I can easily change it load the item anyways instead of returning false).
2017-04-26 02:54:14 -04:00