Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit f024262

Browse files
authored
Fix broken PHPunit tests (#3690)
* Ensure phpunit tests are running against the blocks code and not what is included in WooCommerce core. * cast to object to correct response expectations. The change in https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3679/files#diff-5d8cf88af3d9be56abf0b110a7500b3711552009533d894e07f0e891b4af266eL317 resulted in a change in shape for the response.
1 parent c7764f3 commit f024262

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/StoreApi/Schemas/CartSchema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public function get_item_response( $cart ) {
338338
'needs_shipping' => $cart->needs_shipping(),
339339
'has_calculated_shipping' => $has_calculated_shipping,
340340
'fees' => $this->get_item_responses_from_schema( $this->fee_schema, $cart->get_fees() ),
341-
'totals' => $this->prepare_currency_response(
341+
'totals' => (object) $this->prepare_currency_response(
342342
[
343343
'total_items' => $this->prepare_money_response( $cart->get_subtotal(), wc_get_price_decimals() ),
344344
'total_items_tax' => $this->prepare_money_response( $cart->get_subtotal_tax(), wc_get_price_decimals() ),

tests/bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ function wc_install_core() {
107107
tests_add_filter(
108108
'muplugins_loaded',
109109
function() {
110+
define( 'JETPACK_AUTOLOAD_DEV', true );
110111
wc_load_core();
111112
// install blocks plugin
112113
wc_blocks_install();

0 commit comments

Comments
 (0)