Commit Graph

1724 Commits

Author SHA1 Message Date
Peter Fabian 2b8d2cf3dd PHPCS on test file. 2019-03-13 13:30:59 +01:00
Peter Fabian 0aa9a09d18 Enforced attribute order to make result unambiguous. 2019-03-13 12:36:46 +01:00
Adrien Foulon a316101358
Fix tests 2019-03-13 11:58:59 +01:00
Peter Fabian 918ea3c5aa Added test for attribute_summary. 2019-03-12 18:40:04 +01:00
Mike Jolley c39f447ff4 Merge branch 'fix/22937' 2019-03-12 13:27:13 +00:00
Mike Jolley 0877e7d8f7
Merge pull request #22954 from woocommerce/add/blocks-rest-api
Merge blocks branch: add 8 product blocks and related API endpoints
2019-03-11 15:18:20 +00:00
Mike Jolley fbda3a91d8 Merge feature/add-tracks into master 2019-03-11 15:15:50 +00:00
Mike Jolley e55bb84e8b
Merge pull request #22718 from woocommerce/experiment/product-sorting-index
Performance: product sorting lookup table
2019-03-11 13:27:10 +00:00
Kelly Dwan 845300c975 Update test names and comments to reflect correct user role 2019-03-08 15:16:59 -05:00
Mike Jolley 15ca2144d3
Merge pull request #22773 from woocommerce/performance/delete-empty-meta
Performance: delete empty meta
2019-03-08 10:22:31 +00:00
Mike Jolley e7c8db0796
Merge pull request #22887 from woocommerce/update/22882-additional-system-status-values
Additional System Status Options
2019-03-08 10:15:45 +00:00
Mike Jolley a3c2dcd8f2 Update from master 2019-03-08 09:50:56 +00:00
Kelly Dwan 39a8bbf54c Fix space/tab issue for phpcs 2019-03-07 12:32:55 -05:00
Claudio Sanches 14b96f0026 Fixed a typo 2019-03-07 14:23:17 -03:00
Claudio Sanches 7938e352e3 Fixed coding standards 2019-03-07 14:16:07 -03:00
Claudio Sanches ef50a1d5a4 Introduced unit tests for wc_sanitize_phone_number 2019-03-07 14:14:39 -03:00
Mike Jolley 598ac86e95 Tests 2019-03-07 11:08:29 +00:00
Timmy Crawford 85713c4c1a Updates per feedback. 2019-03-06 17:26:18 -05:00
Timmy Crawford 2b59c5db64 REST API: Add Blocks Products Controller 2019-03-06 17:26:17 -05:00
Timmy Crawford e17d835e66 REST API: Add wc-blocks/v1/products/categories 2019-03-06 17:26:16 -05:00
Timmy Crawford afdde006f1 Remove some copied 'terms' in the test file. 2019-03-06 17:26:16 -05:00
Timmy Crawford f4e17ddcee REST API: Add wc-blocks/v1/products/attributes controller. 2019-03-06 17:26:15 -05:00
Timmy Crawford f2fa01d585 PHPCS fixes. 2019-03-06 17:26:15 -05:00
Timmy Crawford c1313d433c Updates per feedback. 2019-03-06 17:26:14 -05:00
Timmy Crawford 4311670956 REST API: wc-blocks/v1/products/attributes/%d/terms 2019-03-06 17:26:13 -05:00
Mike Jolley edb378fcea Tweak test (test_wc_format_coupon_code) now the format function matches titles 2019-03-06 11:53:20 +00:00
Mike Jolley 16a0a3e27e Update from master 2019-03-05 19:03:01 +00:00
Gerhard 5ce0ea762a Missed PHPCS fix 2019-03-05 14:33:10 +02:00
Paul Sealock d968b95b53 Add opt in/out to settings page 2019-03-05 11:06:45 +13:00
Mike Jolley 5af9d968e5 Update from master 2019-03-01 10:29:17 +00:00
Rodrigo Primo 25f0023d38 Fix PHPCS violations automatically using phpcbf 2019-02-27 18:09:11 -03:00
Mike Jolley cc8e516f7a
Merge pull request #22786 from woocommerce/improve/user-registration
Improve user's display_name generation during checkout
2019-02-27 12:55:56 +00:00
nishitlangaliya ee621eec8a fix: filter prefix changed and unit test added for fn:wc_get_product_stock_status_options 2019-02-25 19:03:57 +05:30
Claudio Sanches 79847ccb93 Fixed coding standards 2019-02-20 16:30:46 -03:00
Claudio Sanches 3ac5f32a8b Updated tests for wc_create_new_customer 2019-02-20 16:29:10 -03:00
Mike Jolley 7def966e4f Impoved JSON handling 2019-02-20 12:00:47 +00:00
Mike Jolley d45734b6f3 Tweak indexes tests to test shipping indexes correctly 2019-02-19 15:35:28 +00:00
Mike Jolley 07eadfeb72
Merge pull request #22760 from woocommerce/performance/webhook-loading
Performance: webhook loading
2019-02-19 09:58:06 +00:00
Mike Jolley 2529cd60cd
Merge pull request #22731 from woocommerce/update/21952
Prevent webhooks for drafts and correct create vs updated for manual orders
2019-02-19 09:50:51 +00:00
Claudio Sanches c01e334500 Fixed coding standards 2019-02-18 17:59:34 -03:00
Mike Jolley 4fd2a9f77e Update from master 2019-02-18 15:04:58 +00:00
Mike Jolley 519b29d734 Tests 2019-02-15 12:25:04 +00:00
Mike Jolley 08e8c76eab Update tests 2019-02-15 12:16:59 +00:00
Mike Jolley 84299ff5ed Update the tests 2019-02-13 17:56:41 +00:00
Mike Jolley 0e21b3f4ce Tests 2019-02-07 20:35:45 +00:00
Mike Jolley b2c33b8e34 Merge branch 'master' into performance/slow-term-queries 2019-02-07 13:49:48 +00:00
Mike Jolley 889cf64ac4 Merge branch 'performance/wc-get-product-class' 2019-02-07 13:34:18 +00:00
Mike Jolley 4b485eba13 Fixed unit tests 2019-02-06 21:00:07 +00:00
Mike Jolley 72314f9dbc Contains was backwards 2019-02-05 14:21:06 +00:00
Mike Jolley cafe8b6b57 Tests check the image URL is contained rather than exact string 2019-02-05 14:11:07 +00:00
Mike Jolley de8ff9b719 phpcs 2019-02-01 14:38:47 +00:00
Mike Jolley 3697f5104a fix uncat display 2019-02-01 13:08:04 +00:00
Mike Jolley 1e3e5a4528
Merge pull request #22580 from woocommerce/fix/22515
recalculate coupons after adding coupon to order
2019-01-31 14:38:59 +00:00
Mike Jolley 133d108bd8
Merge pull request #22269 from Prospress/fix/22247
convert user creation GMT datestamp to local datetime in API
2019-01-31 12:56:40 +00:00
Toby Robles 59d4a81f1a
Peruvian currency updated 2019-01-30 10:43:52 -05:00
Ron Rennick 28710a522e phpcs sniff fixes for orders.php 2019-01-27 20:57:58 -04:00
Ron Rennick d888f456f8 remove line item subtotal adjustment from api coupon unit test 2019-01-27 20:49:02 -04:00
Mike Jolley 20330b01bd
Merge pull request #22531 from rellect/fix_ssl_check
Fix ssl check in case shop page no longer exists
2019-01-23 20:18:43 +00:00
Refael Iliaguyev 398bbe3754 sniff fixes 2019-01-23 17:26:17 +02:00
Refael Iliaguyev 8f0f22c11b Fix ssl check in case shop page does not exists. 2019-01-23 16:08:13 +02:00
Luigi 548b00c660 Improve the way we do queries (#22043)
* Improve the way we do queries

* PHP legacy compatible

* Update aproach to filter queries with empty values

* Fixing Unit Tests

* Moving Unit Test to its the correct test function

* Filter missing the new param, allow_empty, also simplifiying unit test.

* Helper function to create counpon does not support empty coupon codes

* Helper function does not need to allot empty search

* Wrong code standard

* Fixing Code Standard Unit Test
2019-01-23 13:46:32 +00:00
Mike Jolley 99f663ad5c
Merge pull request #22131 from willgorham/improve-shipping-zone-continents
Improve shipping zone continents [Fixes #22130]
2019-01-23 13:27:16 +00:00
Ron Rennick 89ab2748da update unit test to work when timezone_string is not set, add timezone assertions 2019-01-22 16:58:05 -04:00
Mike Jolley 380201be33
Merge pull request #22417 from woocommerce/fix/21175
Sort countries using new ascii comparison function
2019-01-22 14:47:41 +00:00
Mike Jolley 7ac26ce893
Merge pull request #22518 from Prospress/fix/21779_redux
Fix/21779 redux
2019-01-22 13:29:40 +00:00
claudiulodro cdfe34f79a skip couple tests on old versions 2019-01-21 10:02:55 -08:00
Mike Jolley 6367d19615 phpcs 2019-01-21 08:11:40 -08:00
Ron Rennick ab6012fa3f move test parameters with calculations to separate lines 2019-01-18 23:32:47 -04:00
Ron Rennick 6daf89ad6e add descriptions to report sale by date tests 2019-01-18 23:27:11 -04:00
Ron Rennick 2bb2475e92 phpcs sniff fixes for class-wc-tests-report-sales-by-date.php 2019-01-18 23:26:45 -04:00
Brent Shepherd 739af008c6 Fix test_wc_load_webhooks_status_and_limit()
As the status is being explicitly passed to wc_load_webhooks(), it
will load webhooks with that status, not just active.
2019-01-18 14:30:35 +10:00
Brent Shepherd ed55a3976a Test against $wp_filter instead of has_filter()
Because we don't have the same WC_Webhook instance as used in
wc_load_webhooks(), so it's impossible to check if the same
object's process() method is attached as a callback.
2019-01-18 14:30:35 +10:00
Brent Shepherd 9fdbb124ae Add $limit param to wc_load_webhooks()
And the corresponding data stores. Defaults to null, meaning do not
limit, for backward compatibility.
2019-01-18 14:30:35 +10:00
Brent Shepherd 67bf101aaf Add $status param to wc_load_webhooks()
And the corresponding data stores. Defaults to '', meaning do not
load only webhooks with a specific status. This maintains backward
compatibility. However, the call to wc_load_webhooks() within
WooCommerce::load_webhooks() can now only load active webhooks, as
they are the only ones that should be enqueued.
2019-01-18 14:29:34 +10:00
Brent Shepherd 8ee3e8a6e9 Add WC_Tests_Webhook_Functions::create_webhook()
To make it reusable.
2019-01-17 15:12:29 +10:00
Claudiu Lodromanean 989865469e
Merge pull request #22416 from woocommerce/fix/21871
Incorrect rounding of multiple tax rates per location
2019-01-16 09:32:51 -08:00
unknown 883ecc3ca4 removed variable that was not being used 2019-01-11 19:19:15 -05:00
Gerhard c24faa8ab4 Use array_values when checking assertSame for sort comparison of arrays. 2019-01-11 14:02:54 +02:00
Gerhard 0c3f5261c7 Add unit tests for wc_ascii_uasort_comparison 2019-01-11 13:48:37 +02:00
Mike Jolley a4a421a86b Failing test case for the issue 2019-01-11 11:34:47 +00:00
Mike Jolley 1815928208 Merge branch 'master' into pr/21217 2019-01-10 13:10:11 +00:00
Rodrigo Primo 519886838c
Merge pull request #21969 from woocommerce/add/21964
Add woocommerce_valid_location_types filter
2019-01-09 17:02:20 -02:00
Rodrigo Primo 8b129a89bf phpcs fixes 2019-01-09 16:33:38 -02:00
Will Gorham ec9d1d9402 Tests phpcs 2019-01-09 13:31:51 -05:00
Will Gorham 56fa520b8e Tests for get_shipping_continents() 2019-01-09 13:31:30 -05:00
Mike Jolley ade1021eff
Merge pull request #22205 from woocommerce/fix/22200
Introduce wc_is_webhook_valid_status
2019-01-08 15:32:57 +00:00
Mike Jolley 9a37852bee
Merge pull request #21438 from woocommerce/fix/20997
Unit tests for testing inclusive calculations
2019-01-08 15:31:35 +00:00
Mike Jolley 9644241cef update from master 2019-01-08 14:51:05 +00:00
Mike Jolley 6dba8f3b05
Merge pull request #21498 from liquidweb/feature/sanitize-order-id-tests
Add tests for wc_sanitize_order_id()
2019-01-07 12:46:11 +00:00
JeroenSormani f4775ccd90 Use shipping method instead of property through magic + doc return statements 2019-01-04 12:41:38 +00:00
Claudiu Lodromanean 2f82039869
Merge pull request #21938 from Prospress/fix/21935
Unescape imported escaped CSV formulas in product attributes
2019-01-02 11:59:39 -08:00
Ron Rennick 5dac4075b2 phpcs sniff fixes for customers.php 2018-12-27 11:18:22 -04:00
Ron Rennick bd65e65285 update customer unit test 2018-12-27 11:02:28 -04:00
Ron Rennick a924c15dee unpdate unit tests for product export 2018-12-13 13:54:51 -04:00
Gerhard 4852db1e45 PHPCS fixes 2018-12-12 10:38:43 +02:00
Gerhard 189f346c2e Add unit tests for wc_is_webhook_valid_status 2018-12-12 10:33:52 +02:00
Rodrigo Primo f7bc3fb851
Merge pull request #21366 from birgire/unit-tests-count-asserting-21365
Use assertCount instead of assertEquals
2018-12-05 11:15:52 -02:00
claudiulodro d1533261f5 Extra sanitizing around payment_method_title 2018-11-30 08:49:43 -08:00
Gerhard e4ba5c7f3f Add unit tests for new woocommerce_valid_location_types filter. 2018-11-19 13:21:02 +02:00
Claudiu Lodromanean 900d3bad93
Merge pull request #21778 from woocommerce/fix/21426
Make get_on_sale_products not include non published parent results
2018-11-06 15:50:31 -05:00
claudiulodro 0fa1448cfe Topic blacklist 2018-11-02 10:21:30 -07:00
Gerhard 0bb4ef713b Add tests to make sure draft parent products are not included in the get_on_sale_products results 2018-11-01 12:13:47 +02:00
Gerhard be5775a28c Add unit test for wc_checkout_fields_uasort_comparison 2018-10-31 08:46:49 +02:00
AlexeyKhmyrov c432c619d1 Change unit tests for wc_format_dimensions() 2018-10-23 13:56:27 -05:00
Rodrigo Primo 12af00e38f
Merge pull request #21605 from woocommerce/fix/21578
Fix: WC_Product::get_image() should use $attr parameter
2018-10-18 14:34:02 -03:00
Claudiu Lodromanean c994956f03
Merge pull request #21573 from woocommerce/fix/21548
Simplified path check for CSV importer to cause less issues
2018-10-18 07:56:34 -07:00
Rodrigo Primo 05aa357b98 Add unit tests for WC_Product::get_image() 2018-10-17 19:40:57 -03:00
Rodrigo Primo bbf6282d07 Simplify WC_Product_Simple tests
Use setUp() method to define a product object that is used in all the tests instead of duplicating code and creating a product object in every test.
2018-10-17 19:22:16 -03:00
Steve Grunwell 550b309901 Merge branch 'master' into feature/sanitize-order-id-tests 2018-10-17 02:21:04 +00:00
Steve Grunwell 6f77040eb4 Since PHP 5.2 runs a *really* old version of PHPUnit (that doesn't support the @testWith annotation), run the scenarios in a single test case 2018-10-17 02:05:10 +00:00
claudiulodro ccdf6d0253 Simplified path check for CSV importer to cause less issues 2018-10-15 13:50:34 -07:00
Rodrigo Primo 2854f8654b Add two unit tests for wc_dropdown_variation_attribute_options()
Those two tests covers only the basic functionality of this function.
2018-10-15 12:20:31 -03:00
Claudiu Lodromanean e0d31107ea
Merge pull request #21523 from woocommerce/fix/21509
Fix DB log handler cleanup
2018-10-12 08:22:22 -07:00
claudiulodro 4be0018c09 Backwards compatibility in unit test 2018-10-11 13:31:37 -07:00
Claudio Sanches 06e5fe1fd8 Fixed coding standards in unit tests 2018-10-11 13:31:37 -07:00
claudiulodro c9c12c2518 Initial implementation 2018-10-11 13:31:37 -07:00
claudiulodro cf96455559 Add test to verify issue 2018-10-11 13:31:37 -07:00
claudiulodro 5f2b915f18 Add filter for ease of extensions 2018-10-11 13:31:30 -07:00
claudiulodro 75bfc8e4bb Add unit tests 2018-10-11 13:31:30 -07:00
Rodrigo Primo b9c364a475 Add call to parent::tearDown()
It is usually necessary to call parent::tearDown(); when extending tearDown() to make sure WordPress cleanup routines are executed after each test.
2018-10-11 13:31:27 -07:00
claudiulodro f2422a284a Remove filter after running tests 2018-10-11 13:31:27 -07:00
claudiulodro 26b188569b Add filter for disabling file path check 2018-10-11 13:31:27 -07:00
claudiulodro 441fe32f0b Add filetype checking for all files located on the server 2018-10-11 13:31:18 -07:00
Rodrigo Primo 2a08fa3a7b Add test to check WC_Log_Handler_DB::delete_logs_before_timestamp() basic functionality 2018-10-11 15:25:12 -03:00
Rodrigo Primo 402144893b Remove unnecessary code to cleanup tests
WP test case cleans the database automatically after each test so there is no need to do it automatically.
2018-10-11 15:11:28 -03:00
Rodrigo Primo af32bfe329 Fix phpcs violations automatically using phpcbf 2018-10-11 15:10:46 -03:00
Steve Grunwell c3b76a38f7 Add a test for handling errors during order status transitions 2018-10-06 18:09:44 +00:00
Steve Grunwell 65cda44fe6 Add tests for wc_sanitize_order_id()
This commit adds four test cases (via a PHPUnit data provider) for the `wc_sanitize_order_id()` function.

While writing the tests, it was also discovered that the function was returning a *string*, not an integer as indicated by the DocBlock, so explicit type-casting was added.
2018-10-04 13:53:55 +00:00
Claudiu Lodromanean 543c63072d
Merge pull request #21461 from dgwatkins/master
The orderby=ID argument needs to be uppercase.
2018-10-03 10:13:53 -04:00
Claudiu Lodromanean 2368c4d4a8
Merge pull request #21448 from dyszczo/bugfix/logger-instance-warning
Fix for warning in wc_get_logger when woocommerce_logging_class retur…
2018-10-03 10:05:25 -04:00
David Garcia Watkins 7a55f67f47 Fix test 2018-09-28 18:46:05 +02:00
Claudiu Lodromanean 9f77ef8526
Merge pull request #21455 from woocommerce/fix/20912
Change query to save session data
2018-09-27 10:39:46 -07:00
Claudiu Lodromanean f5d5cad65c
Merge pull request #21241 from woocommerce/fix/21226
Revise coupon logic and add tests.
2018-09-27 08:58:47 -07:00
Rodrigo Primo 4ca5afe248 Add unit tests to cover some of the WC_Session_Handler methods 2018-09-26 14:48:28 -03:00
dyszczo 6019e91e5e php 5.3 compatibility 2018-09-26 15:53:52 +02:00
dyszczo 94ed5a2460 fix for wc_logger test 2018-09-26 15:37:08 +02:00
dyszczo 7f5122d502 Fix for warning in wc_get_logger when woocommerce_logging_class returns valid logger instance 2018-09-26 12:56:59 +02:00
claudiulodro f14463e07a Unit tests for testing inclusive calculations 2018-09-25 10:41:23 -07:00
Claudio Sanches 13b265a076 Fixed unit tests 2018-09-20 17:48:31 -03:00
Birgir E 62e3418267 init 2018-09-16 12:09:50 +00:00
Gerhard Potgieter 9a15f422c3 Add unit test for wc_sanitize_endpoint_slug 2018-09-14 09:42:19 +02:00
Claudio Sanches ac47cd6394 Test if coupon is invalid 2018-09-11 18:31:02 -03:00
Claudio Sanches 0d49421239 Fixed coding standards 2018-09-11 18:11:31 -03:00
Claudio Sanches d4b1089150 Fixed unit tests 2018-09-11 18:11:11 -03:00
Claudio Sanches 518d1f0a00 Updated unit tests 2018-09-10 19:26:37 -03:00
Claudio Sanches 61873627a7 Merge branch 'master' into feature/rest-api-v3 2018-09-10 19:16:22 -03:00
Claudiu Lodromanean ba0a989a38
Merge pull request #21306 from woocommerce/feature/21115
[REST API] Reports totals endpoints
2018-09-10 10:23:56 -07:00
Peter Fabian 252670b616 Merge branch 'feature/rest-api-v3' into save-old-tests
# Conflicts:
#	tests/unit-tests/api/products.php
2018-09-10 16:07:35 +02:00
Peter Fabian f6ca4db90e Updated tests for settings endpoint to reflect changes in v3 REST API. 2018-09-10 15:53:41 +02:00
Peter Fabian ec4000232d Updated tests to reflect changes for variations in v3 REST API. 2018-09-10 15:49:07 +02:00
Peter Fabian b6f229238e Updated payment gateways tests for v3 REST API. 2018-09-10 15:42:46 +02:00
Peter Fabian f68bef3e24 Update customers endpoint tests for v3 REST API. 2018-09-10 14:20:23 +02:00
Claudio Sanches 047ad849b4 Fixed /reports/products/totals unit tests 2018-09-08 23:10:20 -03:00
Claudio Sanches 14a1217218 Load all product types even when empty 2018-09-08 22:45:51 -03:00
Claudio Sanches e154b9d0a6 /reports/reviews/totals unit tests 2018-09-08 22:33:59 -03:00
Claudio Sanches e322f279cd /reports/products/totals unit tests 2018-09-08 22:33:44 -03:00
Claudio Sanches 570d0aa3e5 /reports/orders/totals unit tests 2018-09-08 22:33:30 -03:00
Claudio Sanches 975d855edc /reports/customers/totals unit tests 2018-09-08 22:33:14 -03:00
Claudio Sanches c2b4146db3 /reports/coupons/totals unit tests 2018-09-08 22:32:20 -03:00
Claudiu Lodromanean 0cc137be1e
Merge pull request #20848 from woocommerce/fix/20844
Make wc_get_attachment_image_attributes do what it is suppose to.
2018-09-07 12:08:34 -07:00
claudiulodro 08a76e1eea Add srcset handling 2018-09-07 11:36:03 -07:00
Peter Fabian 028db78960 Updated tests. 2018-09-06 17:41:24 +02:00
Claudio Sanches bf69627cb1 Unit tests 2018-09-03 11:05:17 -03:00
claudiulodro e24aa057ad Revise coupon behavior and add unit tests 2018-08-31 08:35:41 -07:00
Coen Jacobs e737d879e1 Make related unit test variables more readable 2018-08-31 07:47:05 -07:00
Claudiu Lodromanean fd722da88a
Merge pull request #21188 from woocommerce/fix/21156
Updated phone validation and formatting rules.
2018-08-30 09:52:13 -07:00
Grzegorz Rola a1cc439569 Code style changes. 2018-08-29 19:43:57 +02:00
Grzegorz Rola 2a7d84c208 Clean data after test. 2018-08-29 19:24:29 +02:00
claudiulodro 20886138aa Add unit test to verify coupon validation changes 2018-08-29 13:28:43 -03:00
Grzegorz Rola 9e32117d73 Tests. 2018-08-29 18:18:57 +02:00
Claudiu Lodromanean b80c6d86fc
Merge pull request #21207 from woocommerce/speedup-get-request-url-test
Reduce WC_Tests_Paypal_Gateway_Request::test_request_url() execution time
2018-08-28 13:25:09 -07:00
Rodrigo Primo 8b62d5b06e Reduce WC_Tests_Paypal_Gateway_Request::test_request_url() execution time
This commits reduces the execution time of the test WC_Tests_Paypal_Gateway_Request::test_request_url() from about 30s to about 6s (which is still super slow and even after this change this test is still the slowest in our test suite). This test creates several products that are needed to test different scenarios. To make it run faster, the code was changed to create the WC_Product objects without saving them to the database. Just interacting with the objects is enough to this test and skipping the database makes it run much faster. Other tests might benefit from the same technique.
2018-08-27 19:04:50 -03:00
Rodrigo Primo f830c3e3dc Remove more unnecessary cleanup code from unit tests
See #21150 for more details.
2018-08-27 18:37:33 -03:00
Rodrigo Primo 7b6fcd18b5 Remove unused code 2018-08-27 17:54:55 -03:00
claudiulodro 00e9af285c Fix shipping tests and clean up code 2018-08-27 13:14:32 -07:00
Claudiu Lodromanean 1b405c2c12
Merge pull request #21162 from wackywombaat12/Fix/20987
Fix/20987
2018-08-24 09:51:23 -07:00
Claudiu Lodromanean 0627ef916c
Merge pull request #21165 from woocommerce/fix/21145-2
Added tests for _fields query param for system_status/tools endpoint.
2018-08-24 09:42:29 -07:00
claudiulodro 2466728183 Set up unit tests for v3 api and v2 api 2018-08-24 08:49:37 -07:00
Peter Fabian e2ebf84f65 Updated API version in test to v3. 2018-08-24 17:24:52 +02:00
Peter Fabian b05cfc6b17 Updated API version in test to v3. 2018-08-24 17:22:38 +02:00
Peter Fabian 6f025fbcc4 Updated test comment. 2018-08-24 15:56:10 +02:00
Peter Fabian 897af8d20e Updated phone validation and formatting rules. 2018-08-24 15:43:46 +02:00
Jack Boyle 63b84ef407 Fix Requested Changes
Changed to check if field exists and the field is not blank.
2018-08-24 13:03:09 +10:00
Claudiu Lodromanean 9b222d69c9
Merge pull request #21170 from woocommerce/update/remove-tests-unnecessary-code
Remove unnecessary cleanup code from more unit tests
2018-08-23 14:07:47 -07:00
Claudiu Lodromanean babfacd6bb
Merge pull request #21108 from woocommerce/fix/21025
Set tabindex=1 for notices
2018-08-23 13:11:08 -07:00
Rodrigo Primo 5f6c729107 Remove unnecessary clean up code from unit tests
This commit removes unnecessary clean up code form some unit tests. All database changes done during a test are automatically reverted after the test finishes, so it is not necessary to write code to manually remove them. This change simplifies the test code and make it run a bit faster.
2018-08-23 15:15:17 -03:00
Rodrigo Primo b7507ca8b3 Automatically fix phpcs violations using phpcbf 2018-08-23 15:15:11 -03:00
Peter Fabian cf466aedd8 Added tests for _fields query param for system_status/tools endpoint. 2018-08-23 15:33:58 +02:00
Peter Fabian c4dc7cb0de Added test for _fields for system_status endpoint. 2018-08-23 15:19:04 +02:00
Jack Boyle fd33f2c2a6 Added Tests
Added Tests for new wildcard functionality.
2018-08-23 15:23:35 +10:00
Peter Fabian dde3c9fa7b Fixed unit tests. 2018-08-22 10:12:32 +02:00
Rodrigo Primo aa8c0c7629 Remove unnecessary cleanup code from cart test
This commit removes a bunch of unnecessary cleanup code from cart tests. All database changes are automatically reverted after each test, so it is not necessary to write code inside the test to manually revert the changes that were made. One test method was split into three different methods for clarity and to avoid having to revert database changes manually between each part of the test.

This change makes the tests easier to read but also reduced the execution time of the cart tests in about 15%.
2018-08-21 11:41:31 -03:00
Peter Fabian e8956953ba Updated test. 2018-08-09 12:22:26 +02:00
Claudiu Lodromanean 11911aa2ea
Merge pull request #20870 from woocommerce/add/export-products-based-on-category
Add category filter to product export functionality.
2018-08-08 08:51:58 -07:00
Gerhard Potgieter 136f7689eb Update unit test for product exporter category to be array. 2018-08-07 17:44:27 +02:00
Claudiu Lodromanean d32a675c25
Merge pull request #20931 from woocommerce/fix/download-log-data-store
Fix: orderby and order parameters in WC_Customer_Download_Log_Data_Store::get_download_logs()
2018-08-04 07:57:17 -07:00
Claudio Sanches 355eba85ca Updated unit tests 2018-07-31 13:46:59 -03:00
Claudio Sanches 7416be5644 Updated unit test class name 2018-07-31 13:36:31 -03:00
Claudio Sanches ab2514bfd4 Updated unit tests for reviews 2018-07-31 13:33:51 -03:00
Rodrigo Primo b09bb3eee9 Fix: orderby and order parameters in WC_Customer_Download_Log_Data_Store::get_download_logs()
This commit fixes a bug in WC_Customer_Download_Log_Data_Store::get_download_logs() that made impossible to change the order in which the query returned the results. This method accepts the arguments order_by and order, but it was ignoring them and always using the default values ('download_log_id' and 'ASC' respectively).

It also introduces a very basic unit test to cover the method main functionality and to make sure that the parameters order and orderby are not ignored anymore.

It seems that the modified method was inspired in WC_Customer_Download_Data_Store::get_downloads() before the same bug was fixed in #18620.
2018-07-30 16:40:21 -03:00
Peter Fabian 4e7bc117e4 Update unit tests. 2018-07-26 15:11:24 +02:00
Gerhard Potgieter 73b80c9241 Remove extra asterisk 2018-07-25 14:09:04 +02:00
Gerhard Potgieter 5a0d3c8bf7 Fix indentation issues caused by github conflict tool 2018-07-25 14:07:57 +02:00
Gerhard Potgieter da82639ebc
Merge branch 'master' into update/core-function-unit-tests 2018-07-25 14:05:12 +02:00
Claudiu Lodromanean 9e3da78c73
Merge pull request #20853 from woocommerce/reduce-test-suite-execution-time
Reduce WC_Tests_REST_System_Status tests execution time
2018-07-24 10:46:26 -07:00
Claudiu Lodromanean a0b4a8df03
Merge pull request #20611 from woocommerce/fix/20349
Allow filtering variations by attributes in API.
2018-07-24 10:25:36 -07:00
Gerhard Potgieter 7143b67189 Include setting category to product export test 2018-07-23 12:26:58 +02:00
Gerhard Potgieter 8aba169654 Switch travis codecoverage from xdebug to phpdbg (#20857)
This commit changes the travis codecoverage from using xdebug to phpdbg, phpdbg seems much faster and gives similar results.

Reason for switching is we have been running into constant timeouts on our codecoverage due to the 50min job limit on travis, which means our codecoverage has not been updated in a couple of months.

* Remove xdebug as it slows tests down, switch to using phpdbg for code coverage.

* Update parameters for phpdbg

* It is qrr not qqr

* Include vendor/bin path when using phpdbg

* Use PHP 7.1 to run phpdbg

* Update phpunit dire

* Include $HOME in phpdbg call to phpunit

* Set no memory limit to avoid out of memory errors.

* Assign timeout group to test_request_url test for paypal and do not execute that on coverage as it causes a memeory timeout. Test needs optimization to run for code coverage.

* @covers usage for methods should be prefixed with ::
2018-07-20 09:34:43 -03:00
Rodrigo Primo f47c9e7842 Reduce WC_Tests_REST_System_Status tests execution time
This commit changes WC_Tests_REST_System_Status tests to use artificial HTTP responses instead of performing external HTTP requests. With this change execution time for these tests droped from 22s to 3s.
2018-07-19 14:22:29 -03:00
Rodrigo Primo 1860cd1933 Change WC_Unit_Test_Case to extend WP_HTTP_TestCase instead of WP_UnitTestCase
This commits changes WC_Unit_Test_Case parent class to WP_HTTP_TestCase (which extends WP_UnitTestCase). This way all WC core test classes can benefit from the functionality provided by WP_HTTP_TestCase if needed. This is necessary because otherwise test classes can use the functionality provided by WC_Unit_Test_Case or WP_HTTP_TestCase. This change should not affect test classes that don't explicitly call one of the WP_HTTP_TestCase features.
2018-07-19 14:17:06 -03:00
Rodrigo Primo 1d13dd4dd4 Use an artificial HTTP response for wc_do_oembeds() test
Doing this to speed up the test as an HTTP request to an external server is slow and also because it should fix this test that has been failing on Travis only for an unknown reason.
2018-07-19 10:35:32 -03:00
Rodrigo Primo fb9aa71b33 Undoing DB changes on tearDown() is not necessary
WP test suite starts a transaction when the test starts and roll it back when the test finishes. So it is not necessary to undo database changes using tearDown().
2018-07-19 10:35:19 -03:00
Gerhard Potgieter 847d5b680d Add unit test for test_wc_get_attachment_image_attributes 2018-07-19 12:04:36 +02:00
Rodrigo Primo 0e785d4614 Make WC_Tests_Product_CSV_Importer::test_import() faster
This commit changes the WC_Tests_Product_CSV_Importer class to use artificial HTTP responses instead of performing real HTTP requests to a external server to get the images of the imported products. On my local machine, this change reduced the test execution time from 3257ms to 831ms.

As a consequence of this change, this commit also fixes WC_Tests_Product_CSV_Importer::test_import() in all Travis builds. This test has been failing for a few weeks on Travis but not on our local environments. After some debugging, I found out that the test was failing on Travis because of the following error when `wp_safe_remote_get()` was called to get images for the imported products:

```
Error getting remote image http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_1_front.jpg. Error: cURL error 35: gnutls_handshake() failed: Handshake failed.
```

Apparently, the PHP binary that is used by Travis is unable to handle the TLS handshake (see https://github.com/travis-ci/travis-ci/issues/6339) and the test probably started failing when demo.woothemes.com (which is used to download the images for the imported products) switched from HTTP to HTTPS.
2018-07-18 17:16:26 -03:00
Gerhard Potgieter 1f46caaa4c Test some edge cases where CC name could be empty or contain a non standard value. 2018-07-16 13:02:24 +02:00
Gerhard Potgieter 370c200076 Make wc_array_cartesian test use predefined array for testing against instead of relying on product attributes. 2018-07-16 12:59:01 +02:00
Gerhard Potgieter 9e495478f4 Add unit test for wc_decimal_to_fraction 2018-07-11 15:17:00 +02:00
Gerhard Potgieter a28253739f Add wc_get_permalink_structure unit test 2018-07-11 15:10:55 +02:00
Gerhard Potgieter 0c01b6c3bb Add wc_get_credit_card_type_label unit test 2018-07-11 15:05:18 +02:00
Gerhard Potgieter 1d5605c9dc Add wc_array_cartesian unit test 2018-07-11 14:59:05 +02:00
Gerhard Potgieter 2f7e42bb2f Add wc_get_theme_support unit test 2018-07-11 14:38:33 +02:00
Gerhard Potgieter eb533d0263 Update test_get_woocommerce_currencies to test for both cached and uncached currencies, gives us more code coverage 2018-07-11 14:25:42 +02:00
Gerhard Potgieter a6e7ae15f9 Add unit test for testing wc_get_user_agent 2018-07-11 14:11:31 +02:00
Peter Fabian 7443a2f906 Switched variation creation to CRUD methods for unit test. 2018-07-09 18:27:56 +02:00
Peter Fabian 3af9c1e95b Merge branch 'master' into fix/20349
# Conflicts:
#	tests/framework/helpers/class-wc-helper-product.php
#	tests/unit-tests/api/products.php
2018-07-09 18:18:06 +02:00
Peter Fabian 4a42e2a7fc Added unit tests for query params for variations REST API endpoint. 2018-07-09 17:12:23 +02:00
Peter Fabian 55d7ea4ac5 Improved unit tests for products REST API endpoint. 2018-07-09 17:11:50 +02:00
Gerhard Potgieter bc3c780b92 PHPCS fixes 2018-07-09 13:04:16 +02:00
Gerhard Potgieter 1fdcf2a238 Fix log file deletion functionality. 2018-07-09 13:01:23 +02:00
Peter Fabian 6c70064a82 Added test products API for product tag and attributes query parameters. 2018-07-06 16:57:40 +02:00
Peter Fabian fe77b9e54f Fixed the variation product helper in unit tests.
Previously, the variable product had 2 variations, but one of them had a term assigned ('large') that wasn't assigned to the parent product. Normally, when variable product is created, parent has all the terms assigned to its children assigned.
2018-07-06 16:00:59 +02:00
Peter Fabian 9c420125a3 Added tests for API query parameters for products endpoint. 2018-07-06 12:58:57 +02:00
Claudiu Lodromanean 2a3cedddcd
Merge pull request #20520 from woocommerce/feature/product-custom-tables-supporting-changes
Product custom tables supporting changes
2018-06-27 08:57:50 -07:00
Gerhard Potgieter 2df62edec1 Improve the replacement for wc_format_phone_number a bit more, seems like we allow spaces and plus signs, remove non visible unicode with seperate preg_replace 2018-06-27 09:37:44 +02:00
Peter Fabian 8fd4777fb4 Fixed PHPCS whitespace. 2018-06-25 10:57:52 +02:00
Peter Fabian 6ba409b772 Added category related unit tests for products API. 2018-06-23 13:54:36 +02:00
Rodrigo Primo b6e73f528b Merge branch 'master' into feature/product-custom-tables-supporting-changes 2018-06-15 14:56:31 -03:00
Claudiu Lodromanean c203ff16d9
Merge pull request #20482 from woocommerce/fix/20452
Avoid price setting when synced with children
2018-06-15 09:05:13 -07:00
Mike Jolley 9a550c4a35 Update to correct type in unit test 2018-06-14 16:34:36 +01:00
Claudiu Lodromanean 73dbec001a
Merge pull request #20456 from JPry/custom_coupon_item_limit
Custom coupon item limit
2018-06-13 09:57:47 -07:00
Mike Jolley 31058ac215 Tests -> CRUD 2018-06-13 16:30:42 +01:00
Gerhard Potgieter ab769eb8a7 Update test_save_default_attributes to make use of propper attributes before checking defaults 2018-06-13 15:49:38 +02:00
Mike Jolley 812586742b Allow only valid default attributes 2018-06-13 14:33:13 +01:00
Mike Jolley 9ec7eba0f6 update image URLs 2018-06-13 11:53:30 +01:00
Mike Jolley c37f724326 Break up tests/test contents 2018-06-13 11:39:28 +01:00
Mike Jolley 01a3e359c3 Merge branch 'master' into feature/product-custom-tables-supporting-changes 2018-06-13 10:18:38 +01:00
Gerhard Potgieter 3b9d403b02 Add geolocation::get_ip_address tests 2018-06-11 11:10:11 +02:00
Claudiu Lodromanean 3d4dfda568
Merge pull request #20435 from rnaby/070618-212333-wc-privacy-exporters-customer_data_exporter
Removed unnecessary parameter. Also removed from tests.
2018-06-08 11:34:42 -07:00
Jeremy Pry a2d3313b36 Add unit tests around coupon item limit setting
Also updates the `WC_Helper_Coupon` class to make it easier to register custom coupon types during tests.

For #20455
2018-06-08 14:17:39 -04:00
Claudiu Lodromanean dc20237f40
Merge pull request #20426 from woocommerce/fix/20386
Made path /orders/refund_id return invalid order id msg instead of error.
2018-06-07 10:50:46 -07:00
Khan M Rashedun-Naby 4b14cbc727 Removed unnecessary parameter. Also removed from tests. 2018-06-07 21:25:13 +06:00
Peter Fabian b5c420de99 Fixed milestone according to issue tag. 2018-06-07 15:36:27 +02:00
Peter Fabian 185675c69e Added unit test to cover the orders/refund_id. 2018-06-07 14:58:53 +02:00
Mike Jolley 4df54b4e53 Merge branch 'master' 2018-06-07 11:24:12 +01:00
Mike Jolley 58c5ddc8d0 Remove test 2018-06-07 11:23:11 +01:00
Rodrigo Primo 7979ea6b1a Use ob_end_clean() instead of ob_get_clean()
Doing this change since the content of the output buffer is not used.
2018-05-29 09:02:40 -03:00
Gerhard Potgieter b3a9d5b4c2 Remove unused variables 2018-05-29 07:33:19 +02:00
Gerhard Potgieter dbd476e7de Add unit tests for importing taxes 2018-05-28 11:18:42 +02:00
Gerhard Potgieter 54b23918b9 Fix broken system status unit test, https://github.com/woocommerce/woocommerce/pull/20231 introduced a new item to the schema 2018-05-25 14:19:14 +02:00
Mike Jolley 58b9be29b9
Merge pull request #20191 from woocommerce/fix/20186
Product import from file on server
2018-05-25 12:29:27 +01:00
Gerhard Potgieter 2f9c9e4954 Fix server file upload test 2018-05-25 13:00:59 +02:00
Mike Jolley f05167df17
Merge pull request #20222 from liquidweb/fix/iso-3166-1-alpha-2
Ensure tests use ISO 3166-1 alpha-2 country codes
2018-05-25 10:32:48 +01:00
Mike Jolley 171139295c
Merge pull request #20193 from woocommerce/fix/20192
Fix WC_Coupon constructor with Coupon object
2018-05-25 10:29:38 +01:00
Steve Grunwell 4bbf9c364d Ensure tests use ISO 3166-1 alpha-2 country codes
[According to the WooCommerce wiki](https://github.com/woocommerce/woocommerce/wiki/Order-and-Order-Line-Item-Data) and `WC_REST_Orders_Controller`, WooCommerce stores country codes using the ISO 3166-1 alpha-2 (2 character) standard. However, the `WC_Tests_Order_Functions::test_wc_get_order_address_params()` test method was using 'USA' instead of 'US'.
2018-05-24 20:50:01 +00:00
Peter Fabian 082c1dfaf3 Excluded children categories from WP_Query in product shortcode if cat_operator=AND. 2018-05-24 16:12:48 +01:00
Gerhard Potgieter 3c2221a4b0 Add a exception test to coupon delete 2018-05-24 12:37:52 +02:00
Gerhard Potgieter 9bc6ca5df3 Fix the coupon data store delete unit test, you should not have been able to create a new datastore from a deleted coupon ID. See product data store tests are reference for this. 2018-05-24 12:26:36 +02:00
Gerhard Potgieter 07c18b59f0 Add unit test to test again passing a coupon object in the constructor 2018-05-24 11:28:24 +02:00
Gerhard Potgieter dbafe34ed2 Fix test to test the actual file upload and not just the import 2018-05-24 09:18:26 +02:00
Gerhard Potgieter 16385a957c Add unit test for testing products in ABSPATH on server. 2018-05-24 08:56:57 +02:00
Gerhard Potgieter ad24b9c9d9
Merge pull request #20041 from woocommerce/fix/20039
Wrap cell in ' rather than prepend
2018-05-18 12:27:26 +01:00
Gerhard Potgieter b73cf49278 Update unit tests to conform to new escaping 2018-05-18 12:09:56 +01:00
Steve Grunwell 317e7ba29f Revert most of 74a3f1d6
As @claudiosanches pointed out, there isn't much real-world need for `WC_Install::get_tables()` to sort results. Instead, sort the returned value within the `WC_Tests_Install::test_get_tables()` method.
2018-05-11 22:46:46 +00:00
Steve Grunwell 226aedd4e2 Merge branch 'master' into fix/table-ordering 2018-05-11 17:11:02 +00:00
Steve Grunwell 74a3f1d6d8 Sort the results of WC_Install::get_tables()
Since custom tables can be registered within WooCommerce via the 'woocommerce_install_get_tables' filter, it's helpful to ensure that `WC_Install::get_tables()` automatically sorts the table names alphabetically.

This helps avoid false failures when testing a plugin that uses a custom table against the WooCommerce core test suite, as queries like `WC_Tests_Install::test_get_tables()` assumes that tables will be returned in alphabetical order.
2018-05-11 16:18:49 +00:00
Claudiu Lodromanean 6f2c807f1c
Merge pull request #19984 from woocommerce/fix/19640
Basic range download handling for Force download.
2018-05-09 09:08:15 -07:00
Peter Fabian 2b9a5a6330 Removed test to reflect changes in track download method. 2018-05-09 15:54:38 +02:00
Peter Fabian 7c30b1fac5 Fixed PHPCS problems in test file. 2018-05-09 12:45:17 +02:00
Peter Fabian 4da0f1f793 Added test for range download logging. 2018-05-09 12:04:38 +02:00
Claudiu Lodromanean bc59be04fa
Merge pull request #20009 from woocommerce/update/wc-orders-query-tests
Add test to check WC_Order_Query when using the 'customer' parameter
2018-05-08 13:57:54 -07:00
Rodrigo Primo 42e801db0c Add test to check WC_Order_Query when using the 'customer' parameter 2018-05-08 17:24:16 -03:00
Rodrigo Primo 3e8cd3f837 Remove unnecessary tests cleanup code
Tests don't need to manually remove data that they create. WP test framework does that automatically after each test is executed.
2018-05-08 16:00:00 -03:00
Rodrigo Primo 47f6104580 Add more unit tests to improve test coverage of functions in includes/wc-stock-functions.php 2018-05-08 15:58:03 -03:00
Rodrigo Primo 41f5985087 Fix PHPCS violations automatically using phpcbf 2018-05-08 15:48:55 -03:00
Rodrigo Primo b43f828a7b Fix PHPCS violations automatically using phpcbf 2018-05-08 11:55:32 -03:00
Rodrigo Primo 5d9dadca87 Remove unnecessary cleanup code from orders unit tests
It is not necessary to manually remove data added to the database after each test. WP unit tests framework does this automatically.
2018-05-08 11:52:58 -03:00
Claudiu Lodromanean bda8732c6f
Merge pull request #19974 from woocommerce/update/payment-method-columns
Updates table styling and columns
2018-05-07 11:23:49 -07:00
Mike Jolley cf9fa5b3ff Updates table styling and columns 2018-05-04 18:48:41 +01:00
Rodrigo Primo 7d5f6d3746 Remove WC API unit tests cleanup code
WC unit tests don't need to remove data from the database before finishing. `WP_UnitTestCase` creates a transaction before each test starts and roll it back after it ends, so data is never actually written to the database. This simplifies the tests and makes them faster.
2018-05-04 11:45:30 -03:00
Rodrigo Primo 7ce69dfca2 PHPCS fixes 2018-05-04 11:42:45 -03:00
Mike Jolley e807c6151f Merge branch 'master' into update/erasure-requests 2018-05-02 14:06:47 +01:00
claudiulodro 9c1179856d Update unit tests 2018-05-01 09:32:29 -07:00
Mike Jolley 7ae9919a19 Fix tests 2018-05-01 16:53:05 +01:00
Mike Jolley d40b704cba Remove deprecation test 2018-05-01 13:39:32 +01:00
Mike Jolley adf1c92666 Sets the option before running test so it passes :) Broken in #19871 2018-04-27 10:01:02 +01:00
Rodrigo Primo 214c9ae9c7 Use integer instead of string to set download ID
WC core supports both integers and strings as values to the download ID but this is necessary to make the core unit tests pass when running them in the context of the custom product tables plugins. This plugin accepts only integers for the download ID.
2018-04-26 16:47:38 -03:00
Rodrigo Primo 49804b3172 Merge branch 'feature/product-custom-tables-supporting-changes' of github.com:woocommerce/woocommerce into feature/product-custom-tables-supporting-changes 2018-04-26 16:46:10 -03:00
Rodrigo Primo c9a146aeba phpcs fixes 2018-04-26 14:46:17 -03:00
Rodrigo Primo 597033ca6f Merge branch 'master' into feature/product-custom-tables-supporting-changes 2018-04-24 13:47:22 -03:00
Rodrigo Primo 920006b8b9 Test setup methods should call parent setup method
This commits adds a call to `parent::setUp()` inside WC_Tests_Product_CSV_Importer::setUp(). This is necessary to make sure transactions are used on database calls and thus tests don't have to worry about cleaning inserted data.

I found this issue while debugging https://github.com/woocommerce/woocommerce-product-tables-feature-plugin/issues/81. Turns out this test was failing because WC_Tests_Product_CSV_Importer::test_import() was leaving one post in the database due to a bug in the custom product tables plugin.
2018-04-23 10:40:16 -03:00