Fix phpunit
Some checks failed
CI / PHP 7.4 (push) Has been cancelled
CI / PHP 8.0 (push) Has been cancelled
CI / PHP 8.1 (push) Has been cancelled
CI / PHP 8.2 (push) Has been cancelled
CI / PHP 8.3 (push) Has been cancelled
CI / PHP 8.4 (push) Has been cancelled
PR Playground Demo / prepare_version (push) Has been cancelled
PR Playground Demo / build_plugin (push) Has been cancelled
PR Playground Demo / create_archive (push) Has been cancelled
PR Playground Demo / Comment on PR with Playground details (push) Has been cancelled

This commit is contained in:
Emili Castells Guasch 2025-08-18 17:13:37 +02:00
parent d84a7dd5bb
commit 63426a67f3
No known key found for this signature in database

View file

@ -84,6 +84,18 @@ class ChangeCartEndpointTest extends TestCase
->with(ChangeCartEndpoint::nonce())
->andReturn($data);
// Mock WC session for shipping data preservation
$session = Mockery::mock(\WC_Session::class);
$session->shouldReceive('get')
->with('chosen_shipping_methods')
->andReturn(null);
$session->shouldReceive('set')
->with('chosen_shipping_methods', Mockery::any());
$wc = Mockery::mock();
$wc->session = $session;
expect('WC')->andReturn($wc);
$pu = Mockery::mock(PurchaseUnit::class);
$pu
->shouldReceive('to_array')