Commit Graph

38 Commits

Author SHA1 Message Date
claudiulodro ccdf6d0253 Simplified path check for CSV importer to cause less issues 2018-10-15 13:50:34 -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
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 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
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 2f9c9e4954 Fix server file upload test 2018-05-25 13:00:59 +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
Rodrigo Primo 4a8f34f2ee 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:34:03 -03:00
Rodrigo Primo c7c82a2335 PHPCS fixes 2018-04-23 10:33:52 -03:00
Gerhard Potgieter 80ec10fc21 Fix unit test for import, the way the test is set up it expects a no for backorders and not an empty string 2018-03-28 08:28:13 +02:00
Claudio Sanches c140331dc3 [Unit Tests] Clean products after tested is complete 2017-11-16 16:56:30 -02:00
claudiulodro 9d8e308a78 Make importer columns case-insensitive 2017-09-17 10:18:03 -07:00
Claudio Sanches 7ad0dd55f9 Allow import 'menu_order' 2017-08-22 17:22:39 -03:00
Claudio Sanches b8b9ae41f0 Fixed importer unit tests 2017-08-11 21:46:51 -03:00
claudiulodro 03403b2c44 Allow times in date fields 2017-07-10 09:19:59 -07:00
claudiulodro 863193bd34 Fix linting problems 2017-07-06 11:12:02 -07:00
claudiulodro 1d3c4ebb4d Add flag for timeout checking 2017-06-14 11:35:22 -07:00
Claudio Sanches 51ddc36080 Skip empty attributes and reset indexes 2017-05-30 19:26:31 -03:00
Claudio Sanches 611695b9f4 Updated and fixed importer unit tests 2017-05-30 17:58:34 -03:00
Claudio Sanches 0f79138b17 Included download name and URL into the sample.csv 2017-05-30 15:01:43 -03:00
Claudio Sanches 18e903df15 Updated unit test sample.csv 2017-05-30 14:26:16 -03:00
Claudio Sanches 6287176741 Updated sample.csv data 2017-05-26 20:05:41 -03:00
Mike Jolley 67dde58d83 Tests 2017-05-26 16:00:32 +01:00
Mike Jolley ba305eacb5 Fix tests 2017-05-25 18:16:10 +01:00
Claudio Sanches 3fbaa8607a Fixed unit tests for WC_Product_CSV_Importer 2017-05-24 03:44:27 -03:00
Claudio Sanches f294447543 Fixed unit tests 2017-05-19 19:18:09 -03:00
Claudio Sanches 8f1eb262e3 Updated importer tests 2017-05-16 01:42:55 -03:00
Claudio Sanches 020e61927b Created abstract product class 2017-05-16 01:02:46 -03:00
Claudio Sanches c375fa03ff Disable importer tests for now 2017-05-15 20:43:53 -03:00
Claudio Sanches 09cf382d29 Initial code to create/update in the CSV importer 2017-05-15 20:23:44 -03:00
Claudio Sanches 121f8f6315 Abstract the product importer 2017-05-15 19:49:53 -03:00
claudiulodro 824d8898a2 Fix unit tests 2017-05-12 08:44:02 -07:00
claudiulodro b907aa74f6 Finish parser and unit test 2017-05-04 14:20:59 -07:00