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.
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().
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.
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.
This commit adds jdgrimes/wp-http-testcase (https://github.com/JDGrimes/wp-http-testcase) composer package as a dev requirement. This package provides a PHPUnit testcase for testing code that uses the WP_Http class. Using it it is possible to create artificial HTTP responses skipping the request to external servers and making the tests faster.
This commit changes the way that WC_Background_Updater::task() calls the database update callbacks and adds the WC_Background_Updater instance as the first parameter to the callbacks. This is used in wc_update_350_order_customer_id() (36b6bd79c0/includes/wc-update-functions.php (L1870)) to monitor memory usage while the function is running. This change was intended to ship with PR #17895 (see commit c77b2f20f4) but was accidentaly removed when merging commit 083c994732 from another PR.
Fixes#20718
Adding `$thisbutton.data()` to the arguments sent by the `removed_from_cart` event.
This would help developers easily detect which product has just been removed and alter their theme/plugin accordingly.
seems the original get stock value is wrong, but I'm not sure if my change is correct...
what i'm considering is this line: if ( $product->is_type( 'variation' && 'parent' === $manage_stock ) ) {