Commit Graph

1240 Commits

Author SHA1 Message Date
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
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
Mike Jolley 6b722e1120 Update tests to use subtotal as a basis for the discounts. 2018-02-27 18:57:28 +00: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