Commit Graph

39809 Commits

Author SHA1 Message Date
Claudio Sanches 1f51e0c9fc
Remove "Features" menu 2021-04-12 12:50:21 +02:00
Nestor Soriano 65c1c9ec54
Fix unit tests after merging from trunk 2021-04-12 12:50:21 +02:00
Nestor Soriano d820fbe4a7
Fix wrong handling of the shipping - shipping options section. 2021-04-12 12:42:40 +02:00
Nestor Soriano e5f234ec0f
Re-implement the flushing of the term count cache that was lost on merge
Also add unit tests for it.
2021-04-12 12:42:39 +02:00
Nestor Soriano 8a60e7e147
Move code hacker resetting from BeforeTestHook to setUp
The code hacker needs to be reset before each test. This was done via
a couple of classes implementeing BeforeTestHook, those were registered
in phpunit.xml.

The problem is that the PHPUnit version used for WooCommerce unit test
has recently been changed from 7.5 to 6.5 for compatibility with
PHP 7.0, and hook classes were introduced in PHPUnit 7. Thus no hooks
were ran, the code hacker wasn't reset, that caused some functions
to remain hacked between tests, and this made some tests to fail.

The solution is to move the code hacker reset to the setUp method
in the base unit test class.
2021-04-12 12:42:39 +02:00
Nestor Soriano 7440e95b72
Fix unit tests after merge from master 2021-04-12 12:42:39 +02:00
Nestor Soriano bcf24f0f8c
Fix unit test problems in PHP 7.0.
This includes removing two array_merge and array_merge_eecursive
statements in the code hacker, that apparently were working differently
in PHP 7.0.
2021-04-12 12:42:39 +02:00
Nestor Soriano 5a11d9e064
Refactor the settings pages, and add unit tests for them.
This commit fixes some inconsistencies in the settings pages, and
makes all the existing pages extensible by adding new sections
(that was possible in some pages, but not in others). Main changes:

1. Modify the 'get_sections' method so that it invokes a new protected
   'get_own_sections' method and then triggers the
   'woocommerce_get_sections_' . id filter.

This way the filter is triggered only in the base class
and not in each of the derived classes too.

2. Change the get_settings() method so that it has its signature
   changed to get_settings( $current_section = '' )
   in the base class and in all the derived class.

Some derived classes were already using this signature, but others
(those not having multiple sections natively) weren't, making then
effectively impossible to define multiple sections for these pages
via filters.

With this change all the section pages act consistently and allow
both adding new settings to the default "General" section
and creating new sections via filters.

3. Change the implementation of 'get_settings' in the base class
   so that it searches for a 'get_settings_for_{section_id}_section'
   method in the class and executes it, otherwise it executes the new
   protected method get_settings_for_section( $current_section ); then
   it triggers the 'woocommerce_get_settings_' . id filter.

This makes it easier to separate the code that returns the list
of filters in multiple methods, one per section, instead of using
one big if-else-else... block.

So now instead of overriding get_settings($current_section='') derived
classes need to implement get_settings_for_{$current_section}_section
for each section, or override get_settings_for_section($current_section)
or both. 'get_settings_for_section' returns an empty array by default.

Also, 'woocommerce_get_settings_' . id is triggered in one single
place too.

Other improvements:

* Remove duplicated code from 'output' in 'WC_Settings_Page' children.

Some classes inherited from 'WC_Settings_Page' override the 'output'
method with custom code, which in all cases ended up repeating the code
of the original method as a fallback. These repetitions have been
replaced with 'parent::output()'.

* Fix inconsistencies for 'save' and 'output' in WC_Settings_Tax/Emails

The 'WC_Settings_Tax' and 'WC_Settings_Emails' classes had some
inconsistencies in their 'save' and 'output' methods that prevented the
proper creation new sections and the addition of new settings via the
'woocommerce_get_sections_' and 'woocommerce_get_settings_' filters.
Now they work as expected.

* Deduplicate parts of 'save' in 'WC_Settings_Page' and children.

Two methods have been added to 'WC_Settings_Page' class:
'save_settings_for_current_section' and 'do_update_options_action'.
These are intended to be invoked by derived classes in their 'save'
methods, in order to remove code repetition.

* Add some helper methods to WC_Unit_Test_Case.

