Commit Graph

856 Commits

Author SHA1 Message Date
James Collins 285daf466b Correctly calculate order total when adding the product 2017-04-06 18:02:06 +08:00
James Collins 09cbf5f816 Avoid deprecated warning when creating an order in unit tests
Unexpected deprecated notice for Action: woocommerce_order_add_product
2017-04-06 17:11:59 +08:00
Justin Shreve 08537218b1 mend 2017-04-05 14:46:17 -07:00
Justin Shreve 15bf1da7d5 Call save_meta_data before wp_update_post for data stores that use it, and refresh meta cache after. 2017-04-05 14:39:41 -07:00
Claudiu Lodromanean 160d394070 Clean up test 2017-04-05 11:13:31 -07:00
Claudiu Lodromanean 5389844a1b Use parent data for sold_individually 2017-04-05 11:02:26 -07:00
Mike Jolley d79b1edc55 Merge pull request #13397 from woocommerce/e2e-testing
E2E frontend testing
2017-03-30 16:41:24 +01:00
Claudio Sanches 1c369e41e0 Merge pull request #13810 from woocommerce/fix-typo
Fix typo
2017-03-28 15:22:45 -03:00
Claudiu Lodromanean 448d47a78c Sprinkle some periods 2017-03-28 11:15:00 -07:00
Claudiu Lodromanean 28726570bf Use new_* hooks instead of created_* 2017-03-28 11:05:45 -07:00
Akeda Bagus 757b5ae2c4
Fixed all typo in tests/ directory. 2017-03-29 01:02:31 +07:00
Mike Jolley 9aabe1ff44 Revert "sync before test"
This reverts commit 45ab4733d5.
2017-03-28 14:32:56 +01:00
Mike Jolley 29d6f69a87 Revert "Clear parent transients on variation save"
This reverts commit 0694312cc9.
2017-03-28 14:32:52 +01:00
Mike Jolley 0694312cc9 Clear parent transients on variation save 2017-03-28 13:51:22 +01:00
Mike Jolley 45ab4733d5 sync before test 2017-03-28 12:51:32 +01:00
Claudiu Lodromanean 89128da8ba Fix child_has_dimensions 2017-03-27 11:52:03 -07:00
Mike Jolley 01408ddda6 Fixed api tests 2017-03-24 15:11:21 +00:00
Mike Jolley 819448daf5 Fix unit test 2017-03-24 11:35:54 +00:00
Mike Jolley 9af295d618 Merge pull request #13753 from woocommerce/fix/rest-api-shipping-zones-schema
[REST API] Fixed shipping zones schema
2017-03-24 10:38:51 +00:00
Mike Jolley af8e892f97 Merge pull request #13759 from woocommerce/fix/rest-api-settings-links
[REST API] Fixed links of settings endpoint
2017-03-24 10:33:16 +00:00
Mike Jolley 803786ceeb Merge pull request #13755 from woocommerce/fix/shipping-zone-locations-schema
[REST API] Fixed shipping zone locations schema
2017-03-24 10:27:52 +00:00
Mike Jolley 5cb3b9e0ea Merge pull request #13751 from woocommerce/fix/rest-api-setting-options-rest-base
[REST API] Fix setting options rest base
2017-03-24 10:26:22 +00:00
Mike Jolley 0ad1f6a63f Merge pull request #13709 from woocommerce/fix-13708
Timezone/DST fixes
2017-03-24 10:25:08 +00:00
Claudio Sanches 7381b008e0 [REST API] Fixed links for settings endpoint
Do not allow embed and updated the key to reflect the items from the endpoint response
2017-03-24 01:56:50 -03:00
Claudio Sanches 7a671ab8a5 [REST API] Fixed shipping zone locations schema
This also fix improper sanitization and validation of the items.
2017-03-23 21:44:46 -03:00
Claudio Sanches c369cdc8bd Fixed shipping zones schema unit tests 2017-03-23 20:56:41 -03:00
Claudio Sanches b1023c23c6 Fixed setting options endpoint tests 2017-03-23 20:45:22 -03:00
Claudio Sanches 44319e20f7 [REST API] Fixed file name convention 2017-03-23 17:48:37 -03:00
Claudio Sanches 3f82db5cbd Fixed unit tests for review GMT dates 2017-03-23 13:39:46 -03:00
Claudio Sanches 5d19bba83d Fixed unit tests for variation image 2017-03-23 13:39:16 -03:00
Claudio Sanches caae2d2a0f Fixed Products_API::test_product_schema() total of properties 2017-03-23 13:38:25 -03:00
Mike Jolley c0218188a0 Update unit tests 2017-03-23 00:11:21 +00:00
Mike Jolley 75c55c0442 Revert "Tests"
This reverts commit a070a7f6d6.
2017-03-22 12:37:13 +00:00
Mike Jolley a070a7f6d6 Tests 2017-03-22 12:36:30 +00:00
Claudiu Lodromanean 2006ae69a1 Remove readme.md in favor of wiki 2017-03-21 10:16:30 -07:00
Claudiu Lodromanean de4757e402 Change folder name and suppress npm error swarm 2017-03-21 10:03:06 -07:00
Claudio Sanches f1dab3fdce Fixed coding standards 2017-03-21 12:38:35 -03:00
Claudio Sanches fa472689d6 Stop download phpcs from GitHub and use the composer copy 2017-03-21 12:02:53 -03:00
Claudiu Lodromanean c0a01a1fe4 Dont set empty strings as tax totals 2017-03-20 15:14:41 -07:00
Claudio Sanches 8452713225 Fill $wc_product_attributes global in unit tests 2017-03-17 18:04:50 -03:00
Claudio Sanches c8be89915c Fixed double @ 2017-03-15 13:46:02 -03:00
Claudio Sanches 59c2849736 Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
Mike Jolley 75a5b062cf Merge pull request #13577 from woocommerce/fix-13498
Timezone/Date method handling
2017-03-15 16:09:41 +00:00
Mike Jolley 5b6636e5da Unit test 2017-03-15 15:54:39 +00:00
Mike Jolley d55653a408 Merge branch 'master' into fix-13498
# Conflicts:
#	includes/class-wc-order.php
#	tests/unit-tests/crud/data.php
2017-03-15 15:52:40 +00:00
Mike Jolley 943c507d3f Merge pull request #13606 from woocommerce/fix-13525-api
Fix 13525 api
2017-03-15 15:43:45 +00:00
Mike Jolley a34dd0480d Merge pull request #13587 from woocommerce/fix-13525
Update coupon date handling
2017-03-15 15:26:41 +00:00
Claudiu Lodromanean 51b7110de2 Update API v2 2017-03-14 14:43:53 -07:00
Justin Shreve fb124232cf Update Payment Tokens to follow the same pattern for custom data as other object types.
Payment tokens was introduced in 2.6 and was updated to use the new CRUD code while some of the CRUD system was still in flux.

