Commit Graph

63 Commits

Author SHA1 Message Date
vedanshujain 0576b142a4 Add unit tests 2020-07-22 17:20:46 +05:30
Rodrigo Primo c792dfb192 Fix unit tests to match new tested method behavior
This commit updates two unit tests that were failing
(https://travis-ci.org/woocommerce/woocommerce-rest-api/jobs/637678251#L707),
after the behavior of the method
WC_REST_Shipping_Zones_V2_Controller::register_routes() changed in PR #104.
2020-05-11 17:32:52 +05:30
vedanshujain 569e656459 Rephrase the test so that is more resilient and error-prone 2020-05-11 17:21:56 +05:30
vedanshujain f4e093d528 Fix unit test 2020-05-11 17:21:56 +05:30
vedanshujain 57b59271bf Change file path in response to change in core 2020-05-11 17:21:56 +05:30
vedanshujain ec1e0b1110 Add unit test for trash status for products 2020-05-11 17:21:56 +05:30
Claudio Sanches ea36caf17e Removed MaxMind from System Status 2020-01-15 20:26:12 -03:00
Rodrigo Primo e325eafc9a Remove image after unit tests to make sure they pass on Travis
The test
WC_Tests_API_Functions::test_wc_rest_upload_image_from_url_should_download_image_and_return_array()
was failing on Travis with the error below due images being kept on
accros different tests. To fix this problem, this commit makes sure that
every test that creates an image, removes it after the assertions.

```
1) WC_Tests_API_Functions::test_wc_rest_upload_image_from_url_should_download_image_and_return_array

Failed asserting that two arrays are equal.

--- Expected
+++ Actual

@@ @@

 Array (
-    'file' => '/tmp/wordpress/wp-content/uploads/2020/01/Dr1Bczxq4q.png'
-    'url' => 'http://example.org/wp-content/uploads/2020/01/Dr1Bczxq4q.png'
+    'file' => '/tmp/wordpress/wp-content/uploads/2020/01/Dr1Bczxq4q-3.png'
+    'url' => 'http://example.org/wp-content/uploads/2020/01/Dr1Bczxq4q-3.png'

/home/travis/build/woocommerce/woocommerce-rest-api/unit-tests/Tests/Version3/functions.php:113
```

(https://travis-ci.org/woocommerce/woocommerce-rest-api/jobs/634921426#L719)
2020-01-15 20:25:02 -03:00
Rodrigo Primo 10f55dbff4 Fix unit test suite in the Travis build jobs
This commit fixes a problem in the script that configures the
environment to run the unit tests in the Travis build jobs. The script
was not running `composer install` in the WooCommerce directory, leaving
it installation incomplete and thus the tests were failing.

To fix this problem, this commit adds a call to `composer install` right
after WooCommerce is downloaded in the setup script
(`unit-tests/bin/install.sh`).
2020-01-15 20:22:29 -03:00
Rodrigo Primo 64f09329dd Add unit test to test filtering by field when getting system status 2020-01-15 20:21:25 -03:00
Rodrigo Primo 0cfbc27a27 Simplify and speedup WC_Tests_REST_System_Status tests
This implements two changes to WC_Tests_REST_System_Status test class:

- It simplifies the tests by setting the user in the setUp method
instead of in each test.
- Improves the performance of the tests by creating a new admin user
only once when the class is instantiated instead of once for every
single test that is executed.
2020-01-15 20:21:25 -03:00
Claudio Sanches b8763fd3e4 Added unit tests for instance_id 2020-01-15 20:17:36 -03:00
Claudio Sanches d139b35344 Test the correct orders endpoint 2020-01-15 20:16:11 -03:00
Christopher Allford 0704f6d023 Added support for filtering products and variations by their menu_order 2019-12-18 19:20:12 -03:00
Claudio Sanches 5a509591e7 Fixed unit tests 2019-12-18 19:20:00 -03:00
Claudio Sanches 3e0e9fee77 Included tests for v3 2019-12-18 19:20:00 -03:00
Claudio Sanches b0da8ca633 Included unit tests 2019-12-18 19:20:00 -03:00
Claudio Sanches ff7cd27886 Fixed unit tests 2019-12-05 22:29:02 -03:00
Rodrigo Primo 59a3bc7525 Use WP_UnitTestCase::assertWPError() instead of WC_Unit_Test_Case::assertIsWPError()
See https://github.com/woocommerce/woocommerce/pull/24207
2019-12-05 22:06:54 -03:00
Claudio Sanches 613502e57d Fixed WooCommerce 3.9 support 2019-12-05 22:03:03 -03:00
Mike Jolley 5170d9f296 Update tests 2019-07-10 11:10:50 +01:00
Mike Jolley 370d6c1a04 remove v4 for 1.0 release 2019-06-25 16:18:35 +01:00
Mike Jolley 09ef1e74cf Rename tests dir 2019-06-24 16:17:02 +01:00
Mike Jolley a703749a46 Fixed tests 2019-06-24 16:06:26 +01:00
Mike Jolley 46453550e8 Update dist file and namespaces 2019-06-21 10:40:39 +01:00
Mike Jolley 71a32c96b6 Tidy up permission checks 2019-06-18 16:06:04 +01:00
Mike Jolley 7f2ea5cc2f Fix tests for batches 2019-06-14 13:43:29 +01:00
Mike Jolley 7aa7ca1baf CS 2019-06-13 16:11:59 +01:00
Mike Jolley f927305443 set_backorders 2019-06-13 15:33:56 +01:00
Mike Jolley 4dff2b8c01 remove reports test 2019-06-13 11:38:41 +01:00
Mike Jolley dd012b2856 Update composer script 2019-06-13 11:37:56 +01:00
Mike Jolley ddfdb5b2f8 Remove unused code from v4 and v4 tests 2019-06-13 11:13:25 +01:00
Mike Jolley 4a860656c5 Disable leaderboard tests if admin is not installed 2019-06-12 13:17:26 +01:00
Mike Jolley 732eb4b453 Namespace and structure improvements 2019-06-12 13:09:20 +01:00
Mike Jolley 2eff709060 Rename endpoints to controllers 2019-06-12 12:19:14 +01:00
Mike Jolley a5e4c3bf4d admin 2019-06-11 16:35:36 +01:00
Mike Jolley 013934d8b7 Remove all blocks APIs 2019-06-11 16:15:02 +01:00
Mike Jolley 411054fb5f Missing slash 2019-06-11 12:10:53 +01:00
Mike Jolley d50e2426df plugins_dir 2019-06-11 12:08:56 +01:00
Mike Jolley e939c870ce WP_TESTS_DIR 2019-06-11 11:59:49 +01:00
Mike Jolley 584d46989f Tweak bootstrap paths 2019-06-11 11:57:20 +01:00
Mike Jolley 652e622aa8 Config 2019-06-11 11:37:09 +01:00
Mike Jolley 52dc671ea8 try travis build dir 2019-06-11 11:24:52 +01:00
Mike Jolley 6d211e17bf ls 2019-06-11 11:18:59 +01:00
Mike Jolley 129ea30305 Move composer install 2019-06-11 11:16:23 +01:00
Mike Jolley 561e44432a Add caching 2019-06-11 11:10:55 +01:00
Mike Jolley 759feffbee which phpunit 2019-06-11 11:05:53 +01:00
Mike Jolley 73e5c5d951 pwd 2019-06-11 10:58:00 +01:00
Mike Jolley fa8ebdc47f Update phpunit dir 2019-06-11 10:53:58 +01:00
Mike Jolley 0753e3f6a8 More config changes 2019-06-11 10:50:13 +01:00