Commit Graph

915 Commits

Author SHA1 Message Date
Caleb Burks ed55ae0117 Fix “risky” tests
WC_Tests_API_Functions::test_wc_rest_check_post_permissions
This test did not perform any assertions

WC_Tests_API_Functions::test_wc_rest_check_user_permissions
This test did not perform any assertions

WC_Tests_API_Functions::test_wc_rest_check_product_term_permissions
This test did not perform any assertions
WC_Tests_API_Functions::test_wc_rest_check_manager_permissions
This test did not perform any assertions
2017-07-12 23:06:38 -05:00
Claudio Sanches 54d0d23f94 Order note helper tests 2017-07-12 18:46:52 -03:00
Mike Jolley 2fdb78a5b0 Update test to reflect new text 2017-07-12 16:18:43 +01:00
Mike Jolley 022c528b3e Remove value renaming code 2017-07-12 15:18:05 +01:00
Websupporter 057c8b3281 Fix typo in test
Just a quick typo fix.
2017-07-11 14:43:54 +03:00
Daniel Rey Lopez 04a83b0faa Change the "Rest of the World" zone name to "Locations not covered by your other zones" everywhere 2017-07-11 08:19:42 +01:00
Claudiu Lodromanean 1699a9769f Merge pull request #16020 from woocommerce/feature/12273
New attribute helper functions
2017-07-10 13:20:59 -07:00
claudiulodro 03403b2c44 Allow times in date fields 2017-07-10 09:19:59 -07:00
Akeda Bagus 53807185a8
Fixed typos.
These typos are catched by `misspell` program.

```
find . -type f | grep -v assets | grep -v dummy-data | grep -v i18n | grep -v node_modules | grep -v .git | grep -v apigen |  xargs misspell -w
```