While most things were correct, the prop handling for custom fields (like a card's last 4 digits) were directly calling meta functions, instead of delegating to the data store/parent.

This PR moves these props to `extra_data` and follows the same pattern as product types or order items. It also updates some version tags to 3.0.0. Finally, it adds an additional test for saving meta after a create which looks like it was lacking.

To Test:
* Run `phpunit`.
* Go to the "My Account" tab and add a new payment method. You need a payment gateway that supports this, like Simplify.
* Test the add a payment method flow.
* Make a test purchase using the saved payment method.
2017-03-14 12:33:35 -07:00
Mike Jolley cbe6934f61 Try in sh file so 5.2 does not break 2017-03-14 17:17:35 +00:00
Mike Jolley 0aad398144 Add to travis yml 2017-03-14 17:11:02 +00:00
Mike Jolley 178888fbdb Travis script 2017-03-14 16:59:40 +00:00
Mike Jolley a3cc5cc9bb has_meta -> meta_exists
#13590

Avoid has_meta conflict with old method.

#13581
2017-03-14 16:49:13 +00:00
Mike Jolley 1740f1e3e8 Merge pull request #13590 from woocommerce/fix-13581
Add a has_meta method to WC_Data
2017-03-14 16:42:40 +00:00
Claudiu Lodromanean e929a7fd17 Cant use ::CLASS in php 5.2 2017-03-14 08:42:08 -07:00
Claudiu Lodromanean f042305ff7 Update date_expires meta handling 2017-03-14 08:10:31 -07:00
Mike Jolley ed09c20715 Trying to fix travis tests 2017-03-14 12:50:54 +00:00
Mike Jolley 08c6cfdea8 composer version 2017-03-14 12:28:48 +00:00
Mike Jolley 6826dcbfe1 Tests for has_meta 2017-03-14 12:08:39 +00:00
Claudiu Lodromanean dd0b167c7f Remove failing test since it's duplicated elsewhere properly 2017-03-13 14:38:05 -07:00
Claudiu Lodromanean f1925e561a Update coupon data store to use new dates 2017-03-13 14:24:05 -07:00
Mike Jolley d195aa6117 Fix unit tests 2017-03-13 20:35:04 +00:00
Claudiu Lodromanean 7d9227d3af Update coupon object with new date 2017-03-13 13:31:40 -07:00
Claudio Sanches 5b798332d2 Updated customer REST API unit tests 2017-03-10 19:51:33 -03:00
Mike Jolley 38afff0031 Merge pull request #13516 from woocommerce/fix-13505
Make increase_usage_count work correctly on concurrent checkout
2017-03-10 19:07:57 +00:00
Mike Jolley 2c59a6a86f Fix test 2017-03-10 18:59:55 +00:00
Mike Jolley 6ec06ef0db Update tests 2017-03-10 14:52:41 +00:00
Mike Jolley 90b588be18 Merge branch 'master' into tests-13533 2017-03-10 12:01:41 +00:00
Mike Jolley e2552c0a8c Unit tests 2017-03-10 12:01:40 +00:00
Claudio Sanches 23b575aebe Fixed customer CRUD unit tests 2017-03-10 01:53:06 -03:00
Justin Shreve 9724b67ab8 Fix order item meta functions cache busting.
The cache busting currently in `wc_add_order_item_meta`, `wc_update_order_item_meta`, and `wc_delete_order_item_meta` doesn't actually bust anything. The cache line looks like it is from 2.6. The relevent cache to bust is actually in the `order-items` group and has a different key/prefix.
This bug allows your meta to get out of sync if you use these functions and then try to access a value from a CRUD object.

You can see this in the `test_wc_order_item_meta_functions` test I've added. If you keep your `wc-order-item-functions.php` as is, the asserts against `$item->get_meta` will fail.

To test:
* `phpunit --filter=test_wc_order_item_meta_functions`.
* Try before applying the `wc-order-item-functions.php` changes and after.
2017-03-09 13:36:23 -08:00
Claudiu Lodromanean 0dcae9a01d Remove accidentally committed file 2017-03-09 13:26:19 -08:00
Claudiu Lodromanean 8564de4b82 Config loading tweaks 2017-03-09 13:24:36 -08:00
Justin Shreve cd92351dd7 Fix direct property access for coupon amount.
In 2.6, you could access the amount via $coupon->coupon_amount. Or legacy code incorrectly handles $coupon->amount instead. 7778583340/includes/class-wc-coupon.php (L102)

This PR handles both since the RCs and betas allowed `->amount` and I don't want to break anything that may be accessing it that way..

To Test:
* `phpunit --filter=test_coupon_backwards_compat_props_use_correct_getters`
2017-03-09 10:34:45 -08:00
Mike Jolley 6848fad224 Merge branch 'timezone-poc' into fix-13498 2017-03-09 16:10:07 +00:00
Mike Jolley 09c75cd814 More tests 2017-03-09 11:05:54 +00:00
Claudiu Lodromanean e36ee46dea Make increase_usage_count work correctly on concurrent checkoutt 2017-03-08 15:27:37 -08:00
Claudiu Lodromanean b645fc5513 Docblocks 2017-03-08 12:02:14 -08:00
Claudiu Lodromanean 3b8eb75c93 Better handling of nested arrays in apply_changes 2017-03-08 11:51:38 -08:00
Mike Jolley b5454f3403 America/New_York unit test 2017-03-08 17:44:43 +00:00
Mike Jolley dda75c3d43 Unit tests 2017-03-08 16:52:21 +00:00
Claudiu Lodromanean d0f47a7980 Revert to original behavior 2017-03-07 13:17:36 -08:00
Claudiu Lodromanean 955a75bf30 Fix changes and more tests 2017-03-07 11:58:02 -08:00
Claudiu Lodromanean 2436541fff Fix individual use coupon handling 2017-03-07 11:31:20 -08:00
Claudio Sanches e97c21c1cc Fixed unit tests 2017-03-03 16:36:53 -03:00
Claudiu Lodromanean d5fd1e46ee get_meta should return empty array sometimes 2017-03-02 11:16:49 -08:00
Claudiu Lodromanean 1eafb487d7 Allow invalid data store exceptions to bubble 2017-03-01 09:24:30 -08:00
Claudiu Lodromanean b6beaa4961 Better importing 2017-02-28 15:27:34 -08:00
Claudiu Lodromanean 24fb4fd3b8 Initial easy test setup 2017-02-28 12:00:12 -08:00
Claudio Sanches 1eccb65d85 Fixed coding standards 2017-02-24 17:30:41 -03:00
Claudio Sanches e0cffc0934 Merge pull request #13329 from woocommerce/fix-13320
Delete cached object when updating stock
2017-02-23 18:20:40 -03:00
Claudiu Lodromanean 07a021760a 13320 Delete cached object when updating stock 2017-02-23 12:56:34 -08:00
Claudiu Lodromanean 252c08b943 Map legacy tax array keys to CRUD 2017-02-23 11:14:42 -08:00
Mike Jolley 4b4597524b Added unit tests for wc_product_force_unique_sku 2017-02-23 10:05:46 +00:00
Claudio Sanches 486a81bf12 Fixed coding standards 2017-02-17 16:10:15 -02:00
Claudio Sanches 8f38924fe0 Removed filter unit tests 2017-02-17 13:43:53 -02:00
Claudio Sanches 9c15ca936b Merge pull request #13206 from woocommerce/rest-api-v2
REST API v2
2017-02-16 12:53:46 -02:00
Claudio Sanches f08c10d068 Fixed and improved the variations endpoint 2017-02-16 03:07:51 -02:00
Claudio Sanches 1d82fbd8bf Fixed products tests 2017-02-16 01:52:10 -02:00
Claudiu Lodromanean ba2b767006 Modify tests for PHP 5.2 compat 2017-02-15 13:50:25 -08:00
Claudiu Lodromanean fd9d52a3f7 Modify test for PHP <5.4 compatibility 2017-02-15 12:07:35 -08:00
Claudiu Lodromanean e8579c649c Deprecated hook handler unit tests 2017-02-15 11:34:14 -08:00
Claudiu Lodromanean 469210b02b Minor formatting cleanup 2017-02-13 11:47:28 -08:00
Claudiu Lodromanean a8b491b55b Handle product titles with no attributes 2017-02-13 11:45:25 -08:00
Claudiu Lodromanean b6b3f0c217 Modify product title logic 2017-02-10 10:19:05 -08:00
Claudio Sanches 193fab24af Fixed REST API coupons endpoint tests 2017-02-09 20:13:02 -02:00
Claudiu Lodromanean a3f9207839 Add logic to variation title generation 2017-02-09 14:03:00 -08:00
Claudio Sanches 9ac1ebe748 Updated unit tests for REST API 2017-02-09 18:21:52 -02:00
Claudio Sanches 9e1e9783d2 Fixed unit tests in PHP 5.2 2017-02-09 11:33:18 -02:00
Mike Jolley b17932f4e3 Fix test due to invalid amount and caching 2017-02-09 12:04:44 +00:00
Claudio Sanches 9b0a4e6c92 Merge pull request #13109 from woocommerce/fix-regressed-tests
Fix failing tests and array_merge error
2017-02-08 16:18:08 -02:00
Claudiu Lodromanean 8ce5356943 13106 Dont round values in get_on_sale_products 2017-02-07 13:46:00 -08:00
Claudiu Lodromanean 173c09dd04 Fix failing tests and array_merge error 2017-02-07 10:46:03 -08:00
Claudio Sanches 1fe705547f Fixed REST API batch tests 2017-02-02 19:20:07 +01:00
Mike Jolley 40e9eabf9f Merge pull request #12983 from woocommerce/get_tax_classes
WC_Tax::get_tax_class_slugs()
2017-01-26 14:10:04 +00:00
Mike Jolley 9eaffcde42 Merge pull request #12980 from woocommerce/fix/payment-token-update-props
When updating payment tokens, only update the props that have changed & fire off a hook of the changed props.
2017-01-26 14:06:44 +00:00
Justin Shreve 474a307420 Introduce get_tax_class_slugs. 2017-01-25 13:38:13 -08:00
Jon Surrell 994167046f Disable coverage except on master, not PR, 7.1 builds
This should vastly increase most automated travis builds.
Coverage reports are only interesting on master and not needed on all PRs.
2017-01-25 22:28:57 +01:00
Justin Shreve 32651f638c When updating payment tokens, only update the props that have changed + fire off a hook of the changed props. 2017-01-25 11:05:54 -08:00
Jon Surrell 2bd8b6efbc Validate handlers implement WC_Log_handler_Interface
Add tests for interface validation.
2017-01-24 23:07:58 +01:00
Mike Jolley 086ed58084 Merge pull request #12943 from woocommerce/fix-unit-tests-bootstrap
Fixed compatibility with 4.7 in tests bootstrap
2017-01-23 20:42:39 +00:00
Claudio Sanches 09123c9fc8 Merge pull request #12926 from woocommerce/fix-12910
Use mb_ functions in wc_get_wildcard_postcodes
2017-01-23 15:48:59 -02:00
Claudio Sanches 26091c4644 Fixxed compatibility with 4.7 in tests bootstrap 2017-01-23 15:37:26 -02:00
Mike Jolley 66914966fb Adjust meta saving code throughout
#12885
2017-01-23 11:30:53 +00:00
Mike Jolley f0049367ae Use mb_ functions and add tests 2017-01-22 01:24:20 +00:00
Claudio Sanches d536d15652 Merge branch 'master' of github.com:woocommerce/woocommerce 2017-01-18 16:01:02 -02:00
Claudio Sanches f54e9e1e1a Fixed coding standards 2017-01-18 15:16:01 -02:00
Justin Shreve 5fe996930f Fix alignment 2017-01-17 12:55:53 -08:00
Justin Shreve b660eda4b8 Add date searching to wc_get_orders. 2017-01-17 12:52:27 -08:00
Jon Surrell 9069bce4d3 Change travis setup to exclude coverage from all but latest stable
Add PHP_LATEST_STABLE env to travis

Use same bash conditional for test scripts
2017-01-16 21:11:21 +01:00
Jon Surrell b422de03ef Add tests for wc_get_logger
When filter provided class doesn't implement
WC_Logger_Interface, test for wc_doing_it_wrong
and use WC_Logger
2017-01-14 18:45:51 +01:00
Jon Surrell 5d7665671c Remove WC_Logger::remove
This method was added post 2.6 and does not need to be maintained/deprecated.
Remove related test.
2017-01-13 06:48:57 +01:00
Jon Surrell bb1ece4c31 Add test for deprecated WC_Logger::remove 2017-01-12 22:25:02 +01:00
Jon Surrell 29b3917f0e Test deprecated WC_Logger::clear functionality 2017-01-12 22:23:02 +01:00
Claudio Sanches 9c27661dea Synchronized with master 2017-01-12 17:53:15 -02:00
Jon Surrell e8fd29520f Un-deprecate wc_get_log_file_path 2017-01-12 20:39:39 +01:00
Mike Jolley ab76036c1f Enable 7.1 tests 2017-01-11 12:58:10 +00:00
Jon Surrell 1006fc209e Fix DB handler tests for default source 2017-01-08 22:15:04 +01:00
Jon Surrell acd338fb87 Add default source to WC_Log_Handler_DB 2017-01-08 21:42:56 +01:00
Dwain Maralack e8fc25bb00 Unit Tests: Add new parameter to order helper create_order method to allow clients to override the default product. 2017-01-05 11:23:22 +02:00
Justin Shreve e4937b898d Fix PHP 7.1 warnings/notices. 2017-01-04 10:45:45 -08:00
Justin Shreve 291a662be1 The WC API returns exclude_product_ids and expiry_date. 2.7 renamed these in the API file, which we should not do until we version the endpoints. 2017-01-03 10:25:36 -08:00
Mike Jolley 98b79ddf5b Unit test warnings 2017-01-03 12:19:03 +00:00
Mike Jolley 5ec8ef50e6 Correct case 2017-01-03 11:57:21 +00:00
Jon Surrell a33fac966d Use plural in multiple log email 2016-12-29 11:58:43 +01:00
Jon Surrell 5367baeadd Fix tests for different threshold configuration
No filtering by default.
Options configuration has been removed.
2016-12-29 11:58:43 +01:00
Jon Surrell fbd91fe376 Improve email handler subject 2016-12-29 11:58:43 +01:00
Jon Surrell 4b13e3b053 Do not deprecate WC_Logger::add 2016-12-29 11:58:43 +01:00
Jon Surrell e4d5886427 Replace log `tag` with log `source` 2016-12-29 11:58:43 +01:00
Jon Surrell af7b8646c5 Remove unneeded setUp and tearDown
WC_Logger tests no longer depend on writing/reading from log files.
2016-12-29 11:58:43 +01:00