Commit Graph

1298 Commits

Author SHA1 Message Date
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
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
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