Some results were excluded because of 3rd party ownership and non-english
sentences.
2017-07-10 12:56:28 +07:00
Claudio Sanches e10c27f9bd Attributes helpers unit tests 2017-07-07 18:50:27 -03:00
claudiulodro 863193bd34 Fix linting problems 2017-07-06 11:12:02 -07:00
Claudio Sanches bf91127682 Merge pull request #15788 from woocommerce/fix/13353
Clean up user is_paying_customer after deleting an order
2017-07-04 16:26:45 -03:00
Mike Jolley b9757cca00 leave objects alone rather than slashing in the meta api
Has tests. Prevents notices when you pass an object to add_meta_data.
2017-07-04 16:09:21 +01: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
Mike Jolley 77c938202f Merge branch 'add/15602-store-street-level-address'
# Conflicts:
#	assets/css/admin-rtl.css
#	assets/css/admin.css
2017-06-30 15:00:51 +01:00
Mike Jolley 4f66d214fa Merge pull request #15829 from woocommerce/fix/15725
Use type check in coupon constructor
2017-06-29 22:42:43 +01:00
claudiulodro f5d5890a50 Add tests 2017-06-29 14:05:38 -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
Mike Jolley dd25736d64 Clean up user is_paying_customer after deleting an order 2017-06-26 18:32:36 +01:00
Allen Snook 25c9219849 Add unit tests for new address city and postcode fields 2017-06-19 13:12:39 -07:00
claudiulodro 1d3c4ebb4d Add flag for timeout checking 2017-06-14 11:35:22 -07:00
claudiulodro 86c43459fc Update test 2017-06-14 11:08:39 -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
claudiulodro 384e8d85f4 Finish user func tests 2017-06-09 11:37:28 -07:00
claudiulodro ddd86bcff4 Good progress on user func tests 2017-06-08 14:30:23 -07:00
claudiulodro cdd24bf8e1 Increase country unit test coverage 2017-06-07 14:31:32 -07:00
Mike Jolley 9fd3ed3503 Merge pull request #15482 from woocommerce/update/e2e
Update e2e testing to latest version and add new tests.
2017-06-07 10:30:29 +01:00
Claudio Sanches e86232032f Fixed tests for wc_rest_urlencode_rfc3986() 2017-06-06 17:43:40 -03:00
claudiulodro 07796aeece E2e testing 0.3.0 2017-06-06 11:58:01 -07:00
Mike Jolley 4c7f8c0fbd Revert thousand removal in wc_format_decimal, and add more tests 2017-06-06 12:44:58 +01: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
Claudio Sanches bc3c7f6bbd Merge branch 'master' into fix/15315 2017-05-31 11:59:49 -03:00
Claudio Sanches d9e946491f Merge pull request #15357 from woocommerce/fix/15274-meta
Add ability to invalidate cache by object ID
2017-05-31 11:53:53 -03:00
Mike Jolley eda55579b7 Merge pull request #15373 from woocommerce/feature/product-csv-import-export
Product CSV Import Export
2017-05-31 13:57:37 +01:00
Mike Jolley 21300951f1 Fix tests due to generated names 2017-05-31 13:48:28 +01:00
Mike Jolley 32ab4fb47f Merge pull request #15360 from woocommerce/fix/15228
Store user ID and use that to determine if the session should be loaded or not.
2017-05-31 13:03:29 +01:00
Mike Jolley 532ddfa6b0 Merge conflicts 2017-05-31 12:23:52 +01: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
Claudio Sanches 51ddc36080 Skip empty attributes and reset indexes 2017-05-30 19:26:31 -03:00
Claudio Sanches 611695b9f4 Updated and fixed importer unit tests 2017-05-30 17:58:34 -03:00
Claudio Sanches 0f79138b17 Included download name and URL into the sample.csv 2017-05-30 15:01:43 -03:00
Claudio Sanches 18e903df15 Updated unit test sample.csv 2017-05-30 14:26:16 -03:00
Mike Jolley a042643141 Fix tests 2017-05-30 17:36:16 +01:00
Mike Jolley 11d7189ed3 Unit test showing the issue 2017-05-30 14:12:11 +01:00
Mike Jolley 4ea9138d3e Code and test improvements 2017-05-30 11:54:31 +01:00
Cesar Rodas bf095190c4 Improved data unit tests 2017-05-29 12:51:12 -04:00
Claudio Sanches 6287176741 Updated sample.csv data 2017-05-26 20:05:41 -03:00
Ninos Ego 9f56561905 Typo 2017-05-26 20:21:35 +02:00
Ninos Ego b0dc827f0a CS & small fix in unit test 2017-05-26 20:15:57 +02:00
Ninos Ego e7b3aa352a Added: Unit test 2017-05-26 19:43:50 +02:00
Mike Jolley 67dde58d83 Tests 2017-05-26 16:00:32 +01:00
claudiulodro c08140a293 Formatting 2017-05-25 14:45:36 -07:00
claudiulodro e00d7b7c55 File metadata by id 2017-05-25 14:43:36 -07:00
claudiulodro df06d6f942 Merge remote-tracking branch 'origin/feature/product-csv-import-export' into HEAD 2017-05-25 12:41:26 -07:00
claudiulodro a99d7ff099 Exporter tests and tweaks 2017-05-25 12:33:14 -07:00
Mike Jolley ba305eacb5 Fix tests 2017-05-25 18:16:10 +01:00
claudiulodro 6d098b9c21 Clean up and some tests 2017-05-25 08:41:11 -07:00
Mike Jolley d2da39e046 Merge branch 'pr/14549' 2017-05-25 11:51:55 +01:00
Mike Jolley 7ec25f987f Only replace the user set thousand separator and add test 2017-05-25 11:51:45 +01:00
Kelly Dwan 0a265b53a2 Add display_name to customer data store 2017-05-24 13:57:11 -04:00
Mike Jolley f866f164eb Merge pull request #15244 from woocommerce/improvement/15187
Order query unit tests and fixes.
2017-05-24 12:03:40 +01:00
Claudio Sanches 3fbaa8607a Fixed unit tests for WC_Product_CSV_Importer 2017-05-24 03:44:27 -03: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
Claudio Sanches f294447543 Fixed unit tests 2017-05-19 19:18:09 -03:00
Timon Davis af308da6b9 Fix bug #15103 where site operator cannot assign a variation with value of '0' as the default choice on the customer facing form.
The WC_Product::set_default_attributes function uses an array_filter (using the default callback for filtration)
to remove null and false values from the defaults array for a given product.  The issue here is that, in the above use case,
the array_filter will evaluate '0' as 0 and therefore as false.  Ultimately, array_filter then prevents the value from being
recorded, moving forward.

