Commit Graph

34685 Commits

Author SHA1 Message Date
Nestor Soriano 57845ef8b8 All code hacking files moved to src\Testing folder. 2020-05-20 09:56:25 +02:00
Nestor Soriano 1a68abbc28 Miscellaneous code hacking fixes:
- Fix how CodeHackerTestHook::executeBeforeTest parses the test name,
  to account for warnings and tests with data sets.

- CodeHackerTestHook now includes a executeAfterTest hook that
  disables the code hacker (needed to prevent it from inadvertently
  altering further tests). Also, clear_hacks is executed in
  executeBeforeTest for the same reason.

- CodeHacker gets restore, clear_hacks and is_enabled methods
  to support the changes in CodeHackerTestHook.

- FunctionsMockerHack fixed so that it doesn't modify strings
  that are class method definitions.

- Added the WC_Unit_Test_Case::file_copy method, it must be used
  instead of the PHP built-in "copy" in tests, otherwise tests
  that run with the code hacker active will fail.
  This is something to investigate.
2020-05-20 09:56:25 +02:00
Nestor Soriano 9a5b3b353d Add the @hack code annotation for tests.
Now @hack class and method annotations can be used to register
code hacks as an alternative to using before_ methods.
The syntax is /* @hack HackClassName param1 param2 */
where parameters will be passed to the class constructor.
If the class name ends with "Hack", then that suffix can be
omitted (e.g. "Foo" can be specified instead of "FooHack").
2020-05-20 09:56:25 +02:00
Nestor Soriano db58b51de3 Barebones implementation of a code hacker for unit tests.
The "code hacker" is a class that hooks on filesystem events
(using stream_wrapper_unregister) in order to allow for dynamically
modifying the content of PHP code files while they are loaded.
The code hacker class allows registering hacks, which are
functions that take source code as input and return the modified code.
A hack can be a standalone function or a class with a "hack" method.

A few hacks are provided off the shelf. One allows mocking standalone
PHP functions (WP, WOO or not), another one allows mocking static
methods, and there's the one that removes the "final" qualifier
from a class definition. This helps unit testing stuff that would
otherwise be quite hard to test.
2020-05-20 09:56:25 +02:00
Christopher Allford 4750a2d567
Merge pull request #26550 from woocommerce/fix/update-wp-minimum
Adhere to WP support policy
2020-05-19 09:21:09 -07:00
Vedanshu Jain 12ff70fb14
Merge pull request #26549 from woocommerce/fix/26493-error-handling
Call callback on tracking script load error
2020-05-19 21:09:06 +05:30
Joshua Flowers b7bca44beb Call callback on tracking script load error 2020-05-19 18:19:19 +03:00
Christopher Allford df7db72855 Cleaned up our Travis config to suit the WP support policy 2020-05-19 07:00:32 -07:00
Christopher Allford 7db709957b Increased the WordPress minimum version to 5.2 as per our support policy 2020-05-19 06:59:52 -07:00
Vedanshu Jain 5adaa5667e
Merge pull request #26493 from woocommerce/fix/26466
Add function to allow client-side enabling of tracks
2020-05-19 16:30:45 +05:30
Vedanshu Jain 7fb1079137
Merge pull request #26399 from woocommerce/fix/uploads_htaccess
Disable directory listing for redirect download method
2020-05-19 15:56:37 +05:30
Joshua Flowers 07b1887c2b Use var instead of const 2020-05-18 19:11:29 +03:00
Claudio Sanches eea062f9fa
Merge pull request #26519 from woocommerce/fix/csv-import-special-columns
Fixed the case conversion for meta key column mapping in product CSV imports
2020-05-18 11:33:50 -03:00
Peter Fabian e3e72e0423
Merge pull request #26500 from woocommerce/fix/26443
Refresh db update nonce on the Thank you notice
2020-05-18 14:36:13 +02:00
Néstor Soriano 8b0d4ef050
Merge pull request #26386 from woocommerce/fix/26355
Set an error ID for each WP_Error entry
2020-05-15 12:09:14 +02:00
Néstor Soriano 3d2927f6e1
Merge pull request #26407 from woocommerce/feature/build-zip
Introduced script to generate a zip package
2020-05-15 10:59:04 +02:00
Néstor Soriano eab8920a07
Merge pull request #26314 from woocommerce/add/build-workflow
Build release workflow
2020-05-15 10:36:34 +02:00
Peter Fabian 0934f4a147 Merged should_show_notice and show_reminder and simplified logic.
Removed redundant calls to the same functions as this code runs on each admin pageload.
2020-05-15 10:24:30 +02:00
Néstor Soriano b9875a4fc1
Merge pull request #26445 from tsteur/issue_26414
Add hooks to "Add payment method form" to show additional fields and validate input
2020-05-15 10:16:53 +02:00
Peter Fabian 2f141eca77 PHPCS 2020-05-15 09:40:23 +02:00
Peter Fabian 50e386cbe8 Corrected the comment. 2020-05-15 09:26:17 +02:00
Christopher Allford 7bf9c31f64 Adjusted the column name normalization to avoid squashing meta key case sensitivity
Since we were converting the field to lowercase we ended up inserting meta in all lowercase, regardless of what it was in the CSV file. We should only be using the normalized field name when looking at the default columns, and should instead rely on a case-insensitive regex for the special columns.

