Commit Graph

208 Commits

Author SHA1 Message Date
Nestor Soriano e1f19e2d23
Fix: 'woocommerce_email_settings' filter being triggered twice. 2021-08-02 09:33:18 +02:00
Nestor Soriano 9583d57d26
Fix option names used by the product attributes lookup table feature
The feature was using option names prefixed with
"woocommerce_attribute_lookup__". That double underscore breaks WP
standards for option names. The option names have been changed
so that they use a single underscore instead.
2021-07-30 11:16:05 +02:00
barryhughes fbda9cb58e Update with latest changes from trunk. 2021-07-21 14:54:53 -07:00
Joel Thiessen 9801cd80c6 Patcing tests relevant to new payment gateway API 2021-07-21 12:06:41 -07:00
barryhughes 46f9644eae Update test for product download settings. 2021-07-20 11:18:22 -07:00
Nestor Soriano 2fe8cce9b0
Fix unit tests for the LookupDataStore class 2021-07-01 12:01:07 +02:00
Nestor Soriano d3131a67e6
Fix unit tests for the DataRegenerator class 2021-07-01 09:32:57 +02:00
Nestor Soriano 38897a42e2
Add tests for product changes changes in LookupDataStore. 2021-06-28 12:25:48 +02:00
Nestor Soriano 48c44a6128
Add tests for product deletion in LookupDataStoreTest. 2021-06-17 15:31:23 +02:00
Nestor Soriano 0192ed0b93
Change LookupDataStore to allow updates being done in a scheduled action.
There's a new option, 'woocommerce_attribute_lookup__direct_updates'.
When set to 'yes', updates to the lookup table are performed as soon
as the change happen; otherwise, a scheduled action will do it,
the hook name is 'woocommerce_run_product_attribute_lookup_update_callback'
(the existing hook in the DataRegenerator class is renamed to
'woocommerce_run_product_attribute_lookup_update_callback')

Also, the settings page has a new "Advanced" section with a checkbox
to control the value of that new option; the section is visible only
when the feature has been enabled via LookupDataStore::show_feature.
2021-06-15 16:33:29 +02:00
Nestor Soriano 7c9137698b
Implement handling of changesets in the LookupDataStore class. 2021-06-11 11:44:57 +02:00
Nestor Soriano bbddcbcc15
Fix in FiltererTest after mrging from trunk. 2021-06-10 17:00:09 +02:00
Nestor Soriano 13ed3b80e0
Merge branch 'trunk' into add/29609 2021-06-10 12:35:34 +02:00
Nestor Soriano 039f81ea50
Implement the product attributes lookup table data creation.
Lookup entries for a product or a variation are created whenever
the product is created, including untrashing and duplication
(not yet when an existing product is modified).
2021-06-08 17:53:45 +02:00
Barry Hughes c503f5d637
Merge pull request #29896 from woocommerce/add/29610
Filter catalog products by attribute using the new lookup table
2021-06-08 07:37:06 -07:00
Nestor Soriano 0b1158cf5c
Small improvements in the filtering by attribute lookup table.
- Combined two 'if's in one
- Added extra santitization of term ids in the Filterer class
2021-06-08 10:18:35 +02:00
Claudio Sanches 94bdcd0320
Merge pull request #27684 from woocommerce/refactor/settings-pages-classes-take-2
Refactor the settings pages, and add unit tests for them
2021-06-01 13:19:49 -03:00
Nestor Soriano c6dff96c0f
Undo a wrong change in filtering logic. 2021-06-01 11:25:57 +02:00
Nestor Soriano 72442f20bb
Add the remaining tests for the Filterer class. 2021-06-01 10:06:25 +02:00
Nestor Soriano c78627e6ee
Add unit tests for the Filterer class (variable products) 2021-05-31 16:54:55 +02:00
Nestor Soriano 9878aa37aa
Add unit tests for the Filterer class (simple products only for now)
Also fix a small issue in the product counters when using "or" filter.
2021-05-28 17:27:03 +02:00
Christopher Allford 070954c888 Revert #28187
The default functionality within the `ThemeSupport` class has an unintended
side-effect of breaking the existing default functionality within the
`wc_get_theme_support()` function. Since the default set in the support
class is prioritized over the one given to `ThemeSupport::get_option()`,
the WordPress options set in the Customizer are never used for images.
2021-05-21 12:10:15 -07:00
Vedanshu Jain 6667233eb1
Merge pull request #29762 from woocommerce/fix/29502
Update restock logic during refunds closes #29502
2021-05-21 22:53:22 +05:30
Nestor Soriano 22b5ec121f
Fix: no output for settings classes that directly override get_settings. 2021-05-13 09:24:25 +02:00
jonathansadowski 692ddaf4f2
Merge pull request #29318 from woocommerce/fix/rounding
Make rounding more accurate when prices are entered more than 2dp
2021-05-12 17:43:29 -05:00
roykho b808d9a24f
Fix merge conflicts 2021-05-11 08:53:03 -07:00
roykho 8c3e90b3ce
Initialize _restock_refunded_items meta on order update 2021-05-11 08:35:48 -07:00
Nestor Soriano 8b12fee96f
Merge branch 'trunk' into refactor/settings-pages-classes-take-2 2021-05-07 12:16:13 +02:00
vedanshujain f53e9dde44 Use edit context to get unformatted price. 2021-05-07 14:59:14 +05:30
vedanshujain 6c2f30132d Add clear cart call to prevent side effects from tests. 2021-05-07 14:30:45 +05:30
vedanshujain 162588c42d Add test for when product prices has more precision than is displayed. 2021-05-07 14:30:44 +05:30
vedanshujain c834dfb98b Add test for when entered price has more precision than displayed price. 2021-05-07 14:30:44 +05:30
vedanshujain 2930057847 Add tests to make sure discounts are rounded properly in cart. 2021-05-07 14:30:44 +05:30
Nestor Soriano 9dcdfddc15
Fix table creation detection in DataRegeneratorTest 2021-05-05 11:50:43 +02:00
Nestor Soriano f53f959d03
Fix the usage of FakeQueue in DataRegeneratorTest.
Also update the doc comment of FakeQueue itself on how to use it.
2021-05-05 11:11:36 +02:00
Nestor Soriano c4e7074c70
Add unit tests for the DataRegenerator class 2021-05-04 16:15:16 +02:00
Nestor Soriano 4d13b0ca07
ExtendedContainer::replace now allows registering anonymous classes. 2021-05-04 16:14:34 +02:00
roykho 2e3156d436
Use proper skip test method instead of return 2021-05-03 06:33:09 -07:00
Nestor Soriano 42245ed92a
Add unit tests for LookupDataStore::update_data_for_product (variable products) 2021-05-03 11:14:33 +02:00
Nestor Soriano 467af94b1d
Add unit tests for LookupDataStore::update_data_for_product (simple products)
Also:

