Create order and redirect when no order

This commit is contained in:
Alex P 2023-11-14 10:55:30 +02:00
parent 5c699c24a5
commit a61e9303e9
No known key found for this signature in database
GPG key ID: 54487A734A204D71
10 changed files with 214 additions and 131 deletions

View file

@ -3,6 +3,7 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\WcGateway\Gateway;
use Exception;
use Psr\Log\LoggerInterface;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
@ -207,13 +208,10 @@ class WcGatewayTest extends TestCase
public function testProcessPaymentFails() {
$orderId = 1;
$wcOrder = Mockery::mock(\WC_Order::class);
$lastError = 'some-error';
$error = 'some-error';
$this->orderProcessor
->expects('process')
->andReturnFalse();
$this->orderProcessor
->expects('last_error')
->andReturn($lastError);
->andThrow(new Exception($error));
$this->subscriptionHelper->shouldReceive('has_subscription')->with($orderId)->andReturn(true);
$this->subscriptionHelper->shouldReceive('is_subscription_change_payment')->andReturn(true);
$wcOrder->shouldReceive('update_status')->andReturn(true);
@ -226,7 +224,7 @@ class WcGatewayTest extends TestCase
$this->sessionHandler
->shouldReceive('destroy_session_data');
expect('wc_add_notice')
->with($lastError, 'error');
->with($error, 'error');
$redirectUrl = 'http://example.com/checkout';