fix: tests after rebasing

This commit is contained in:
Francis Hilaire 2026-06-25 11:01:57 +02:00
parent c6782b0728
commit a9d8f04bc1
No known key found for this signature in database
GPG key ID: 3392F830BF33D421

View file

@ -21,11 +21,11 @@ use PHPUnit\Framework\TestCase;
use Sylius\Bundle\CoreBundle\OrderPay\Resolver\PaymentToPayResolverInterface; use Sylius\Bundle\CoreBundle\OrderPay\Resolver\PaymentToPayResolverInterface;
use Sylius\Bundle\PayumBundle\Model\GatewayConfig; use Sylius\Bundle\PayumBundle\Model\GatewayConfig;
use Sylius\Bundle\PayumBundle\OrderPay\Provider\PayumPayResponseProvider; use Sylius\Bundle\PayumBundle\OrderPay\Provider\PayumPayResponseProvider;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration;
use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Core\Model\PaymentMethodInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
final class PayumPayResponseProviderTest extends TestCase final class PayumPayResponseProviderTest extends TestCase
{ {
@ -53,7 +53,7 @@ final class PayumPayResponseProviderTest extends TestCase
public function testItCreatesCaptureTokenWithConfiguredAfterPayRouteAndParameters(): void public function testItCreatesCaptureTokenWithConfiguredAfterPayRouteAndParameters(): void
{ {
$requestConfiguration = $this->createStub(RequestConfiguration::class); $request = $this->createStub(Request::class);
$order = $this->createOrder(); $order = $this->createOrder();
$payment = $this->createPaymentWithGatewayConfig(['use_authorize' => false]); $payment = $this->createPaymentWithGatewayConfig(['use_authorize' => false]);
$token = $this->createMock(TokenInterface::class); $token = $this->createMock(TokenInterface::class);
@ -79,7 +79,7 @@ final class PayumPayResponseProviderTest extends TestCase
$this->tokenFactory->expects(self::never())->method('createAuthorizeToken'); $this->tokenFactory->expects(self::never())->method('createAuthorizeToken');
$token->expects(self::once())->method('getTargetUrl')->willReturn('/payum/capture'); $token->expects(self::once())->method('getTargetUrl')->willReturn('/payum/capture');
$response = $this->provider->getResponse($requestConfiguration, $order); $response = $this->provider->getResponse($request, $order);
self::assertInstanceOf(RedirectResponse::class, $response); self::assertInstanceOf(RedirectResponse::class, $response);
self::assertSame('/payum/capture', $response->getTargetUrl()); self::assertSame('/payum/capture', $response->getTargetUrl());
@ -87,7 +87,7 @@ final class PayumPayResponseProviderTest extends TestCase
public function testItCreatesAuthorizeTokenWithConfiguredAfterPayRouteAndParameters(): void public function testItCreatesAuthorizeTokenWithConfiguredAfterPayRouteAndParameters(): void
{ {
$requestConfiguration = $this->createStub(RequestConfiguration::class); $request = $this->createStub(Request::class);
$order = $this->createOrder(); $order = $this->createOrder();
$payment = $this->createPaymentWithGatewayConfig(['use_authorize' => true]); $payment = $this->createPaymentWithGatewayConfig(['use_authorize' => true]);
$token = $this->createMock(TokenInterface::class); $token = $this->createMock(TokenInterface::class);
@ -113,7 +113,7 @@ final class PayumPayResponseProviderTest extends TestCase
$this->tokenFactory->expects(self::never())->method('createCaptureToken'); $this->tokenFactory->expects(self::never())->method('createCaptureToken');
$token->expects(self::once())->method('getTargetUrl')->willReturn('/payum/authorize'); $token->expects(self::once())->method('getTargetUrl')->willReturn('/payum/authorize');
$response = $this->provider->getResponse($requestConfiguration, $order); $response = $this->provider->getResponse($request, $order);
self::assertInstanceOf(RedirectResponse::class, $response); self::assertInstanceOf(RedirectResponse::class, $response);
self::assertSame('/payum/authorize', $response->getTargetUrl()); self::assertSame('/payum/authorize', $response->getTargetUrl());
@ -121,7 +121,7 @@ final class PayumPayResponseProviderTest extends TestCase
public function testItSupportsOrdersWithPayumEnabledPayment(): void public function testItSupportsOrdersWithPayumEnabledPayment(): void
{ {
$requestConfiguration = $this->createStub(RequestConfiguration::class); $request = $this->createStub(Request::class);
$order = $this->createOrder(); $order = $this->createOrder();
$payment = $this->createPaymentWithGatewayConfig([]); $payment = $this->createPaymentWithGatewayConfig([]);
@ -132,12 +132,12 @@ final class PayumPayResponseProviderTest extends TestCase
->willReturn($payment) ->willReturn($payment)
; ;
self::assertTrue($this->provider->supports($requestConfiguration, $order)); self::assertTrue($this->provider->supports($request, $order));
} }
public function testItDoesNotSupportOrdersWithPayumDisabledPayment(): void public function testItDoesNotSupportOrdersWithPayumDisabledPayment(): void
{ {
$requestConfiguration = $this->createStub(RequestConfiguration::class); $request = $this->createStub(Request::class);
$order = $this->createOrder(); $order = $this->createOrder();
$gatewayConfig = new GatewayConfig(); $gatewayConfig = new GatewayConfig();
$gatewayConfig->setUsePayum(false); $gatewayConfig->setUsePayum(false);
@ -150,7 +150,7 @@ final class PayumPayResponseProviderTest extends TestCase
->willReturn($payment) ->willReturn($payment)
; ;
self::assertFalse($this->provider->supports($requestConfiguration, $order)); self::assertFalse($this->provider->supports($request, $order));
} }
private function createOrder(): MockObject&OrderInterface private function createOrder(): MockObject&OrderInterface