Commit Graph

1422 Commits

Author SHA1 Message Date
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