Commit Graph

1849 Commits

Author SHA1 Message Date
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
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
Gerhard Potgieter a6e7ae15f9 Add unit test for testing wc_get_user_agent 2018-07-11 14:11:31 +02:00
Peter Fabian 28cb32e54b PHPCS fixes. 2018-07-09 18:30:10 +02:00
Peter Fabian 7443a2f906 Switched variation creation to CRUD methods for unit test. 2018-07-09 18:27:56 +02:00
Peter Fabian 3af9c1e95b Merge branch 'master' into fix/20349
# Conflicts:
#	tests/framework/helpers/class-wc-helper-product.php
#	tests/unit-tests/api/products.php
2018-07-09 18:18:06 +02:00
Peter Fabian 4a42e2a7fc Added unit tests for query params for variations REST API endpoint. 2018-07-09 17:12:23 +02:00
Peter Fabian 55d7ea4ac5 Improved unit tests for products REST API endpoint. 2018-07-09 17:11:50 +02:00
Gerhard Potgieter bc3c780b92 PHPCS fixes 2018-07-09 13:04:16 +02:00
Gerhard Potgieter 1fdcf2a238 Fix log file deletion functionality. 2018-07-09 13:01:23 +02:00
Peter Fabian 6c70064a82 Added test products API for product tag and attributes query parameters. 2018-07-06 16:57:40 +02:00
Peter Fabian e769029af6 Make create_attribute function for PHPUNIT more versatile by removing hardcoding. 2018-07-06 16:08:32 +02:00
Peter Fabian 1091eb5feb PHPCS corrections. 2018-07-06 16:01:49 +02:00
Peter Fabian fe77b9e54f Fixed the variation product helper in unit tests.
Previously, the variable product had 2 variations, but one of them had a term assigned ('large') that wasn't assigned to the parent product. Normally, when variable product is created, parent has all the terms assigned to its children assigned.
2018-07-06 16:00:59 +02:00
Peter Fabian 9c420125a3 Added tests for API query parameters for products endpoint. 2018-07-06 12:58:57 +02:00
Claudiu Lodromanean 2a3cedddcd
Merge pull request #20520 from woocommerce/feature/product-custom-tables-supporting-changes
Product custom tables supporting changes
2018-06-27 08:57:50 -07:00
Gerhard Potgieter 2df62edec1 Improve the replacement for wc_format_phone_number a bit more, seems like we allow spaces and plus signs, remove non visible unicode with seperate preg_replace 2018-06-27 09:37:44 +02:00
Peter Fabian 8fd4777fb4 Fixed PHPCS whitespace. 2018-06-25 10:57:52 +02:00
Peter Fabian 6ba409b772 Added category related unit tests for products API. 2018-06-23 13:54:36 +02:00
Peter Fabian 97983a2d45 Fixed missing terms in unit tests.
in teardown method, terms are deleted, so e.g. Uncategorized product_cat was only avaialble if test was run individually, not in the whole batch. Should now be fixed.
2018-06-23 13:50:31 +02:00
Rodrigo Primo b6e73f528b Merge branch 'master' into feature/product-custom-tables-supporting-changes 2018-06-15 14:56:31 -03:00
Claudiu Lodromanean c203ff16d9
Merge pull request #20482 from woocommerce/fix/20452
Avoid price setting when synced with children
2018-06-15 09:05:13 -07:00
Mike Jolley 9a550c4a35 Update to correct type in unit test 2018-06-14 16:34:36 +01:00
Claudiu Lodromanean 73dbec001a
Merge pull request #20456 from JPry/custom_coupon_item_limit
Custom coupon item limit
2018-06-13 09:57:47 -07:00
Mike Jolley 77e887efe9 code standards 2018-06-13 16:55:39 +01:00
Mike Jolley 31058ac215 Tests -> CRUD 2018-06-13 16:30:42 +01:00
Gerhard Potgieter ab769eb8a7 Update test_save_default_attributes to make use of propper attributes before checking defaults 2018-06-13 15:49:38 +02:00
Mike Jolley 812586742b Allow only valid default attributes 2018-06-13 14:33:13 +01:00
Mike Jolley 9ec7eba0f6 update image URLs 2018-06-13 11:53:30 +01:00
Mike Jolley c37f724326 Break up tests/test contents 2018-06-13 11:39:28 +01:00
Mike Jolley 01a3e359c3 Merge branch 'master' into feature/product-custom-tables-supporting-changes 2018-06-13 10:18:38 +01:00
Rodrigo Primo 69e1547cd9 Update e2e tests database to the latest WC db version 2018-06-12 09:02:40 -03:00
Brent Sessions 8fc43f0cad Skip upload from forks (#20462)
This will skip the uploading of screenshots if the S3 key is not present. This will happen when there is a PR for a fork submitted.

* Skip upload from forks

* trying with failing test

* Fixing tests

* need a rebuild
2018-06-11 13:59:59 -03:00
Gerhard Potgieter 3b9d403b02 Add geolocation::get_ip_address tests 2018-06-11 11:10:11 +02:00
Claudiu Lodromanean 3d4dfda568
Merge pull request #20435 from rnaby/070618-212333-wc-privacy-exporters-customer_data_exporter
Removed unnecessary parameter. Also removed from tests.
2018-06-08 11:34:42 -07:00
Jeremy Pry a2d3313b36 Add unit tests around coupon item limit setting
Also updates the `WC_Helper_Coupon` class to make it easier to register custom coupon types during tests.

For #20455
2018-06-08 14:17:39 -04:00
Rodrigo Primo c2616b74f2
Merge pull request #20439 from woocommerce/update/improve-e2e-screenshots
Only try to upload screenshots if directory is not empty
2018-06-08 09:34:45 -03:00
Claudiu Lodromanean dc20237f40
Merge pull request #20426 from woocommerce/fix/20386
Made path /orders/refund_id return invalid order id msg instead of error.
2018-06-07 10:50:46 -07:00
Khan M Rashedun-Naby 4b14cbc727 Removed unnecessary parameter. Also removed from tests. 2018-06-07 21:25:13 +06:00
Rodrigo Primo cc4871e5ca Only try to upload screenshots if directory is not empty
This commit adds a check before the code that uploads screenshots of failed e2e tests to make it run only if running the Travis build job that executed the tests and if the screenshots/ directory is not empty. There is no need to always download Travis artifacts and try to upload to S3 if there is nothing to upload.
2018-06-07 11:50:36 -03:00
Brent Sessions c64a35300a Take screenshots of failed e2e tests (#20313)
This adds screenshots for broken e2e tests. The screenshots will also be uploaded to an Amazon S3 instance from Travis CI so they can be viewed. If run locally, there will be a screenshots directory created where they can be viewed

If there is a failed e2e test you'll see a block under `travis.sh after` in the build log in Travis CI that will give the URLs for the images.

* Adding screenshot capabilities to all tests

* trying screenshots on S3

* try to get a failed test

* finding the right path

* fixing yml

* only taking failed screenshots

* fixing yml

* moving paths to env

* fixing target

* try without artifact target

* fixing test

* setting back temporary changes

* fixing spacing

* unneeded change

* trying different uploader

* Force a failed test

* fixing test again

* fixing  unneeded change

* updating git ignore
2018-06-07 11:31:37 -03:00
Peter Fabian b5c420de99 Fixed milestone according to issue tag. 2018-06-07 15:36:27 +02:00
Peter Fabian 185675c69e Added unit test to cover the orders/refund_id. 2018-06-07 14:58:53 +02:00
Mike Jolley 4df54b4e53 Merge branch 'master' 2018-06-07 11:24:12 +01:00
Mike Jolley 58c5ddc8d0 Remove test 2018-06-07 11:23:11 +01:00
Gerhard Potgieter 0d8f002769 Unset the server variable on teardown to avoid out of memory errors 2018-06-01 14:49:02 +02: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 54b23918b9 Fix broken system status unit test, https://github.com/woocommerce/woocommerce/pull/20231 introduced a new item to the schema 2018-05-25 14:19:14 +02:00
Mike Jolley 58b9be29b9
Merge pull request #20191 from woocommerce/fix/20186
Product import from file on server
2018-05-25 12:29:27 +01:00
Gerhard Potgieter 2f9c9e4954 Fix server file upload test 2018-05-25 13:00:59 +02:00
Mike Jolley f05167df17
Merge pull request #20222 from liquidweb/fix/iso-3166-1-alpha-2
Ensure tests use ISO 3166-1 alpha-2 country codes
2018-05-25 10:32:48 +01:00
Mike Jolley 171139295c
Merge pull request #20193 from woocommerce/fix/20192
Fix WC_Coupon constructor with Coupon object
2018-05-25 10:29:38 +01:00
Steve Grunwell 4bbf9c364d Ensure tests use ISO 3166-1 alpha-2 country codes
[According to the WooCommerce wiki](https://github.com/woocommerce/woocommerce/wiki/Order-and-Order-Line-Item-Data) and `WC_REST_Orders_Controller`, WooCommerce stores country codes using the ISO 3166-1 alpha-2 (2 character) standard. However, the `WC_Tests_Order_Functions::test_wc_get_order_address_params()` test method was using 'USA' instead of 'US'.
2018-05-24 20:50:01 +00:00
Peter Fabian 082c1dfaf3 Excluded children categories from WP_Query in product shortcode if cat_operator=AND. 2018-05-24 16:12:48 +01:00
Gerhard Potgieter 3c2221a4b0 Add a exception test to coupon delete 2018-05-24 12:37:52 +02:00
Gerhard Potgieter 9bc6ca5df3 Fix the coupon data store delete unit test, you should not have been able to create a new datastore from a deleted coupon ID. See product data store tests are reference for this. 2018-05-24 12:26:36 +02:00
Gerhard Potgieter 07c18b59f0 Add unit test to test again passing a coupon object in the constructor 2018-05-24 11:28:24 +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
Mike Jolley 2aec467de8
Wait for address fields to update in e2e checkout test (#20176)
* See if this error is breaking e2e

* Revert "See if this error is breaking e2e"

This reverts commit 3de6d71fc7.

* wait for address update
2018-05-23 12:56:35 +01:00
Gerhard Potgieter ad24b9c9d9
Merge pull request #20041 from woocommerce/fix/20039
Wrap cell in ' rather than prepend
2018-05-18 12:27:26 +01:00
Gerhard Potgieter b73cf49278 Update unit tests to conform to new escaping 2018-05-18 12:09:56 +01:00
Gerhard Potgieter 92be60f3e4
Merge pull request #20045 from liquidweb/fix/table-ordering
Sort the results of WC_Install::get_tables()
2018-05-18 11:14:21 +01:00
Rodrigo Primo 3057ed0bd6 Use WordPress version of phpunit-speed-trap
This commit adds WordPress version of phpunit-speed-trap (https://github.com/WordPress/wordpress-develop/blob/master/tests/phpunit/includes/speed-trap-listener.php). First I tried to add it using composer but for some unknown reason it worked on my local environment but not on Travis (https://travis-ci.org/woocommerce/woocommerce/jobs/377286389#L673). I don't think it is worth spending too much time on this so it seems to me that it is just easy to use WordPress version instead since it works.
2018-05-17 15:04:32 +01:00
Steve Grunwell 317e7ba29f Revert most of 74a3f1d6
As @claudiosanches pointed out, there isn't much real-world need for `WC_Install::get_tables()` to sort results. Instead, sort the returned value within the `WC_Tests_Install::test_get_tables()` method.
2018-05-11 22:46:46 +00:00
Steve Grunwell 226aedd4e2 Merge branch 'master' into fix/table-ordering 2018-05-11 17:11:02 +00:00
Steve Grunwell 74a3f1d6d8 Sort the results of WC_Install::get_tables()
Since custom tables can be registered within WooCommerce via the 'woocommerce_install_get_tables' filter, it's helpful to ensure that `WC_Install::get_tables()` automatically sorts the table names alphabetically.

This helps avoid false failures when testing a plugin that uses a custom table against the WooCommerce core test suite, as queries like `WC_Tests_Install::test_get_tables()` assumes that tables will be returned in alphabetical order.
2018-05-11 16:18:49 +00:00
Claudiu Lodromanean 6f2c807f1c
Merge pull request #19984 from woocommerce/fix/19640
Basic range download handling for Force download.
2018-05-09 09:08:15 -07:00
Peter Fabian 2b9a5a6330 Removed test to reflect changes in track download method. 2018-05-09 15:54:38 +02:00
Peter Fabian 7c30b1fac5 Fixed PHPCS problems in test file. 2018-05-09 12:45:17 +02:00
Peter Fabian 4da0f1f793 Added test for range download logging. 2018-05-09 12:04:38 +02:00
Claudiu Lodromanean bc59be04fa
Merge pull request #20009 from woocommerce/update/wc-orders-query-tests
Add test to check WC_Order_Query when using the 'customer' parameter
2018-05-08 13:57:54 -07:00
Rodrigo Primo 42e801db0c Add test to check WC_Order_Query when using the 'customer' parameter 2018-05-08 17:24:16 -03:00
Rodrigo Primo 3e8cd3f837 Remove unnecessary tests cleanup code
Tests don't need to manually remove data that they create. WP test framework does that automatically after each test is executed.
2018-05-08 16:00:00 -03:00
Rodrigo Primo 47f6104580 Add more unit tests to improve test coverage of functions in includes/wc-stock-functions.php 2018-05-08 15:58:03 -03:00
Rodrigo Primo 41f5985087 Fix PHPCS violations automatically using phpcbf 2018-05-08 15:48:55 -03:00
Rodrigo Primo b43f828a7b Fix PHPCS violations automatically using phpcbf 2018-05-08 11:55:32 -03:00
Rodrigo Primo 5d9dadca87 Remove unnecessary cleanup code from orders unit tests
It is not necessary to manually remove data added to the database after each test. WP unit tests framework does this automatically.
2018-05-08 11:52:58 -03:00
Claudiu Lodromanean bda8732c6f
Merge pull request #19974 from woocommerce/update/payment-method-columns
Updates table styling and columns
2018-05-07 11:23:49 -07:00
Mike Jolley cf9fa5b3ff Updates table styling and columns 2018-05-04 18:48:41 +01:00
Rodrigo Primo 7d5f6d3746 Remove WC API unit tests cleanup code
WC unit tests don't need to remove data from the database before finishing. `WP_UnitTestCase` creates a transaction before each test starts and roll it back after it ends, so data is never actually written to the database. This simplifies the tests and makes them faster.
2018-05-04 11:45:30 -03:00
Rodrigo Primo 7ce69dfca2 PHPCS fixes 2018-05-04 11:42:45 -03:00
Mike Jolley e807c6151f Merge branch 'master' into update/erasure-requests 2018-05-02 14:06:47 +01:00
claudiulodro 9c1179856d Update unit tests 2018-05-01 09:32:29 -07:00
Mike Jolley 7ae9919a19 Fix tests 2018-05-01 16:53:05 +01:00
Mike Jolley d40b704cba Remove deprecation test 2018-05-01 13:39:32 +01:00
Mike Jolley adf1c92666 Sets the option before running test so it passes :) Broken in #19871 2018-04-27 10:01:02 +01:00
Rodrigo Primo 214c9ae9c7 Use integer instead of string to set download ID
WC core supports both integers and strings as values to the download ID but this is necessary to make the core unit tests pass when running them in the context of the custom product tables plugins. This plugin accepts only integers for the download ID.
2018-04-26 16:47:38 -03:00
Rodrigo Primo 49804b3172 Merge branch 'feature/product-custom-tables-supporting-changes' of github.com:woocommerce/woocommerce into feature/product-custom-tables-supporting-changes 2018-04-26 16:46:10 -03:00
Rodrigo Primo c9a146aeba phpcs fixes 2018-04-26 14:46:17 -03:00
Peter Fabian 76d9cc7b19 Fix the US currency name and attribute check for creating variable product. 2018-04-25 10:00:10 +02:00
Rodrigo Primo 597033ca6f Merge branch 'master' into feature/product-custom-tables-supporting-changes 2018-04-24 13:47:22 -03:00
Rodrigo Primo 920006b8b9 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:40:16 -03:00
Rodrigo Primo dcc309d16b Add call to parent::setUp() and remove cleanup code
parent::setUp() should be called inside test setup methods to make sure database changes are automatically reverted after each test is executed. This way it is not necessary to manually remove inserted data.
2018-04-23 10:34:15 -03: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
Rodrigo Primo bf0da0287d Simple placeholders should not be quoted 2018-04-20 09:28:08 -03:00
Rodrigo Primo 9c33f133b6 Fix parameter order when calling PHPUnit_Framework_TestCase::assertEquals()
The first parameter passed to PHPUnit_Framework_TestCase::assertEquals() should be the expected value and the second parameter the actual value and not the other way around.
2018-04-19 17:25:38 -03:00
Mike Jolley d381330a91
Merge pull request #19705 from woocommerce/fix/19619
Handling of PHP's automatic array key conversion to int
2018-04-18 15:40:31 +01:00
Peter Fabian 4538f3fa8f Moved wc_selected to core functions. 2018-04-18 15:54:57 +02:00
Gerhard Potgieter f0f6169145 Fix the download log unit test, with the new constraint key introduced in #19330 the download log needs a valid download to save correctly. 2018-04-18 09:43:24 +02:00
claudiulodro f9e45bea91 Bring up-to-date with master and resolve merge conflicts 2018-04-17 13:27:39 -07:00
Claudio Sanches 933bcc32c3
Merge branch 'master' into fix/19620 2018-04-17 12:45:20 -03:00
Claudio Sanches f18220a009 Updated unit tests 2018-04-17 12:31:14 -03:00
Peter Fabian 49529e0912 Added wc_selected function.
- Added unit test for the wc_selected function.
2018-04-17 12:13:46 +02:00
Mike Jolley e951ff0a00 Fix test 2018-04-16 14:35:20 +01:00
Mike Jolley f3388d8cd6 tests 2018-04-13 18:25:51 +01:00
Mike Jolley 1b34cd4745 Moved settings tabs around to allow for privacy page. 2018-04-12 16:59:42 +01:00
Claudio Sanches 900c8fc33f
Merge pull request #19380 from woocommerce/update/19302
Override supports for PayPal to see if credentials exist
2018-04-06 15:44:42 -03:00
Claudio Sanches 53b000cb87 Remove product after unit test 2018-04-06 14:49:20 -03:00
Claudio Sanches a10689ce40 Added unit tests for wc_get_product_class() 2018-04-06 14:47:18 -03:00
Mike Jolley 4e42b2cd30 Handle manage_stock mixed content for variations 2018-04-03 17:46:43 +01:00
Mike Jolley 5ac7aac369 Improve can_refund_order and add unit tests 2018-04-03 17:09:09 +01:00
Mike Jolley 5bc26ebd79 Merge branch 'master' into update/17427 2018-04-03 14:38:49 +01:00
Mike Jolley 8721d62b67 update test 2018-04-03 14:37:31 +01:00
Rodrigo Primo 94751f2872 Use data store loader instead of hardcoding data store class name
This way plugins extending WC core data stores can still benefit from WC core tests
2018-04-02 15:50:44 -03:00
Rodrigo Primo d55c0d63b1 Add unit tests group 'core-only'
This group is used to identify unit tests that will work only when testing WC core. This is necessary since we are using WC core unit tests to test the custom product tables plugin and some tests should be skipped in this context.
2018-04-02 15:15:23 -03:00
Rodrigo Primo bb553c88ae Merge branch 'master' into feature/product-custom-tables-supporting-changes 2018-03-29 12:05:55 -03:00
Mike Jolley 51252915e1
Merge pull request #19493 from woocommerce/fix/19404
Removed line item limit and made sure the URL is shorter than 2083 ch…
2018-03-28 13:56:57 +01:00
Peter Fabian 3809ab3f4c Fixed shipping tax logic to behave the same as originally 2018-03-28 13:08:05 +02:00
Mike Jolley 5547c57c03
Merge pull request #19504 from woocommerce/fix/19485-backorder-import
Product import backorders default to no
2018-03-28 11:00:09 +01: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
Peter Fabian 5eda49f98a Line item logic refactored
Renamed function get_non_line_item_args
Documentation updates
...all part of code review fixes
2018-03-27 15:55:03 +02:00
Peter Fabian f6d748a812 Fixed PHPCS violation 2018-03-26 13:31:29 +02:00
Peter Fabian 88588eccbc Code duplication removed
Added test for non line item agrument presence
Fixed incorrect comment
2018-03-26 13:05:55 +02:00
Peter Fabian 26144afbc6 Test request length after applying filter
- added default value to get_line_item_args to not break interface
- smaller code review updates
2018-03-23 17:22:09 +01:00
Peter Fabian fda6421dee Fixed compatibility with older PHP versions, removed superfluous asserts. 2018-03-22 20:42:19 +01:00
Peter Fabian 27a309d2df Removed line item limit and make sure the URL is shorter than 2083 characters
- removed limit to 9 line items per Paypal order
- if the request URL with all line items will be longer than 2083 characters, send it as one line item
- fix the character limit function to account for URL encoding happening in http_build_query
2018-03-22 15:39:30 +01:00
Claudio Sanches 21dc6d28cf
Merge branch 'master' into feature/18477 2018-03-21 14:31:58 -03:00
Mike Jolley 6539b7913e Merge branch 'master' 2018-03-19 18:05:36 +00:00
Claudiu Lodromanean e6a266e30f
Merge pull request #19412 from woocommerce/update/19408
Use wc_get_default_products_per_row as the default for product shortcodes
2018-03-19 09:23:44 -07:00
Mike Jolley d099aae4ec Fix test and default 2018-03-19 13:05:43 +00:00
Steve Grunwell 049876ac8f Add the "woocommerce_install_get_tables" filter to WC_Install::get_tables()
This commit adds a new filter, "woocommerce_install_get_tables", to the WC_Install::get_tables() method, enabling WooCommerce extensions to register new, WooCommerce-specific tables, ensuring these tables can be cleaned up automatically should WooCommerce be uninstalled (useful for things like custom table data stores). Nothing gets added by default, but this provides an integration point for plugins like WooCommerce Custom Orders Table.
2018-03-16 18:54:17 +00:00
Mike Jolley eb26221b1a Merge branch 'master' into update/19061 2018-03-16 13:59:05 +00:00
Claudio Sanches c4eac9f4e5 GeoLite integration Unit Tests 2018-03-15 17:06:13 -03:00
Mike Jolley 2abd510b36
Merge pull request #19391 from woocommerce/fix/rounding
100% coupon with inclusive taxes and out-of-base rounding issue fix
2018-03-15 12:43:58 +00:00
Mike Jolley 94bfd3b336 Update formatting and tests 2018-03-15 10:54:32 +00:00
Mike Jolley 27f07807a5 Clean up 2018-03-14 15:23:39 +00:00
Mike Jolley e0ab13bd3c Tests and test pass 2018-03-14 15:14:45 +00:00
Mike Jolley fec36ff4b2 Test runner 2018-03-14 14:29:03 +00:00
Mike Jolley e03bc3d447
Merge pull request #19381 from woocommerce/fix/phpcs-violations-includes
Fix PHPCS violations in a few includes/ files
2018-03-13 19:36:53 +00:00
claudiulodro 7e0ad645f3 Unit test for oob rounding issue 2018-03-13 11:41:25 -07:00
Rodrigo Primo 4229b3c5b2 Rename WC_Validation::is_GB_postcode() to WC_Validation::is_gb_postcode()
To follow WP coding standards
2018-03-13 08:49:40 -03:00
Mike Jolley 1b905b2975
Merge pull request #19331 from woocommerce/add/coupon-wildcard-email
Add wildcard email support for coupons.
2018-03-13 10:05:06 +00:00
Gerhard Potgieter 9a13b4d365 Add unit tests for is_coupon_emails_allowed 2018-03-13 08:03:00 +02:00
Mike Jolley 906aa97aea Merge branch 'master' into update/19061 2018-03-12 19:28:53 +00:00
Rodrigo Primo 5a5a2bc1fb Make unit tests work again with PHP 5.2
This commit fixes WC PHPUnit tests in PHP 5.2 that have been broken since commit e68084d7b8 (diff-b43983ff635e47e2ec510ae07726f0b4R30) was merged. The mentioned commit added a new method to WC_Unit_Test_Case that uses late static binding. The problem is that late static binding is available only since PHP 5.3 and WooCommerce still support PHP 5.2. Running WC tests with PHP 5.2 resulted in the following error:

Parse error: syntax error, unexpected T_STATIC, expecting T_STRING or T_VARIABLE or '$' in /home/travis/build/woocommerce/woocommerce/tests/framework/class-wc-unit-test-case.php on line 40 (see https://travis-ci.org/woocommerce/woocommerce/jobs/350303315#L281)

For now, I'm simply removing the method that used late static binding (WC_Unit_Test_Case::include_dependencies()) and manually loading the required dependencies in the two test classes that relied on it. I'm happy to add WC_Unit_Test_Case::include_dependencies() again if someone can find a way to make it compatible with PHP 5.2. If not, we can revisit this once WC drops support for PHP 5.2.
2018-03-12 16:19:47 -03:00
Mike Jolley e4afb25931
Merge pull request #19300 from woocommerce/fix/phpcs-includes-payment-tokens
PHPCS fixes for includes/payment-tokens directory
2018-03-08 15:03:39 +00:00
Mike Jolley 0c10c28cd3
Merge pull request #18175 from woocommerce/update/17252
Rollback if payment complete or update status fails
2018-03-08 13:12:34 +00:00
Rodrigo Primo 273ac18087 Rename class WC_Payment_Token_eCheck to WC_Payment_Token_ECheck
Doing this change to make the class name compatible with WP coding standards.
2018-03-07 14:50:21 -03:00
claudiulodro 8cf36aa0d2 New shortcode features for products block 2018-03-01 10:05:22 -08:00
Mike Jolley 21d7dbc612 Merge branch 'master' into update/17252 2018-03-01 15:58:17 +00:00
Mike Jolley f162fdb9d1 Merge branch 'master' into update/17795 2018-03-01 12:13:14 +00:00
Mike Jolley 3c81096605 Added test 2018-03-01 12:12:26 +00:00
Mike Jolley bec084ac16
Merge pull request #18493 from liquidweb/tests/api-system-status
Add tests for the "add_order_indexes" system status tool
2018-03-01 12:03:29 +00:00
Mike Jolley 8faedcb849
Merge pull request #18489 from liquidweb/tests/reports
Add tests around order reporting
2018-03-01 12:02:59 +00:00
Rodrigo Primo 3a480e5d80 Merge branch 'master' into feature/product-custom-tables-supporting-changes 2018-03-01 08:02:08 -03:00
Rodrigo Primo 0f79567d06 Merge branch 'master' into update/improve-get-downloads 2018-02-28 13:34:11 -03:00
Mike Jolley 133ed2d24b Tests 2018-02-28 13:33:24 +00:00
Claudiu Lodromanean 5346f63abc
Merge pull request #19159 from woocommerce/fix/19124
Use subtotal for discounts in admin/orders
2018-02-27 11:27:01 -08:00
Mike Jolley 6b722e1120 Update tests to use subtotal as a basis for the discounts. 2018-02-27 18:57:28 +00:00
Claudio Sanches e2e8a7bfd1 Fixed PHPUnit path 2018-02-27 14:24:40 -03:00
Claudio Sanches 1fcb5e8be3 Force PHPUnit 6 in Travis 2018-02-27 14:20:13 -03:00
Claudio Sanches 5a19861544 Run composer in all tests 2018-02-27 14:11:17 -03:00
Claudio Sanches 1239ab033f Use phpunit installed by composer while running tests on travis 2018-02-27 14:06:06 -03:00
Caleb Burks 4a4aa84e26 Add a test 2018-02-22 15:06:53 -05:00
Mike Jolley 7c61f05bb1
Merge pull request #18620 from woocommerce/fix/get-downloads-order-by
Fix: properly set orderby and order when calling WC_Customer_Download_Data_Store::get_downloads()
2018-02-19 14:44:21 +00:00
Mike Jolley d5a1463e3e
Merge pull request #18595 from woocommerce/update/add-ext-object-cache-to-system-status
Display whether or not external object cache is enabled
2018-02-19 14:40:14 +00:00
Mike Jolley 5feed3e0cc Merge branch 'master' into update/add-ext-object-cache-to-system-status 2018-02-19 14:39:31 +00:00
Steve Grunwell 7878a9582f Merge branch 'master' into tests/api-system-status 2018-02-15 23:16:58 +00:00
Steve Grunwell 19a35d630a Merge branch 'master' into tests/reports 2018-02-15 23:12:10 +00:00
Gerhard Potgieter 780905cd0e Merge branch 'master' into feature/product-custom-tables-supporting-changes 2018-02-08 10:11:27 +02:00
Rodrigo Primo 5be9d1b118 Remove all WC tables when uninstalling the plugin
There were two outdated lists of WC tables. One used to drop tables when WC is uninstalled and another one to drop tables when a site is deleted in a multi site environment. This commit creates a new unified list of WC tables, adds the missing tables to this list and introduces a unit test that will fail if the list gets outdated.
2018-02-06 11:19:40 -02:00
Mike Jolley 8fb8039b23
Merge pull request #18818 from woocommerce/fix/prevent-unsupported-downgrade
Don't call WC_Install::install() on downgrades
2018-02-06 12:46:42 +00:00
Rodrigo Primo 13f703fd32 Don't call WC_Install::install() on downgrades
WC doesn't support downgrades but the if condition that decides whether or not to call WC_Install::install() and apply database schema changes was checking if the WC version stored in the database is equal to the WC version in the code. This commit changes the check performed inside the if condition to verify if the WC version stored in the database is smaller than the version in the code. This way `dbDelta()` won't be called automatically by WC and revert database schema changes. This is particulary important for clustered providers where the version of the WC code running in one of the containers could be outdated and trigger a database downgrade.
2018-02-05 14:40:51 -02:00
Rodrigo Primo 16a44964f1 Remove unused code from WC_Tests_Install::test_check_version()
To test the method WC_Install::check_version() it is not necessary to update the of the option 'woocoommerce_db_version' as this method uses only 'woocommerce_version'.
2018-02-05 14:40:43 -02:00
Rodrigo Primo 13351b3d75 phpcs fixes
Removed the print_r() call as phpcs was complaining about it and there is no need to output the version values as phpunit will do that if the test fails.
2018-02-05 14:40:36 -02:00
Claudio Sanches 0755038e8d
Merge pull request #18505 from liquidweb/feature/post-system-status-tool-hook
Add a hook after executing a REST system status tool
2018-02-02 14:19:03 -02:00
Mike Jolley db54911443
Merge pull request #18752 from woocommerce/refactor/background-processing
Introduced new WC_Background_Process abstract class
2018-02-01 16:18:56 +00:00
Claudio Sanches b811dbbaec Applied new WC_Background_Process class 2018-02-01 11:42:34 -02:00
Mike Jolley 2ed9691c14 Fix shop on homepage with unsupported themes 2018-02-01 11:15:46 +00:00
Mike Jolley c8b14b6f76 Increase precision from 4 to 6 2018-01-30 15:00:53 +00:00
Rodrigo Primo 2feacfb47a Display whether or not external object cache is enabled
This commit adds a new line to the section "WordPress environment" of the system status page to indicate whether or not WP external object cache is enabled.
2018-01-29 15:56:01 -02:00
Rodrigo Primo 75fc594013 Manually fix coding standard violations that can't be fixed with phpcbf 2018-01-29 15:55:43 -02:00
Rodrigo Primo a15ecc1601 Automatically fix coding standard violations using phpcbf 2018-01-29 15:53:54 -02:00
Rodrigo Primo 9c4c006baa Fix: set orderby and order when calling WC_Customer_Download_Data_Store::get_downloads()
This commit fixes a bug in WC_Customer_Download_Data_Store::get_downloads() 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 ('permission_id' and 'ASC' respectively).

One of the assertions of the WC_Customer_Download_Data_Store::get_downloads() test method was modified to make sure the code now works.

This bug was introduced by commit a443419.
2018-01-26 15:55:13 -02:00
Rodrigo Primo 07d00fc58e Make WC_Customer_Download() tests a bit faster
This commit simplifies WC_Customer_Download() tests by using hardcoded values for customer ID and e-mail instead of touching the database and creating a real customer for each test.
2018-01-26 15:44:23 -02:00
Steve Grunwell 16b59b60a0 Merge branch 'master' into feature/post-system-status-tool-hook 2018-01-24 01:45:44 +00:00
Rodrigo Primo 1195cf9eee Improve WC_Customer_Download_Data_Store::get_downloads() performance
This commit improves WC_Customer_Download_Data_Store::get_downloads() performance by changing the way the SQL query is built. Before this change, this method would get all table fields even when just the permission_id field is returned. Now the method will get from the database only the fields that will be returned. The fields retrieved from the database can be controlled using the parameter `$args['return']`:

- 'objects' (default): all fields are retrieved from the database and an array of WC_Customer_Download objects is returned.
- 'ids': gets and return only permision_ids
- comma separated list of fields (new option added by this commit): gets and return only the required fields. Examples: 'user_email,download_id,order_id' or 'order_id,download_count'.
2018-01-22 17:25:26 -02:00
Claudiu Lodromanean 1e2cdb67ad
Merge pull request #18535 from woocommerce/update/disable-all-payment-gateways-by-default
Disable all payment gateways by default
2018-01-22 11:04:21 -08:00
Rodrigo Primo 656356530a Use setUp() method in WC_Customer_Download() tests to remove code duplication 2018-01-22 14:43:28 -02:00
Rodrigo Primo 9eeb4cd0bd Add assertion to check WC_Customer_Download_Data_Store::get_downloads() when called with the 'return' param set to 'ids' 2018-01-22 11:01:00 -02:00
Rodrigo Primo 6bb79681b9 Fix PHPCS violations in class-wc-tests-customer-download.php 2018-01-22 10:59:09 -02:00
Steve Grunwell 183c1e9f9f Add 'public' visibility declarations to coupon test methods 2018-01-22 04:13:13 +00:00
Steve Grunwell 553aede081 Use strict comparison in test_wc_coupons_enabled() 2018-01-22 04:11:02 +00:00
Steve Grunwell 031469f643 Remove an unused variable in the test 2018-01-22 04:10:38 +00:00
Steve Grunwell 21771ebbd3 Ensure that WP_Coupon instances are instantiated with parentheses 2018-01-22 04:10:14 +00:00
Steve Grunwell 7cb8f46b0a *WHITESPACE ONLY* Equal sign and arrow alignment 2018-01-22 04:06:42 +00:00
Steve Grunwell 0766ed6ff7 Fix (or whitelist) coding standards violations in the test bootstrap file 2018-01-22 03:34:13 +00:00
Steve Grunwell bb5417c102 require_once is a language construct, not a function, and thus doesn't require parentheses. 2018-01-22 03:24:52 +00:00
Paul Dechov 0eebd2b72a Update payment gateway default enabled state in tests 2018-01-19 17:42:17 -05:00
Steve Grunwell 4d6a0ecb82 Merge branch 'master' into feature/post-system-status-tool-hook 2018-01-18 21:54:47 +00:00
Brent Sessions a01270f392 Rearranging some variables 2018-01-18 12:36:22 -08:00
Brent Sessions 45bf9d6805 Update install script to account for forked branch 2018-01-18 12:26:46 -08:00
Steve Grunwell 6aeba1d72a Instead of testing the output of the message, verify that the postmeta fields are being re-created. 2018-01-18 18:52:57 +00:00
Brent Sessions e372d55a3c Run e2e tests on Travis builds (#18374) 2018-01-18 16:42:19 -02:00
Steve Grunwell 90c1a310f1 For consistency with the other endpoints, rename the 'woocommerce_rest_system_status_tool_executed' hook to 'woocommerce_rest_insert_system_status_tool'.
Reference: https://github.com/woocommerce/woocommerce/pull/18505#pullrequestreview-89828432
2018-01-18 16:59:47 +00:00
Mike Jolley e905a009d0 CRUD tests 2018-01-18 15:07:05 +00:00
Mike Jolley 6fd40d7e37 Remove transaction tests 2018-01-18 14:48:43 +00:00
Mike Jolley 778ccf0606 Update unit test helpers to use CRUD methods 2018-01-18 10:48:26 +00:00
Steve Grunwell 86c449accf Add missing hard-stops and parentheses for new objects being instantiated, enabling tests/unit-tests/api/system-status.php to pass coding standard checks 2018-01-17 22:13:57 +00:00
Steve Grunwell fa42eb0edf Temporarily disable the WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar sniff at the end of the test_get_system_status_info_theme() method.
The wp_get_theme() function returns a WP_Theme object, which uses uppercase property names, which goes against typical WordPress conventions.

This uses the more modern (read: PHP_CodeSniffer 3.2.0+) syntax for temporarily disabling sniffs. For more details, please see https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-parts-of-a-file.
2018-01-17 22:11:32 +00:00
Steve Grunwell 6b79619983 Add a file-level docblock for the WC_Tests_REST_System_Status class 2018-01-17 22:10:55 +00:00
Steve Grunwell 1a0fd86de5 *WHITESPACE ONLY* Fix alignment of code to satisfy PHP_CodeSniffer 2018-01-17 21:50:26 +00:00
Steve Grunwell ff0e200ae5 Introduce the woocommerce_rest_system_status_tool_executed action, which fires after one of the WooCommerce REST system status tools is executed. 2018-01-17 21:48:23 +00:00
Steve Grunwell be05a55b9d Add missing documentation within the WC_Unit_Test_Case class that was causing CI to fail. 2018-01-15 17:38:13 +00:00
Steve Grunwell 6261ea6cbb Temporarily disable the WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar sniff at the end of the test_get_system_status_info_theme() method.
The wp_get_theme() function returns a WP_Theme object, which uses uppercase property names, which goes against typical WordPress conventions.

This uses the more modern (read: PHP_CodeSniffer 3.2.0+) syntax for temporarily disabling sniffs. For more details, please see https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-parts-of-a-file.
2018-01-15 17:21:35 +00:00
Steve Grunwell 00268c0fa2 Add a file-level docblock for the WC_Tests_REST_System_Status class 2018-01-15 17:06:42 +00:00
Steve Grunwell 477245c693 The WordPress coding standards dictate that new object instantiation should always use parenthesis 2018-01-15 17:05:01 +00:00
Steve Grunwell b4f14b4958 Add missing hard-stops at the end of comments, and a missing method comment for test_execute_system_tool_add_order_indexes() 2018-01-15 17:04:27 +00:00
Steve Grunwell 1843a05ea6 *WHITESPACE ONLY* Fix alignment of code to satisfy PHP_CodeSniffer 2018-01-15 17:03:36 +00:00
Steve Grunwell 8484991f99 Add tests around the add_order_indexes system status tool.
This test ensures that indexes are created within postmeta for any orders that are missing billing_address_index and/or shipping_address_index values.
2018-01-15 16:56:44 +00:00
Steve Grunwell d4ca2d87e8 It's only a single scenario, but start writing tests around how WC_Report_Sales_By_Date generates reports 2018-01-12 23:39:55 +00:00
Steve Grunwell e68084d7b8 Add a method by which testcases can load necessary files via include_once.
There are a number of files that are only loaded when another function is called (for example, load a reporting class when displaying a widget). An autoloader would be the ideal way to handle this (both in production and for tests), but until PHP compatibility is sorted out this commit adds an easy fix:

Testcases can now populate the protected, static $includes property with filepaths relative to the project root; when the testcase boots up, these files will automatically be included.
2018-01-12 21:33:20 +00:00
Steve Grunwell d0efd7251e Introduce some basic tests around getting data out of WC_Admin_Report.
The real value of these tests will be ensuring that data is being sourced correctly in the specific implementations of this class.
2018-01-12 19:55:33 +00:00
Mike Jolley dbdc3af9e5 Tests 2018-01-12 14:20:39 +00:00
Mike Jolley 97673e2de8 Fix wc_notice_count logic and add test 2018-01-10 12:43:48 +00:00
claudiulodro 1e0dbbf544 Better whitespace 2018-01-04 10:31:28 -08:00
claudiulodro 431c9b5766 Unit tests for order error handling 2018-01-04 10:28:52 -08:00
Mike Jolley 73d0c1062c Allow transactions to be forced on 2018-01-03 16:13:08 +00:00
Mike Jolley 7f18e15ff6 Transactions break unit tests 2018-01-03 15:47:55 +00:00
Mike Jolley 13602cd987
Merge pull request #18236 from woocommerce/fix/rest-api-add-coupons-order
REST API: Adding + removing coupons via API doesn't recalculate totals correctly
2018-01-03 11:37:23 +00:00
Mike Jolley ea090f849d
Merge pull request #18148 from woocommerce/update/e2e
Update e2e testing
2018-01-03 11:17:50 +00:00
claudiulodro 09ef2195be Manual set order tests 2017-12-22 11:35:52 -08:00
Claudiu Lodromanean 20f698db2b
Merge pull request #18219 from woocommerce/fix/18197
Compare the date modified when loading session data.
2017-12-22 08:17:14 -08:00
Mike Jolley e9105bd37d Fix tests 2017-12-21 19:00:55 +00:00
claudiulodro 1c8dd6acbb Proposed fix for api coupon recalculating 2017-12-20 11:37:35 -08:00
Kelly Dwan 70455b79a3 Add failing tests to demonstrate problem adding & removing coupons 2017-12-19 16:46:26 -05:00
claudiulodro b7c659ca07 Fix php <=5.6 errors 2017-12-19 11:37:37 -08:00
claudiulodro cff662ac47 phpcs 2017-12-19 09:30:02 -08:00
claudiulodro 3461fd2a3a Array access tests 2017-12-19 09:22:17 -08:00
claudiulodro 2c884c0003 Progress on order item tests 2017-12-18 14:45:39 -08:00
Claudio Sanches e68c28589b
Merge pull request #18216 from woocommerce/update/phpcs-ruleset-file-name
Use default name for PHPCS configuration file
2017-12-18 12:56:25 -02:00
Claudiu Lodromanean df2aded066 WC_Query unit tests (#18180)
* Begin WC_Query tests

* Some tests

* WC_Query unit tests
2017-12-18 12:01:27 -02:00
Gerhard Potgieter 25c4a84491 Add more core-functions unit tests (#18190)
* Pass through additional args to wc_create_order in test

* Pass extra args to wc_create_order to improve coverage, test WP_Error check of wc_create_order

* wc_get_template_part test

* wc_enqueue_js test

* wc_get_log_file_name test

* wc_get_page_children test

* hash_equals test

* wc_rand_hash test

* wc_transaction_query test

* Fix script test and phpcs stuff

* Fix widget tests

* Move tests to correct file and fix phpcs
2017-12-18 11:58:40 -02:00
Rodrigo Primo bf052c14c7 Use default name for PHPCS configuration file
This commit renames PHPCS configutarion file to `phpcs.xml`. With the default name, it is not necessary to use the argument `--standard=phpcs.ruleset.xml` anymore when calling `phpcs`.
2017-12-18 11:49:44 -02:00
Gerhard Potgieter d512421fa1 Make the test work on any test platform 2017-12-15 14:51:47 +02:00
Gerhard Potgieter 58457dab3a Unit tests for wc_is_active_theme 2017-12-15 14:43:56 +02:00
Claudiu Lodromanean 650faf6450
Merge pull request #18169 from woocommerce/add/unit-tests
Widget unit tests
2017-12-14 13:19:21 -08:00
Mike Jolley 1555507756
Merge pull request #18123 from woocommerce/update/setup-wizard-omit-paypal-standard
Setup wizard: Omit PayPal Standard unless plugins cannot be installed
2017-12-14 16:42:03 +00:00
Gerhard Potgieter 549b4bfa1a Widget unit tests 2017-12-14 13:57:53 +02:00
Gerhard Potgieter 276bff133f Improve unit test coverage (#18136)
* Test for main WooCommerce class

* Check all class instances created from main class.

* Test all constants

* Test for deprecated hook handler classes as well

* Test template path constant

* Check static class instances

* get_cart_item_quantities test

* get_cart_item_quantities & get_cart_contents_weight tests

* check_cart_items test

* Check_cart_item_stock test

* Cart get_cross_sells test

* Cart get_tax_totals test

* WC_Customer_Download_Data_Store tests
2017-12-14 08:45:00 -02:00
Gerhard Potgieter 2f477887fb Merge branch 'master' of github.com:woocommerce/woocommerce into add/unit-tests 2017-12-14 10:56:01 +02:00
Gerhard Potgieter 89d0aa0a2f WC_Customer_Download_Data_Store tests 2017-12-14 10:12:56 +02:00
claudiulodro da5eb4abd4 Update e2e sql db 2017-12-13 12:58:18 -08:00
claudiulodro f6f8c93e26 Update e2e tests and library 2017-12-13 12:14:53 -08:00
Claudiu Lodromanean b0189363c2
Merge pull request #18137 from woocommerce/fix/failing-get-billing-email-test
Add exception message to fix failing test
2017-12-13 09:51:44 -08:00
Gerhard Potgieter b39ab218dd Cart get_tax_totals test 2017-12-13 16:42:09 +02:00
Paul Dechov 8f3de46637
Merge branch 'master' into update/setup-wizard-omit-paypal-standard 2017-12-13 09:41:25 -05:00
Paul Dechov f4c557a9be Add test verifying that the correct list of payment gateways is returned per country 2017-12-13 09:35:43 -05:00
Gerhard Potgieter deb2ad8f40 Cart get_cross_sells test 2017-12-13 16:33:17 +02:00
Gerhard Potgieter 2f239311f2 Check_cart_item_stock test 2017-12-13 16:30:47 +02:00
Rodrigo Primo 2329e4f526 Add exception message to fix failing test
This commit adds the exception message thrown when WC_Order::set_billing_email() is called with an invalid message to a test to fix it.

I couldn't find what change in WC codebase broke the test and I'm not sure why it is failing only when running using PHP 5.6:

https://travis-ci.org/woocommerce/woocommerce/jobs/315750242#L600
2017-12-13 12:28:48 -02:00
Gerhard Potgieter 2e7a47d9df check_cart_items test 2017-12-13 16:22:11 +02:00
Rodrigo Primo ddc2d926fc PHPCS: fix violations manually 2017-12-13 12:19:51 -02:00
Gerhard Potgieter 6560dd42ab get_cart_item_quantities & get_cart_contents_weight tests 2017-12-13 16:17:09 +02:00
Rodrigo Primo c4665bff46 Automatic PHPCS fixes using phpcbf 2017-12-13 12:11:47 -02:00
Gerhard Potgieter 4eb971e81d get_cart_item_quantities test 2017-12-13 16:10:25 +02:00
Mike Jolley a42ba4607e
Merge pull request #18060 from woocommerce/fix/17915
Background processing; multisite should process current blog queue only
2017-12-13 12:38:19 +00:00
Gerhard Potgieter ea54e0892c Check static class instances 2017-12-13 14:02:02 +02:00
Gerhard Potgieter 6060de3200 Test template path constant 2017-12-13 13:51:34 +02:00
Gerhard Potgieter c56a8436d0 Test for deprecated hook handler classes as well 2017-12-13 13:49:45 +02:00
Gerhard Potgieter 336e096b48 Test all constants 2017-12-13 13:47:49 +02:00
Gerhard Potgieter 748ca37838 Check all class instances created from main class. 2017-12-13 13:36:36 +02:00
Gerhard Potgieter c334556ba9 Test for main WooCommerce class 2017-12-13 13:31:01 +02:00
Gerhard Potgieter 338632a183 Use assertArrayHasKey instead 2017-12-13 13:19:34 +02:00
Gerhard Potgieter 9984940eb3 Use correct array format for test to be compatible with lower versions of PHP 2017-12-13 11:23:11 +02:00
Gerhard Potgieter 5a87736f02 Update wp-background-process unit tests to take into account new prefix 2017-12-13 11:19:18 +02:00
Mike Jolley 4be91ec900 fixed `role="alert"` tests 2017-12-12 18:29:24 +00:00
Claudio Sanches eaa440df5f
Merge pull request #18071 from woocommerce/update/18045
Attributes; remove 'text' display option
2017-12-08 14:36:36 -02:00
Mike Jolley 890ee4f1b9 This test cannot pass with refactor 2017-12-08 16:30:56 +00:00
Mike Jolley b4bfe6303f Keep public method around 2017-12-08 16:24:04 +00:00
Mike Jolley d5486be6c8 test 2017-12-08 11:35:26 +00:00
Gerhard Potgieter 9491db496c Fix issue where get_batch was referencing a non set variable for the column name. Add a couple of unit tests to test the background process class. 2017-12-08 10:31:05 +02:00
Gerhard Potgieter 75ecb887c3
Merge pull request #18017 from woocommerce/tweak/decouple-cart-template-methods
Decouple cart templating methods from WC_Cart class
2017-12-08 08:15:46 +02:00
Claudio Sanches 2f6f6112c2 Merge branch 'master' into feature/webhook-crud 2017-12-07 18:21:52 -02:00
Boro Sitnikovski d0f9aaa99a Merge branch 'master' into tweak/decouple-cart-template-methods 2017-12-07 20:16:08 +01:00
Claudiu Lodromanean 7c06e7d63d
Merge pull request #18008 from woocommerce/update/rounding-17970-17863
Rounding fixes/line item rounding
2017-12-07 08:34:15 -08:00
Claudiu Lodromanean 804c771296
Merge pull request #17683 from woocommerce/feature/unsupported-theme
Unsupported theme enhancements
2017-12-07 08:05:29 -08:00
ragulka a2b7725777 Tweak test 2017-12-07 11:53:35 +02:00
ragulka ea7192e156 Add test case for tax exclusive cart price rounding 2017-12-07 11:49:31 +02:00
Mike Jolley 8a58c1de40 Unit test for get_price_html calls in sequence
Closes #18037
2017-12-06 11:52:55 +00:00
Mike Jolley d49590d0a3 Fixes to 5.2 rounding function and additional tests 2017-12-05 12:10:23 +00:00
Boro Sitnikovski 145d47c580 Decouple cart templating methods from WC_Cart class 2017-12-05 13:00:21 +01:00
Mike Jolley b6f87e70d7 round total to cents 2017-12-04 22:42:39 +00:00
Mike Jolley 077ced6657 tearDown 2017-12-04 22:30:23 +00:00
claudiulodro d60456cc73 Resolve conflicts and bring up to date with master 2017-12-04 13:56:59 -08:00
Mike Jolley c29bb6add3 Split test so comparison works. 2017-12-04 20:38:42 +00:00
Claudio Sanches 0f4f8a3f16
Merge branch 'master' into feature/webhook-crud 2017-12-04 12:37:10 -02:00
Mike Jolley 0a9485c465 Merge branch 'master' into feature/11259
# Conflicts:
#	assets/css/admin-rtl.css
#	assets/css/admin.css
#	includes/admin/list-tables/class-wc-admin-list-table-products.php
#	includes/class-wc-install.php
#	includes/wc-update-functions.php
2017-12-04 14:14:03 +00:00
claudiulodro d98f6c96af Unit tests to reproduce problems 2017-12-01 11:38:09 -08:00
claudiulodro 832d17dcbd Update test 2017-12-01 08:39:02 -08:00
Claudio Sanches 270c0a200e Merge branch 'master' into feature/webhook-crud 2017-11-30 16:55:28 -02:00
Claudiu Lodromanean b05cd3f3a7
Merge pull request #17934 from woocommerce/fix/17925
Display product URL only if is not hidden in downloads list
2017-11-29 10:33:34 -08:00
Claudio Sanches d3a5a1bfd4 Fixed bugs caused after fixing coding standards 2017-11-29 10:32:35 -02:00
Claudio Sanches c6f8e95b97 Merge branch 'master' into feature/webhook-crud 2017-11-28 15:09:10 -02:00
Claudio Sanches 8ed6e7436f
Merge pull request #17909 from woocommerce/update/phpcs-violations
Fix some PHPCS violations
2017-11-27 18:42:24 -02:00
Rodrigo Primo 7b17b79460 Fix PHPCS violations in file tests/unit-tests/order/functions.php 2017-11-24 17:25:31 -02:00
Rodrigo Primo acb970dcf7 Add some basic test coverage for wc_order_search() 2017-11-24 17:04:14 -02:00
Rodrigo Primo 6f207d39f3 travis.sh cleanup
We don't call `composer install` for all PHP version anymore in this script, so it is not necessary to exit early if running PHP 5.2.
2017-11-24 10:36:42 -02:00
Rodrigo Primo 183078914b Travis: don't reinstall PHPUnit
This commit removes the command to install PHPUnit on every Travis build job. I'm doing this because I don't see a reason for WooCommerce to re-install PHPUnit since it is already installed by default on every build job. Travis automatically handles installing the right PHPUnit version for each PHP version that we use.

This change should save around 10 seconds from each build job (https://travis-ci.org/woocommerce/woocommerce/jobs/306623161#L515).
2017-11-24 10:23:30 -02:00
Mike Jolley ee08983e5e
Merge pull request #17890 from rodrigoprimo/update/remove-xdebug-from-php-5-3-build
Further improve the speed of the Travis build
2017-11-23 13:24:51 +00:00
Mike Jolley 85cd9647df
Merge pull request #17871 from ragulka/delete-refund-on-exception
Ensure refund is deleted when exception is thrown during wc_create_refund()
2017-11-23 13:06:40 +00:00
Rodrigo Primo 4fea2eb211 Disable Xdebug before calling composer 2017-11-23 09:13:09 -02:00
Rodrigo Primo 51867ac7c3 Remove Xdebug from PHP 5.3 Travis build job as well 2017-11-23 09:06:08 -02:00
claudiulodro a878b0cde5 Some phpcs 2017-11-22 14:03:26 -08:00
claudiulodro 5513dc4546 Update with master 2017-11-22 11:02:14 -08:00
Claudio Sanches bf42bfeb93 Fixed unit tests 2017-11-22 17:00:02 -02:00
ragulka 4f2e1ee8d4 Ensure refund is deleted when exception is thrown during wc_create_refund 2017-11-22 17:03:58 +01:00
Claudio Sanches 39e27196c4
Merge pull request #17853 from rodrigoprimo/fix/run-phpcs-only-once
Don't run PHPCS on the code coverage Travis job
2017-11-22 12:16:34 -02:00
Rodrigo Primo 47154cf29a Don't run PHPCS on the code coverage Travis job
PR #17680 added a new PHP 7.1 Travis build job to generate code coverage report. PHPCS was configured to run on all PHP 7.1 build jobs. So this means that after #17680 was merged, Travis started running PHPCS twice.

This commit fixes this issue by setting a new environment variable called `$RUN_PHPCS` and using this variable, instead of the PHP version, to decide when to run PHPCS.
2017-11-21 18:17:55 -02:00
Claudio Sanches f0b6e3fc33 Test removing fee_lines from order in REST API 2017-11-21 16:07:03 -02:00
Claudiu Lodromanean 887003cc02
Merge pull request #17812 from woocommerce/update/wc-e2e-page-objects
Update wc-e2e-page-objects package to version 0.5.0
2017-11-21 09:22:08 -08:00
claudiulodro a73436bdcd Merge remote-tracking branch 'origin/master' into HEAD 2017-11-20 14:43:12 -08:00
claudiulodro 03d51e5471 Tweak variable on backorder logic 2017-11-20 11:32:30 -08:00
claudiulodro b64b26d030 Variable products are on backorder if all children are backordered 2017-11-20 11:19:06 -08:00
Rodrigo Primo 9793bd6985 Update e2e tests to work with the latest version of selenium-webdriver
The new version of selenium-webdriver no longer supports passing a description to before() and after().
2017-11-20 10:42:28 -02:00
Rodrigo Primo b28280f9ab Typo 2017-11-20 10:36:49 -02:00
Claudio Sanches 13978e496b
Merge branch 'master' into feature/webhook-crud 2017-11-20 10:34:35 -02:00
Gerhard Potgieter 32c568209d Add unit test to cover download permissions when running wc_update_new_customer_past_orders 2017-11-20 10:12:59 +02:00
claudiulodro dddf0ee473 Variable product sync 2017-11-17 08:46:49 -08:00
Claudio Sanches 885d0aa415 Fixed WC_Tests_Formatting_Functions::test_wc_do_oembeds() 2017-11-16 17:59:50 -02:00
Mike Jolley facdc49fad Total should be a string 2017-11-16 19:47:34 +00:00
Claudio Sanches a32fae4191 Fixed WC_Tests_Product_Data::test_product_getters_and_setters tests 2017-11-16 17:23:42 -02:00
Claudio Sanches 4d55aaf4ef Fixed WC_Tests_Discounts::test_calculations 2017-11-16 17:08:45 -02:00
Claudio Sanches 876f67a5a9 Fixed non existing product on Products_API::test_get_products_without_permission 2017-11-16 16:59:21 -02:00
Claudio Sanches c140331dc3 [Unit Tests] Clean products after tested is complete 2017-11-16 16:56:30 -02:00
claudiulodro 0390cf3e26 Bring up-to-date with master 2017-11-16 10:06:07 -08:00
Claudio Sanches 01983e6b96 Query and save only IDs of products when fetching products by shortcode 2017-11-16 15:14:36 -02:00
Claudio Sanches 9fe0c7261e Merge branch 'master' into feature/webhook-crud 2017-11-16 12:20:22 -02:00
claudiulodro be6f9d68bc Automatic transitions for variables 2017-11-15 12:08:19 -08:00
claudiulodro 68e23911ba Automatically transition stock statuses 2017-11-15 10:48:39 -08:00
claudiulodro db117d6344 Backordered products should count as in stock 2017-11-14 14:54:11 -08:00
claudiulodro c312cc35b1 Add new onbackorder stock status 2017-11-14 13:40:03 -08:00
Claudiu Lodromanean cc5c182f9d
Merge pull request #17679 from woocommerce/update/12517-download-reporting
Download reporting
2017-11-14 12:23:01 -08:00
Mike Jolley c0bf381f22 Remove invalid test 2017-11-14 16:41:10 +00:00
Mike Jolley 79d918d33e Merge branch 'feature/unsupported-theme' into update/move-settings-to-customizer-17148
# Conflicts:
#	assets/css/admin-rtl.css
#	assets/css/admin.css
#	assets/css/woocommerce-rtl.css
#	assets/css/woocommerce.css
2017-11-14 16:02:02 +00:00
Rodrigo Primo d26310f9c8 Forgot to change the logic to update codecov to run on the non-blocking Travis job 2017-11-13 16:19:36 -02:00
Rodrigo Primo 2dcb04e2e2 Generate code coverage report on a separate non-blocking Travis job
Travis build is taking about 40 minutes to complete, and that is mostly because of the generation of the code coverage report.

To address that, this commit changes Travis configuration to run the command to generate code coverage report on a separate non-blocking Travis job. This way once the jobs that run the tests finishes, Travisi will mark the build as successful and will keep running code coverage on a separate job.
2017-11-13 15:57:11 -02:00
Mike Jolley eddd7fbfb4 Feedback 2017-11-13 15:58:22 +00:00
Mike Jolley 3e7968d37b Merge branch 'master' into pr/16418 2017-11-13 14:37:18 +00:00
Rodrigo Primo 89542a9fb8 Disable XDebug to speed up Travis builds
This commit removes Xdebug from PHP runtime on all build jobs except PHP 7.1 to speed up Travis builds. Xdebug is needed in the PHP 7.1 build job because this job is used to generate code coverage.
2017-11-10 20:05:23 -02:00
Mike Jolley 3bf47d7d97 Fixed tests 2017-11-10 17:45:01 +00:00
Jeremy Pry a4d1c829eb Add unit tests to compare cloned cart objects to original (#17560)
* Add unit tests to compare cloned cart objects to original

* Don't use reflection for fees test

* Skip test using ReflectionProperty::setAccessible() below PHP 5.3
2017-11-10 12:03:14 +00:00
Mike Jolley 78466a6665
Merge pull request #17599 from JPry/allow_clone_cart
Allow for cloning the WC_Cart object
2017-11-10 12:02:59 +00:00
Claudio Sanches b04c7bd71e
Merge pull request #17628 from woocommerce/fix/17624
Change how line items are saved in API
2017-11-09 17:36:39 -02:00
Mike Jolley 6e08ff0284
Merge pull request #17610 from woocommerce/update/17557
Theme support to declare image sizes
2017-11-09 16:04:22 +00:00
Claudio Sanches 9979e4b3e5
Merge pull request #17589 from woocommerce/fix/17585
get_total_ex_tax should exclude fee taxes
2017-11-08 19:05:23 -02:00
Jeremy Pry cf5bd606c6 Rename register_hooks() to init() 2017-11-08 10:17:52 -05:00
Mike Jolley 827d133cb2 Improve tests 2017-11-08 13:54:33 +00:00
Mike Jolley 0198aa22ac Fix up test 2017-11-08 12:32:08 +00:00
Mike Jolley f5c7164ae5 Added a test to confirm this issue is specific to the API 2017-11-08 12:16:22 +00:00