Methods added:
- assertOutputsHTML
- assertEqualsHTML
- normalize_html
- capture_output_from
2021-04-12 12:42:26 +02:00
Roy Ho 66b39c7ec7
Merge pull request #29322 from woocommerce/fix/ie11-tracking-error
IE 11 compatibility for the site tracking enable function
2021-04-09 13:28:45 -07:00
Ron Rennick a517d88132 merge trunk 2021-04-09 17:08:17 -03:00
Ron Rennick c94ddb8803 update package changelogs, minor fixes from full PR review 2021-04-09 16:39:30 -03:00
Ron Rennick fcbbb12a8a add retry support 2021-04-09 16:15:00 -03:00
Néstor Soriano 9e8db78ad6
Merge pull request #29631 from raicem/fix/download-permissions
Call "wc_downloadable_file_permission" with the right product id
2021-04-09 17:26:55 +02:00
roykho e1c6c540d7
Convert notices to use native nonce generation from WC Admin 2021-04-09 05:33:06 -07:00
Tam Mullen 2558848198
Merge pull request #29626 from woocommerce/e2e/e2e-fix-products-import-csv-test
Fix e2e test merchant import products via csv
2021-04-09 11:58:06 +01:00
Veljko bdd9fe7318 Add waitForNavigation on Continue clicking 2021-04-09 11:48:17 +02:00
Néstor Soriano fd09d9f8e9
Merge pull request #29624 from woocommerce/preparation/5.2.0
Release preparation: 5.2.0
2021-04-09 09:47:02 +02:00
raicem 91a184dc77 Make the call to "wc_downloadable_file_permission" with the right product id
With the PR #23188, "$product_id" variable become undefined.
2021-04-09 09:39:49 +03:00
Rodel Calasagsag 11dce13701
Merge branch 'trunk' into e2e/e2e-merchant-settings-add-shipping-classes 2021-04-08 22:17:40 -07:00
Roy Ho 72cc2c2a50
Merge pull request #29422 from Mauricio-Urrego/fix/issue-29421
Avoids redirect caused by some custom permalink structures.
2021-04-08 13:24:59 -07:00
Veljko bc40163155 Make the test more granular 2021-04-08 19:01:54 +02:00
Veljko d4d93f9239 Remove shipping method deletion 2021-04-08 18:18:59 +02:00
Veljko fc14a4e5da Add missing beforeAll code 2021-04-08 17:20:03 +02:00
Veljko a9ce07c020 Update test 2021-04-08 17:11:29 +02:00
Nestor Soriano dddfe437f9
Change stable tag in readme.txt to 5.2 2021-04-08 16:18:03 +02:00
Nestor Soriano 56d44cf989
Collapse changelogs for 5.2 beta and rc, add last minute entries 2021-04-08 16:16:50 +02:00
Tam Mullen 59ed09157b
Merge pull request #29426 from woocommerce/e2e/e2e-merchant-import-products
Add new e2e test merchant import products via CSV file
2021-04-08 14:46:31 +01:00
Néstor Soriano 50a502a0f6
Merge pull request #29601 from woocommerce/template-version
Bump version for template closes #29595
2021-04-08 15:33:30 +02:00
Veljko 4fed8f8dab Add missing jest/global 2021-04-08 15:09:59 +02:00
Roy Ho a8572e755c
Merge pull request #29613 from woocommerce/fix/29567
Don't show the "WooCommerce Setup" widget in dashboard if WC Admin is disabled
2021-04-08 05:39:32 -07:00
Veljko 7a1ba36fc9 Added new component and updated tests 2021-04-08 12:41:02 +02:00
Néstor Soriano 439d26be82
Merge pull request #29606 from woocommerce/fix/29545
Don't verify empty country codes on checkout
2021-04-08 12:40:13 +02:00
Veljko b195e354a2 Make test more granular 2021-04-08 11:44:54 +02:00
Veljko 6574db5c2c Add additional test scenarios 2021-04-08 10:43:07 +02:00
Veljko 615bb66d41 Revert timeout back and split test 2021-04-08 10:09:12 +02:00
Nestor Soriano 1cf6b9d39e
Extra check for not showing the "WooCommerce Setup" widget in dashboard
if WC Admin is disabled
2021-04-08 09:31:51 +02:00
Veljko ca4d690c5c Try with 45s timeout 2021-04-08 09:19:47 +02:00
Chris Diehl e5341ae237 Updates standardization from ISO to CLDR 2021-04-07 22:47:12 -04:00
Ron Rennick 4732a09b23 minor fixes from visual diff 2021-04-07 23:06:00 -03:00
Ron Rennick af698acc8e
Merge pull request #29509 from woocommerce/add/feedback-label-action
add contributor feedback label action
2021-04-07 22:55:20 -03:00
Ron Rennick d025f47449 allow multiple runs of setup/onboarding 2021-04-07 22:54:25 -03:00
Ron Rennick 86e83b6560 reset onboarding, shipping, tracking 2021-04-07 19:25:09 -03:00
Roy Ho 8052fbe7be
Merge pull request #29605 from woocommerce/fix/28759-billing-shipping-addresses
Fix/28759 billing shipping addresses
2021-04-07 14:34:01 -07:00
Barry Hughes 568e1e4f94
Add `@since` tag 2021-04-07 14:11:08 -07:00
Ron Rennick 1affe03ac6 add conditions for github actions and open issues 2021-04-07 17:25:26 -03:00
Claudio Sanches ec77c3bcc9
Merge pull request #29603 from masteradhoc/masteradhoc-accessibility-strikethrough-price
Improve WooCommerce Accessibility - Strikethrough Price
2021-04-07 13:41:08 -03:00
Claudio Sanches 76a930345f
Merge pull request #29586 from masteradhoc/masteradhoc-portugal-states
add portugal states
2021-04-07 13:31:30 -03:00
Claudio Sanches d71fcfda9c
Update i18n/states.php 2021-04-07 13:31:04 -03:00
Brian 52ccacd094
Update states.php
change codes again
2021-04-07 17:53:39 +02:00
Veljko 9fdbaae76e Add changelog and update spaces 2021-04-07 17:52:58 +02:00