One thing to note is that we're still defaulting the $headers array to the normalized field, as we don't want to change what is being passed to the filter for unmapped columns.
2020-05-14 21:20:55 -07:00
Christopher Allford 63ba6f7ee0 Moved the PSR-4 namespaced test directory to the correct folder
I know this probably doesn't belong in this PR, but it has been thoroughly discussed and I don't think anyone will mind :)
2020-05-14 21:20:47 -07:00
Christopher Allford aa6a025526
Merge pull request #26517 from woocommerce/revert-25517-duplicated-custom-fields-after-import
Revert "Fix duplicated custom fields after import products from .csv file"
2020-05-14 14:32:09 -07:00
Thomas Steur 630b7f436d apply review feedback: better naming and coding style fix 2020-05-15 09:08:35 +12:00
Claudio Sanches c09a269589
Revert "Fix duplicated custom fields after import products from .csv file" 2020-05-14 14:06:01 -03:00
Néstor Soriano 2462877c56
Merge pull request #26410 from woocommerce/fix/message-type-styling
Allow different notice types with WC_Admin_Notices
2020-05-14 14:37:12 +02:00
Peter Fabian 777c140611 Skip tests when WC Admin is not active.
Since those Notes were created because of WC Admin and the display is handled by WC Admin, it does not make sense to test them without WC Admin.
In addition, the data store that handles these Notices is not loaded without WC Admin.
2020-05-14 14:35:09 +02:00
Peter Fabian 2c1625d3f9 Added a couple of tests for WC_Notes_Run_Db_Update, a poorly testable class. 2020-05-14 13:31:43 +02:00
Joshua Flowers ef131029a5 Add function to enable tracking client-side 2020-05-13 17:44:26 +03:00
Peter Fabian 6b11451b88 Replaced repeated code from get_current_notice with the function call. 2020-05-13 16:36:09 +02:00
Peter Fabian a2f985414e Added freshness check also for 'done' notice. 2020-05-13 16:34:23 +02:00
Peter Fabian ed64c0c731 Y U no nonce here? 2020-05-13 16:33:27 +02:00
Peter Fabian eb0879cd1a Extracted actions to the beginning of the function to allow usage in note_up_to_date check. 2020-05-13 16:32:42 +02:00
Joshua Flowers 3f9db6a558 Add property to check if wcTracks is enabled 2020-05-13 16:53:57 +03:00
Joshua Flowers 07087c79a7 Always show tracks function in footer 2020-05-13 16:49:54 +03:00
Peter Fabian a7203ec4d0 Added clean up of duplicate notes, if there are any.
There has been some reports about duplicate notes in the db, so this should remove the duplicates and keep the first one.
2020-05-13 15:00:04 +02:00
Christopher Allford 2c192410a2
Merge pull request #26477 from woocommerce/update/4-1-changelog
Added 4.1.0 entry in CHANGELOG.txt
2020-05-12 14:12:58 -07:00
Claudio Sanches ac1c6533eb Added 4.1.0 entry in CHANGELOG.txt 2020-05-12 18:03:53 -03:00
Christopher Allford 78197eb3de
Merge pull request #26476 from woocommerce/update/4.3-dev
Prepare master for 4.3.0 development
2020-05-12 13:52:41 -07:00
Claudio Sanches a7a1ffaaef Updated package.json 2020-05-12 17:50:33 -03:00
Claudio Sanches f01c5a3b79 Start 4.3.0 development 2020-05-12 17:49:20 -03:00
Claudio Sanches a8948291f6
Merge pull request #26448 from woocommerce/update/26447-readme-wc-docs-link
Update README.md link to WooCommerce documentation
2020-05-12 17:24:25 -03:00
Claudio Sanches 1d99c343e7 Added unit tests 2020-05-12 15:36:25 -03:00
Christopher Allford a34bb53d9c
Merge pull request #26207 from woocommerce/feature/26186
Added notice to check if uploads directoy is public
2020-05-12 11:22:49 -07:00
Claudio Sanches 281459914b
Fixed space in URL 2020-05-12 15:16:36 -03:00
Claudio Sanches 8d6e13952a
New docs URL 2020-05-12 15:16:11 -03:00
Christopher Allford 1254f635f5
Merge pull request #26408 from woocommerce/update/action-scheduler-3.1.6
update Action Scheduler to 3.1.6
2020-05-12 10:53:24 -07:00
Ron Rennick 229841b9b5 fix merge conflicts take 2 2020-05-12 14:32:59 -03:00
Christopher Allford 2af182f207
Merge pull request #26433 from woocommerce/renovate/woocommerce-woocommerce-admin-1.x
Update dependency woocommerce/woocommerce-admin to v1.2.0
2020-05-12 10:28:08 -07:00