- Add the FakeQueue class
- Fix LookupDataStore, it was using a hardcoded "wp_" lookup table name
2021-04-30 12:10:25 +02:00
roykho 87047c77df
Limit the new refund restock logic to order version 5.4+ 2021-04-29 06:30:53 -07:00
Nestor Soriano 10adec6b88
Improvements in the engine behind the debug tools page.
Two new optional keys have been added to the tool definition array:

- 'disabled': when true the tool button will appear disabled.
- 'needs_refresh': when running a tool, by default the tool definitions
  are retrieved first, then the selected tool is executed,
  then the definitions previously retrieved are rendered.
  When this key is true the tool definitions are retrieved again
  after execution, useful for cases where the tool description
  or button enable/disable state changes after the tool execution.

Also now if a tool execution throws an exception a notice will be
shown with the execption message, previously the exception
was unhandled.
2021-04-28 10:24:23 +02:00
roykho b69f46d7d2
Add unit tests 2021-04-27 09:29:24 -07:00
Roy Ho 03d4d4893e
Merge pull request #28187 from woocommerce/fix/25900-take-2
Fix: image size customisation controls not shown when theme doesn't define them but Woo core does
2021-04-22 05:41:57 -07:00
Nestor Soriano 3a895c9eed
Move ThemeSupport class to Internal namespace, and use in 2021 theme. 2021-04-21 12:57:56 +02:00
Roy Ho e4fec5b914
Merge pull request #29721 from woocommerce/fix/29525
Modify wc_get_low_stock_amount function to always return a number
2021-04-20 11:56:27 -07:00
Nestor Soriano b88eb4c981
Rename "assertIsInt" to "assertIsInteger" and make it static
- Renaming to prevent conflicts with the existing method in
  the newer PHPUnit used in PHP 8.
- Making it static because "assertIsInt" is static too, so it'll be
  easier to replace in the future.
2021-04-20 17:16:59 +02:00
Nestor Soriano d11a20b5b4
Merge branch 'trunk' into fix/25900-take-2 2021-04-20 16:08:45 +02:00
Nestor Soriano 76a613a5bb
Modify wc_get_low_stock_amount so that it always returns an integer.
Previously, if the product didn't have an explicit low stock value
amount the value of the woocommerce_notify_low_stock_amount option,
which is a string, was returned verbatim.

Also, update related unit tests to create the option value as a string,
and to check that the value returned by woocommerce_notify_low_stock_amount
is always an integer.
2021-04-20 10:17:50 +02:00
Nestor Soriano 1008835488
Fix code sniffer violations in stock functions and its tests 2021-04-20 09:42:07 +02:00