Commit Graph

1511 Commits

Author SHA1 Message Date
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
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
claudiulodro 20886138aa Add unit test to verify coupon validation changes 2018-08-29 13:28:43 -03: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
Claudiu Lodromanean 1b405c2c12
Merge pull request #21162 from wackywombaat12/Fix/20987
Fix/20987
2018-08-24 09:51:23 -07: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
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
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