Commit Graph

162 Commits

Author SHA1 Message Date
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
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
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
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
roykho c73ce8ea04
Convert to using internal DI container 2021-04-16 12:23:40 -07:00
roykho 427be84875
Add unit tests 2021-04-14 11:54:13 -07: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
Nestor Soriano a37b2a7474
Don't verify empty country codes on checkout
PR #28849 introduced a verification of the posted country code
on checkout, so an invalid code will throw an error. However there
are cases when an empty code is legitimately received, for example
when using Paypal checkout directly from the product page and
the customer doesn't have an address in his Paypal profile.
2021-04-07 09:59:56 +02:00
𝓑𝓪𝓻𝓻𝔂 𝓗𝓾𝓰𝓱𝓮𝓼 095b3e9fb9 Merge latest changes from trunk. 2021-03-31 10:25:25 -07:00
Roy Ho e4502fe314
Merge pull request #29495 from woocommerce/fix/29472
Add "postcodes" and "cities" support for the REST API tax rate creation/update endpoint
2021-03-31 08:17:31 -07:00
Nestor Soriano 64e903f65f
Update REST API v3 taxes endpoint descriptions with deprecation/introduction information. 2021-03-31 12:41:53 +02:00
Nestor Soriano 8ff664e758
Fix "doing wrong wpdb::prepare" notice for REST API get taxes endpoint. 2021-03-31 12:09:20 +02:00
Nestor Soriano ccb8cbddac Adjust tests for WC_Admin_Dashboard_Setup (consider 'payments' task) 2021-03-29 17:39:58 +02:00
𝓑𝓪𝓻𝓻𝔂 𝓗𝓾𝓰𝓱𝓮𝓼 f0c164d2d4 Do not copy fields from the billing address to the shipping address. | #28759 2021-03-26 17:08:37 -07:00
Nestor Soriano b5e13bd771 Add support for "postcodes" and "cities" (arrays) fields to the
REST API endpoints for creating and updating taxes.
2021-03-25 14:56:40 +01:00
Peter Fabian 351c07d655 Improved tests, added save points, fixed comments. 2021-03-16 13:08:29 +01:00
Peter Fabian e6cdd74a79 Add parent's default for low stock if notthing is set on individual variation.
I.e. use variation low stock amount value, if not available, use parent product's value, if not available, use the store-wide default.
2021-03-15 18:31:31 +01:00
Peter Fabian 1b53b724b2 Fix existing tests. 2021-03-11 17:02:22 +01:00
Saggre 24167a5eed Fix typos in docs 2021-03-05 11:19:58 +02:00
Moon 00a272fa85
Merge pull request #29174 from woocommerce/add/28568-dashboard-widget-finish-setup
Add/28568 dashboard widget - setup
2021-03-02 16:46:51 -08:00
Timmy Crawford 64e934e79b Remove debug code in tests. 2021-02-25 15:19:27 -08:00
Timmy Crawford 5cf3c6be8c Fix tests. 2021-02-25 15:19:27 -08:00
Timmy Crawford c7a19b538a Updates per feedback. 2021-02-25 15:19:27 -08:00
Timmy Crawford 47a3d1bfb3 Tracker: Add tracking of woocommerce_admin_disabled usage. 2021-02-25 15:19:27 -08:00
Claudio Sanches c86b0c578a Fixed copy and paste 2021-02-23 19:55:54 -03:00
Claudio Sanches 76e1ba4bf0 Validate variation ID while adding products to the cart 2021-02-23 16:27:57 -03:00
Moon 5c99233905 Minor fixes
* Removed extra double quotation from the image tag

* Fixed typo in the init() method

* Moved init() method body into the constructor -- a separate method is not necessary
2021-02-22 20:33:02 -08:00
Moon 781c5e24d7 Status dashboard widget should be rendered only if onboarding tasks have been completed or hidden 2021-02-22 15:29:47 -08:00
Claudio Sanches f41250df39 Added unit test for cart validation 2021-02-22 13:14:43 -03:00
Vedanshu Jain 03ba8838b1
Merge pull request #29099 from woocommerce/fix/27376
Make the refunds creation REST API behave more as documented
2021-02-18 14:25:38 +05:30
Moon bc3219e22e Add tests for the finish setup dashboard widget and clean up code 2021-02-17 16:07:50 -08:00
Nestor Soriano 436a3db6e4 Fix code standards errors 2021-02-16 09:23:50 +01:00
Nestor Soriano 00d6dc40f7 Fix wrong caching of taxonomy in terms and attributes controllers.
The WC_REST_Terms_Controller and WC_REST_Product_Attributes_V1_Controller
classes have a get_taxonomy method that gets the name of the taxonomy
to process from a taxonomy id passed in the request, but once the
taxonomy name has been obtained it's cached and sbsequently reused.
The problem is that these controller instances are reused if more than
one request is processed programmatically, and thus the taxonomy that
was cached once is always used even if the new request specifies a
different taxonomy id.

The fix consists of using a dictionary of taxonomy id - taxonomy name
instead of one single taxonomy for caching.

In the case of WC_REST_Terms_Controller there's a protected $taxonomy
property that needs to be kept for compatibility, it's now set to
the last taxonomy name that has been introduced in the dictionary.
2021-02-12 15:12:58 +01:00
Vedanshu Jain 5a707f3e74
Merge pull request #28849 from woocommerce/fix/27521-2
Verify country code on checkout
2021-02-11 18:59:04 +05:30
Nestor Soriano fae00e2bdf Make the refunds creation REST API behave more as documented
- Allow the list of line items to be a non-associative array
  where each item is identified by an "id" field
- Same for taxes inside line items, specify amount to refund in
  a "refund_total" key as in the case of line items
- Allow "quantity" keys as synonyms of "qty"

Also calculate "amount" automatically if missing and when all the
line items and taxes have a valid "refund_total" key.
2021-02-11 09:51:13 +01:00
Nestor Soriano e82ab487b6 validate_posted_data: check if we actually need to validate the shipping country. 2021-02-10 10:05:24 +01:00
Nestor Soriano 07f3d9dee6 Add unit tests for the WC_Checkout class. 2021-02-08 15:49:38 +01:00
Nestor Soriano 3976abffd6 Fix price filtering when there are variations.
The price filtering query wasn't working properly when there are
variations with different prices: if at least one variation was
outside of the price range but other were inside, the product wasn't
being listed.
2021-02-05 16:34:42 +01:00
Nestor Soriano 2c957d2531 Merge branch 'master' into fix/25900-take-2 2021-01-29 10:00:51 +01:00
Claudio Sanches 6701ce9c9d
Merge pull request #26983 from woocommerce/fix/25082
Use tax location from order while computing tax in discount.
2021-01-28 16:59:59 -03:00