I've added a new filter callback to includes/wc-attribute-functions which will disregard all FALSE PHP equivalents except for
'0' (as a a string).  Also, I've updated the filter_array call in WC_Product::set_default_attributes so that it uses this new callback,
instead of the PHP default. Finally, I've added a phpunit test to assert that, when storing default variations / attributes on a product,
the false/true PHP synonyms are evaluating and storing like one would normally expect, with the exception that (string) '0'
evaluates as true in this special case.

This solution could potentially be broadened to facililate similar rules elsewhere, but the need raised in the bug is specific and
this is a specific solution.
2017-05-18 02:43:14 -07:00
Mike Jolley 3d5f1c1fe6 Merge branch 'feature/product-csv-import-export' into feature/csv-importer 2017-05-17 10:36:39 +01:00
Claudio Sanches 8f1eb262e3 Updated importer tests 2017-05-16 01:42:55 -03:00
Claudio Sanches 020e61927b Created abstract product class 2017-05-16 01:02:46 -03:00
Claudio Sanches c375fa03ff Disable importer tests for now 2017-05-15 20:43:53 -03:00
Claudio Sanches 09cf382d29 Initial code to create/update in the CSV importer 2017-05-15 20:23:44 -03:00
Claudio Sanches 121f8f6315 Abstract the product importer 2017-05-15 19:49:53 -03:00
Justin Shreve 0c5588aac7 Makes sure that the 'base location' setting is returned to the /settings/general endpoint correctly. It uses a special setting type that the API didn't handle properly. 2017-05-15 10:21:06 -07:00
claudiulodro 824d8898a2 Fix unit tests 2017-05-12 08:44:02 -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 58fa8542b6 Merge pull request #14933 from woocommerce/fix/14815
Use numeric, not decimal
2017-05-08 15:36:39 -03:00
Mike Jolley 24fe8db5eb Fix test 2017-05-08 19:14:33 +01:00
Claudio Sanches 257594a67c Merge pull request #14945 from woocommerce/pr/14875
Pr/14875
2017-05-08 13:56:12 -03:00
Mike Jolley dd3be1278b Merge pull request #14733 from woocommerce/feature/13646
WC_Object_Query & WC_Order_Query
2017-05-07 14:24:12 +01:00
claudiulodro b907aa74f6 Finish parser and unit test 2017-05-04 14:20:59 -07: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
Claudio Sanches 7b5d56c643 [REST API] Adds missing "id" in shipping zone methods endpoint
This missing "id" will break CLI.

Added as duplicated with `instance_id` to keep backwards compatibility.

Fixes #14831
2017-05-02 20:37:03 -03:00
Mike Jolley 4b0fff3437 Fix zone routes in CLI
Fixes #14750
2017-04-28 15:49:51 +01:00
claudiulodro 11c7722eff Update tests 2017-04-27 14:46:00 -07:00
claudiulodro 027e7b1f94 Add restored webhook 2017-04-27 11:44:57 -07:00
Mike Jolley a68934d7db Merge pull request #14731 from crodas/make_sure_meta_data_cache_is_not_shared
Make sure the meta data cache is not shared among instances
2017-04-27 16:50:10 +01:00
claudiulodro 6aecb15505 Reduce scope 2017-04-27 08:38:18 -07:00
Mike Jolley fc0f5f3765 fix test 2017-04-27 15:23:04 +01:00
Cesar Rodas 91de312eb2 Make sure the meta data cache is not shared among instances
See #14620 for more context. In there I thought this was the desired behaviour and I enhanced it. After talking with @mikejolley he explained to me that it was not by designed.

This commit makes sure the meta data cache is not shared among instances
2017-04-26 13:51:52 -04: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
claudiulodro efa1dbbda5 Basic working order queries 2017-04-25 14:52:17 -07:00
Mike Jolley a27e03378f update test 2017-04-25 14:46:17 +01:00
claudiulodro 553a12203b WC_Order_Query 2017-04-24 16:28:13 -07:00
claudiulodro 29fa59a0b7 WC_Object_Query 2017-04-24 11:33:17 -07:00