Commit Graph

1849 Commits

Author SHA1 Message Date
Ron Rennick d888f456f8 remove line item subtotal adjustment from api coupon unit test 2019-01-27 20:49:02 -04:00
Galen Wright-Watson baeccdc547 Fix: #22577-"bad flag in substitute command" if password has a '/' character. Cause: unescaped special characters (forward slash) in variable get interpreted as part of sed script. Soln: escape forward slashes when interpolating into sed script. 2019-01-26 23:53:02 -08: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
Gerhard cadcad2c6a Add the -s param to the PHPCS command to see the rules it is failing again when running the precommit hook. 2019-01-17 13:23:14 +02: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
Mike Jolley 9d381d456b Remove simplify commerce gateway 2019-01-10 12:01:27 +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 0620389e46
Merge pull request #22266 from woocommerce/e2e-update-db
Update e2e tests database to WP 5.0.1 and WC 3.5.2
2019-01-09 12:14:47 +00: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
Rodrigo Primo c6a0c32427 Merge branch 'master' into split-travis-build-job 2018-12-19 11:09:46 -02:00
Rodrigo Primo ee51edad22 Update e2e tests database to WP 5.0.1 and WC 3.5.2 2018-12-19 13:00:55 +00:00
Ron Rennick e04b0fff31 use a more appropriate description for new installation tests 2018-12-18 16:28:49 -04:00
Ron Rennick 6079e1f541 ensure WP database is upgraded for current WP version 2018-12-18 16:02:57 -04:00
Ron Rennick e2f34928d3 update checkout flow for 3.5.0 2018-12-18 14:23:11 -04:00
Ron Rennick 603dd8cfcd remove redundant form update in cart page tests 2018-12-17 16:05:53 -04:00
Ron Rennick 3ab427f8bf add config-theme.js to test that a functional supported theme is active 2018-12-17 15:42:20 -04:00
Ron Rennick 729e7083ae move front end tests to front-end folder 2018-12-17 15:19:34 -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 644f6b1cba Use separate Travis build jobs to run e2e tests and PHPCS
This commit creates two new Travis build jobs, one to run the e2e tests and another to run PHPCS. Doing this, instead of running those two checks in the same build job as the PHP 7.2 unit tests, should make the total build time shorter and it should make it easier to see why the build failed.
2018-12-06 09:14:13 -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
Rodrigo Primo 8b85eee2d0 Ignore WP beta releases when setting WP_TESTS_TAG
This commit changes the regular expression used to determine the WP_TESTS_TAG variable to ignore WP beta releases otherwise install_test_suite() will fail to download the test suite. This is part of workaround to run WooCommerce unit tests using PHP 7.3 and WP 5.0 beta-5.
2018-11-20 14:43:38 -02: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
Claudiu Lodromanean 4b9ab4b8db
Merge pull request #21513 from scottcwilson/readme_assert
Fixes #21363 Recommends using assertSame rather than assertEquals
2018-10-10 09:07:14 -07:00
Scott C Wilson bdf406eb1e Fixes #21363 Recommends using assertSame rather than assertEquals 2018-10-09 07:34:54 -04: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
Claudiu Lodromanean ea9aa8cd59
Merge pull request #21344 from Chouby/fix_testcase
setUpBeforeClass must always call its parent
2018-09-14 10:53:04 -07:00
Gerhard Potgieter 9a15f422c3 Add unit test for wc_sanitize_endpoint_slug 2018-09-14 09:42:19 +02:00
Frédéric Demarle 620008d46a setUpBeforeClass must always call its parent 2018-09-13 13:35:22 +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
claudiulodro 0e67fd6d4d Reset payment gateways between tests 2018-08-27 12:05:13 -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
Peter Fabian a26530f84a
Merge pull request #20846 from woocommerce/fix/e2e-tests
Enable SCRIPT_DEBUG on e2e tests
2018-07-19 11:18:38 +02:00
Gerhard Potgieter c3993accd4 Set SCRIPT_DEBUG to true for e2e tests since we never commit minified js during dev, only once we do a release do we minify scripts. 2018-07-19 09:06:11 +02:00
Rodrigo Primo 34ec2e87c0 Add wp-http-testcase directly to the repository
This commit adds the composer package jdgrimes/wp-http-testcase directly to this repository instead of via composer. Doing this because I couldn't find a way to make this package work on Travis build jobs running older versions of PHP and I don't think it is worth investing much time on it.
2018-07-18 18:19:39 -03: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 28cb32e54b PHPCS fixes. 2018-07-09 18:30:10 +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 e769029af6 Make create_attribute function for PHPUNIT more versatile by removing hardcoding. 2018-07-06 16:08:32 +02:00
Peter Fabian 1091eb5feb PHPCS corrections. 2018-07-06 16:01:49 +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
Peter Fabian 97983a2d45 Fixed missing terms in unit tests.
in teardown method, terms are deleted, so e.g. Uncategorized product_cat was only avaialble if test was run individually, not in the whole batch. Should now be fixed.
2018-06-23 13:50:31 +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 77e887efe9 code standards 2018-06-13 16:55:39 +01: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
Rodrigo Primo 69e1547cd9 Update e2e tests database to the latest WC db version 2018-06-12 09:02:40 -03:00
Brent Sessions 8fc43f0cad Skip upload from forks (#20462)
This will skip the uploading of screenshots if the S3 key is not present. This will happen when there is a PR for a fork submitted.

* Skip upload from forks

* trying with failing test

* Fixing tests

* need a rebuild
2018-06-11 13:59:59 -03: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
Rodrigo Primo c2616b74f2
Merge pull request #20439 from woocommerce/update/improve-e2e-screenshots
Only try to upload screenshots if directory is not empty
2018-06-08 09:34:45 -03: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
Rodrigo Primo cc4871e5ca Only try to upload screenshots if directory is not empty
This commit adds a check before the code that uploads screenshots of failed e2e tests to make it run only if running the Travis build job that executed the tests and if the screenshots/ directory is not empty. There is no need to always download Travis artifacts and try to upload to S3 if there is nothing to upload.
2018-06-07 11:50:36 -03:00
Brent Sessions c64a35300a Take screenshots of failed e2e tests (#20313)
This adds screenshots for broken e2e tests. The screenshots will also be uploaded to an Amazon S3 instance from Travis CI so they can be viewed. If run locally, there will be a screenshots directory created where they can be viewed

If there is a failed e2e test you'll see a block under `travis.sh after` in the build log in Travis CI that will give the URLs for the images.

* Adding screenshot capabilities to all tests

* trying screenshots on S3

* try to get a failed test

* finding the right path

* fixing yml

* only taking failed screenshots

* fixing yml

* moving paths to env

* fixing target

* try without artifact target

* fixing test

* setting back temporary changes

* fixing spacing

* unneeded change

* trying different uploader

* Force a failed test

* fixing test again

* fixing  unneeded change

* updating git ignore
2018-06-07 11:31:37 -03: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
Gerhard Potgieter 0d8f002769 Unset the server variable on teardown to avoid out of memory errors 2018-06-01 14:49:02 +02: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
Mike Jolley 2aec467de8
Wait for address fields to update in e2e checkout test (#20176)
* See if this error is breaking e2e

* Revert "See if this error is breaking e2e"

This reverts commit 3de6d71fc7.

* wait for address update
2018-05-23 12:56:35 +01: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