diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df11b91..5fa8677 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -227,6 +227,17 @@ jobs: composer require "friendsofsymfony/oauth-server-bundle:>2.0.0-alpha.0 ^2.0@dev" --no-update --no-scripts --no-interaction # Sylius issues on `json_array` type not existing composer require "doctrine/dbal:^2.6" --no-update --no-scripts --no-interaction + composer require "nyholm/psr7" --no-update --no-scripts --no-interaction + - + name: Fix build on Sylius 1.10 + if: matrix.sylius == '~1.10.0' + run: | + composer require "nyholm/psr7" --no-update --no-scripts --no-interaction + - + name: Fix build on Sylius 1.11 + if: matrix.sylius == '~1.11.0' + run: | + composer require "nyholm/psr7" --no-update --no-scripts --no-interaction - name: Install PHP dependencies @@ -281,7 +292,7 @@ jobs: - name: Upload Behat logs - uses: actions/upload-artifact@v3 + uses: codecov/codecov-action@v3 if: failure() with: name: Behat logs diff --git a/tests/Application/.env b/tests/Application/.env index db68ae9..c0926a9 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -25,7 +25,7 @@ JWT_PASSPHRASE=acme_plugin_development # For Gmail as a transport, use: "gmail://username:password@localhost" # For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" # Delivery is disabled by default via "null://localhost" -MAILER_URL=smtp://localhost +MAILER_URL=null://localhost ###< symfony/swiftmailer-bundle ### ###> symfony/mailer ### diff --git a/tests/Application/config/sylius/1.10/packages/payum.yaml b/tests/Application/config/sylius/1.10/packages/payum.yaml new file mode 100644 index 0000000..e01f066 --- /dev/null +++ b/tests/Application/config/sylius/1.10/packages/payum.yaml @@ -0,0 +1,25 @@ +services: + app.payum.http_client: + public: true + class: Tests\FluxSE\SyliusPayumStripePlugin\App\Payum\HttpClient\HttpClient + arguments: + $client: '@Psr\Http\Client\ClientInterface' + app.payum.message_factory: + public: true + class: Tests\FluxSE\SyliusPayumStripePlugin\App\Payum\Factory\MessageFactory + arguments: + $requestFactory: '@Psr\Http\Client\ClientInterface' + $responseFactory: '@nyholm.psr17.factory' + $streamFactory: '@Psr\Http\Client\ClientInterface' + + nyholm.psr17.factory: + public: true + class: Nyholm\Psr7\Factory\Psr17Factory + +payum: + gateways: + core: + httplug.message_factory: '@app.payum.message_factory' + httplug.stream_factory: '@app.payum.message_factory' + httplug.client: '@Symfony\Component\HttpClient\HttplugClient' + payum.http_client: '@app.payum.http_client' diff --git a/tests/Application/config/sylius/1.11/packages/payum.yaml b/tests/Application/config/sylius/1.11/packages/payum.yaml new file mode 100644 index 0000000..5c1cea2 --- /dev/null +++ b/tests/Application/config/sylius/1.11/packages/payum.yaml @@ -0,0 +1,29 @@ +services: + app.payum.http_client: + public: true + class: Tests\FluxSE\SyliusPayumStripePlugin\App\Payum\HttpClient\HttpClient + arguments: + $client: '@Psr\Http\Client\ClientInterface' + app.payum.message_factory: + public: true + class: Tests\FluxSE\SyliusPayumStripePlugin\App\Payum\Factory\MessageFactory + arguments: + $requestFactory: '@Psr\Http\Client\ClientInterface' + $responseFactory: '@nyholm.psr17.factory' + $streamFactory: '@Psr\Http\Client\ClientInterface' + + nyholm.psr17.factory: + public: true + class: Nyholm\Psr7\Factory\Psr17Factory + +framework: + http_client: + enabled: true # require to alias the service Psr\Http\Client\ClientInterface + +payum: + gateways: + core: + httplug.message_factory: '@app.payum.message_factory' + httplug.stream_factory: '@app.payum.message_factory' + httplug.client: '@Symfony\Component\HttpClient\HttplugClient' + payum.http_client: '@app.payum.http_client' diff --git a/tests/Application/config/sylius/1.9/packages/payum.yaml b/tests/Application/config/sylius/1.9/packages/payum.yaml new file mode 100644 index 0000000..e01f066 --- /dev/null +++ b/tests/Application/config/sylius/1.9/packages/payum.yaml @@ -0,0 +1,25 @@ +services: + app.payum.http_client: + public: true + class: Tests\FluxSE\SyliusPayumStripePlugin\App\Payum\HttpClient\HttpClient + arguments: + $client: '@Psr\Http\Client\ClientInterface' + app.payum.message_factory: + public: true + class: Tests\FluxSE\SyliusPayumStripePlugin\App\Payum\Factory\MessageFactory + arguments: + $requestFactory: '@Psr\Http\Client\ClientInterface' + $responseFactory: '@nyholm.psr17.factory' + $streamFactory: '@Psr\Http\Client\ClientInterface' + + nyholm.psr17.factory: + public: true + class: Nyholm\Psr7\Factory\Psr17Factory + +payum: + gateways: + core: + httplug.message_factory: '@app.payum.message_factory' + httplug.stream_factory: '@app.payum.message_factory' + httplug.client: '@Symfony\Component\HttpClient\HttplugClient' + payum.http_client: '@app.payum.http_client' diff --git a/tests/Application/src/Payum/Factory/MessageFactory.php b/tests/Application/src/Payum/Factory/MessageFactory.php new file mode 100644 index 0000000..063c997 --- /dev/null +++ b/tests/Application/src/Payum/Factory/MessageFactory.php @@ -0,0 +1,60 @@ +requestFactory = $requestFactory; + $this->responseFactory = $responseFactory; + $this->streamFactory = $streamFactory; + } + + public function createRequest(string $method, $uri): RequestInterface + { + return $this->requestFactory->createRequest($method, $uri); + } + + public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface + { + return $this->responseFactory->createResponse($code, $reasonPhrase); + } + + + public function createStream(string $content = ''): StreamInterface + { + return $this->streamFactory->createStream($content); + } + + public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface + { + return $this->streamFactory->createStreamFromFile($filename, $mode); + } + + public function createStreamFromResource($resource): StreamInterface + { + return $this->streamFactory->createStreamFromResource($resource); + } +} diff --git a/tests/Application/src/Payum/HttpClient/HttpClient.php b/tests/Application/src/Payum/HttpClient/HttpClient.php new file mode 100644 index 0000000..ecc464e --- /dev/null +++ b/tests/Application/src/Payum/HttpClient/HttpClient.php @@ -0,0 +1,25 @@ +client = $client; + } + + public function send(RequestInterface $request): ResponseInterface + { + return $this->client->sendRequest($request); + } +}