diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f562dc17..1f0a814b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,21 +14,22 @@ on: jobs: tests: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 - name: "PHP ${{ matrix.php }}, MySQL ${{ matrix.mysql }}, Sylius ${{ matrix.sylius }}" + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" strategy: fail-fast: false matrix: - php: [7.4, 8.0] - node: [14.18] - mysql: [5.7, 8.0] - sylius: ["~1.10.0", "~1.11.0"] + php: [ "8.0" ] + symfony: [ "^5.4", "^6.0" ] + sylius: [ "~1.11.0", "~1.12.0" ] + node: [ "^14.17.x" ] + mysql: [ "8.0" ] exclude: - - sylius: "~1.11.0" - php: 7.4 + - sylius: ~1.11.0 + symfony: "^6.0" env: APP_ENV: test @@ -94,6 +95,14 @@ jobs: restore-keys: | ${{ runner.os }}-php-${{ matrix.php }}-composer- + - + name: Restrict Symfony version + if: matrix.symfony != '' + run: | + composer global config --no-plugins allow-plugins.symfony/flex true + composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" + composer config extra.symfony.require "${{ matrix.symfony }}" + - name: Restrcting Sylius version if: matrix.sylius != '' @@ -131,7 +140,7 @@ jobs: name: Prepare test application assets run: | (cd tests/Application && bin/console assets:install public -vvv) - (cd tests/Application && yarn build) + (cd tests/Application && yarn encore dev) - name: Prepare test application cache diff --git a/README.md b/README.md index 616957df..ca0f9585 100644 --- a/README.md +++ b/README.md @@ -85,15 +85,15 @@ This **open-source plugin was developed to help the Sylius community** and make We work on stable, supported and up-to-date versions of packages. We recommend you to do the same. -| Package | Version | -| --- | --- | -| PHP | ^7.4 or ^8.0 | -| ext-json: | * | -| sylius/refund-plugin | ^1.0.0| -| sylius/resource-bundle | ^1.8 | -| sylius/sylius | ^1.10.0 or ^1.11.0 | -| symfony/messenger | ^4.4 | -| adyen/php-api-library | ^10.1 | +| Package | Version | +| --- |--------------------| +| PHP | ^8.0 | +| ext-json: | * | +| sylius/refund-plugin | ^1.0.0 | +| sylius/resource-bundle | ^1.8 | +| sylius/sylius | ^1.11.0 or ^1.12.0 | +| symfony/messenger | ^5.4 | +| adyen/php-api-library | ^10.1 | ---- @@ -155,6 +155,8 @@ $ cd tests/Application $ bin/console assets:install -e test $ bin/console doctrine:database:create -e test $ bin/console doctrine:schema:create -e test +$ yarn install +$ yarn encore dev $ bin/console server:run 127.0.0.1:8080 -e test $ bin/phpunit $ bin/behat diff --git a/composer.json b/composer.json index e3cc976b..484a480b 100644 --- a/composer.json +++ b/composer.json @@ -9,16 +9,17 @@ ], "license": "MIT", "require": { - "php": "^7.4 || ^8.0", + "php": "^8.0", "adyen/php-api-library": "^11.0", "composer/package-versions-deprecated": "^1.11", + "doctrine/annotations": "^1.14", "nyholm/psr7": "^1.4", - "sylius-labs/doctrine-migrations-extra-bundle": "^0.1.4", + "psalm/plugin-symfony": "^4.0", "sylius/refund-plugin": "~1.0.0 || ^1.1", - "sylius/resource-bundle": "^1.8", - "sylius/sylius": "^1.10.0 || ^1.11.0", - "symfony/messenger": "^4.4 || ^5.0", - "symfony/serializer": "^4.4 || ^5.0" + "sylius/sylius": "~1.11.0 || ~1.12.0", + "symfony/messenger": "^5.4 || ^6.0", + "symfony/serializer": "^5.4 || ^6.0", + "symfony/webpack-encore-bundle": "^1.14" }, "require-dev": { "behat/behat": "^3.6.1", @@ -36,22 +37,19 @@ "lakion/mink-debug-extension": "^2.0.0", "phpspec/phpspec": "^7.0", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "0.12.74", - "phpstan/phpstan-doctrine": "0.12.31", + "phpstan/phpstan": "0.12.90", + "phpstan/phpstan-doctrine": "0.12.39", "phpstan/phpstan-strict-rules": "^0.12.0", "phpstan/phpstan-webmozart-assert": "0.12.12", "phpunit/phpunit": "^9.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", - "psalm/plugin-symfony": "^2.3", - "sensiolabs/security-checker": "^6.0", - "symfony/browser-kit": "^4.4", - "symfony/debug-bundle": "^4.4 || ^5.0", - "symfony/dotenv": "^4.4 || ^5.0", - "symfony/intl": "^4.4 || ^5.0", - "symfony/web-profiler-bundle": "^4.4 || ^5.0", - "symfony/web-server-bundle": "^4.4 || ^5.0", + "symfony/browser-kit": "^5.4 || 6.0", + "symfony/debug-bundle": "^5.4 || ^6.0", + "symfony/dotenv": "^5.4 || ^6.0", + "symfony/intl": "^5.4 || ^6.0", + "symfony/web-profiler-bundle": "^5.4 || ^6.0", "symplify/easy-coding-standard": "^9.3, !=9.3.27", - "vimeo/psalm": "^4.4.1" + "vimeo/psalm": "^4.4.1 || ^5.0.0" }, "config": { "sort-packages": true, diff --git a/doc/installation.md b/doc/installation.md index b9b200cc..3c9cf506 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -58,7 +58,15 @@ monolog: - adyen ``` -8. Copy Sylius templates overridden by plug-in to your templates directory (`templates/bundles/`): +8. Configure config/packages/webpack_encore.yaml +```yaml + builds: + *: * + shop: '%kernel.project_dir%/public/build/shop' + admin: '%kernel.project_dir%/public/build/admin' +``` + +9. Copy Sylius templates overridden by plug-in to your templates directory (`templates/bundles/`): ``` mkdir -p templates/bundles/SyliusAdminBundle/ @@ -68,19 +76,19 @@ cp -R vendor/bitbag/sylius-adyen-plugin/tests/Application/templates/bundles/Syli cp -R vendor/bitbag/sylius-adyen-plugin/tests/Application/templates/bundles/SyliusShopBundle/* templates/bundles/SyliusShopBundle/ ``` -9. Execute migrations +10. Execute migrations ``` bin/console doctrine:migrations:migrate ``` -10. Install assets +11. Install assets ``` bin/console assets:install ``` -11. Clear cache +12. Clear cache ``` bin/console cache:clear @@ -88,7 +96,7 @@ bin/console cache:clear **Note:** If you are running it on production, add the `-e prod` flag to this command. -12. [Obtain Adyen credentials and configure the payment method](configuration.md) +13. [Obtain Adyen credentials and configure the payment method](configuration.md) -13. If you want to access the log page, visit /adyen/log. +14. If you want to access the log page, visit /adyen/log. diff --git a/phpstan.neon b/phpstan.neon index 84af727b..a5556711 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,7 @@ parameters: reportUnmatchedIgnoredErrors: false checkMissingIterableValueType: false + checkGenericClassInNonGenericObjectType: false excludes_analyse: # Makes PHPStan crash diff --git a/src/Bus/Dispatcher.php b/src/Bus/Dispatcher.php index aac898e4..d35b8d33 100644 --- a/src/Bus/Dispatcher.php +++ b/src/Bus/Dispatcher.php @@ -17,9 +17,6 @@ final class Dispatcher implements DispatcherInterface { use HandleTrait; - /** @var MessageBusInterface */ - private $messageBus; - /** @var PaymentCommandFactoryInterface */ private $commandFactory; diff --git a/src/Callback/PreserveOrderTokenUponRedirectionCallback.php b/src/Callback/PreserveOrderTokenUponRedirectionCallback.php index c8f666a6..954b1511 100644 --- a/src/Callback/PreserveOrderTokenUponRedirectionCallback.php +++ b/src/Callback/PreserveOrderTokenUponRedirectionCallback.php @@ -11,22 +11,29 @@ namespace BitBag\SyliusAdyenPlugin\Callback; use Sylius\Component\Core\Model\OrderInterface; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\SessionInterface; class PreserveOrderTokenUponRedirectionCallback { public const NON_FINALIZED_CART_SESSION_KEY = '_ADYEN_PAYMENT_IN_PROGRESS'; - /** @var SessionInterface */ + /** @var ?SessionInterface */ private $session; - public function __construct(SessionInterface $session) + public function __construct(RequestStack $session) { - $this->session = $session; + if (null == $session->getMainRequest()) { + return; + } + $this->session = $session->getSession(); } public function __invoke(OrderInterface $order): void { + if (null === $this->session) { + return; + } $tokenValue = $order->getTokenValue(); if (null === $tokenValue) { diff --git a/src/Controller/Shop/AdyenDetailsAction.php b/src/Controller/Shop/AdyenDetailsAction.php index 541e7cc7..3f140c2d 100644 --- a/src/Controller/Shop/AdyenDetailsAction.php +++ b/src/Controller/Shop/AdyenDetailsAction.php @@ -30,7 +30,6 @@ public function __construct( public function __invoke(Request $request, string $code): Response { - /** @var ?string $referenceId */ $referenceId = $request->query->get(self::REFERENCE_ID_KEY); if (null === $referenceId) { diff --git a/src/DependencyInjection/BitBagSyliusAdyenExtension.php b/src/DependencyInjection/BitBagSyliusAdyenExtension.php index 99845811..d32f8953 100644 --- a/src/DependencyInjection/BitBagSyliusAdyenExtension.php +++ b/src/DependencyInjection/BitBagSyliusAdyenExtension.php @@ -60,7 +60,7 @@ public function getConfiguration(array $config, ContainerBuilder $container): Co return new Configuration(); } - public function getAlias() + public function getAlias(): string { return 'bitbag_sylius_adyen'; } diff --git a/src/Processor/PaymentResponseProcessor/AbstractProcessor.php b/src/Processor/PaymentResponseProcessor/AbstractProcessor.php index 80c4ff96..d610621a 100644 --- a/src/Processor/PaymentResponseProcessor/AbstractProcessor.php +++ b/src/Processor/PaymentResponseProcessor/AbstractProcessor.php @@ -23,8 +23,7 @@ abstract class AbstractProcessor implements ProcessorInterface public const FLASH_ERROR = 'error'; - /** @var TranslatorInterface|null */ - protected $translator; + protected ?TranslatorInterface $translator; protected function isResultCodeSupportedForPayment(?PaymentInterface $payment, array $resultCodes): bool { @@ -52,11 +51,9 @@ protected function addFlash( if (null !== $this->translator) { $message = $this->translator->trans($message); } - - /** - * @var Session $session - */ + /** @var Session $session */ $session = $request->getSession(); + $session->getFlashBag()->add($type, $message); } } diff --git a/src/Processor/PaymentResponseProcessor/FallbackResponseProcessor.php b/src/Processor/PaymentResponseProcessor/FallbackResponseProcessor.php index ad5bbe48..272ec89f 100644 --- a/src/Processor/PaymentResponseProcessor/FallbackResponseProcessor.php +++ b/src/Processor/PaymentResponseProcessor/FallbackResponseProcessor.php @@ -13,6 +13,7 @@ use Sylius\Component\Core\Model\PaymentInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; final class FallbackResponseProcessor extends AbstractProcessor { @@ -21,9 +22,10 @@ final class FallbackResponseProcessor extends AbstractProcessor /** @var UrlGeneratorInterface */ private $urlGenerator; - public function __construct(UrlGeneratorInterface $urlGenerator) + public function __construct(UrlGeneratorInterface $urlGenerator, TranslatorInterface $translator) { $this->urlGenerator = $urlGenerator; + $this->translator = $translator; } public function accepts(Request $request, ?PaymentInterface $payment): bool diff --git a/src/Resolver/Notification/Serializer/NotificationItemNormalizer.php b/src/Resolver/Notification/Serializer/NotificationItemNormalizer.php index 40831e71..5920aa89 100644 --- a/src/Resolver/Notification/Serializer/NotificationItemNormalizer.php +++ b/src/Resolver/Notification/Serializer/NotificationItemNormalizer.php @@ -46,8 +46,8 @@ public function denormalize( } public function supportsDenormalization( - $data, - string $type, + mixed $data, + ?string $type, string $format = null ): bool { return @@ -90,14 +90,11 @@ public function normalize( return $result; } - /** - * @param mixed $data - */ public function supportsNormalization( - $data, - string $format = null, + mixed $data, + ?string $format = null, array $context = [] - ) { + ): bool { return $data instanceof NotificationItemData && !isset($context[$this->getNormalizationMarking($data)]) diff --git a/src/Resolver/Order/PaymentCheckoutOrderResolver.php b/src/Resolver/Order/PaymentCheckoutOrderResolver.php index 22f963e5..b06a9401 100644 --- a/src/Resolver/Order/PaymentCheckoutOrderResolver.php +++ b/src/Resolver/Order/PaymentCheckoutOrderResolver.php @@ -12,7 +12,7 @@ use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Order\Context\CartContextInterface; -use Sylius\Component\Resource\Repository\RepositoryInterface; +use Sylius\Component\Order\Repository\OrderRepositoryInterface; use Symfony\Component\HttpFoundation\Exception\BadRequestException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; @@ -26,13 +26,12 @@ final class PaymentCheckoutOrderResolver implements PaymentCheckoutOrderResolver /** @var CartContextInterface */ private $cartContext; - /** @var RepositoryInterface */ - private $orderRepository; + private OrderRepositoryInterface $orderRepository; public function __construct( RequestStack $requestStack, CartContextInterface $cartContext, - RepositoryInterface $orderRepository + OrderRepositoryInterface $orderRepository ) { $this->requestStack = $requestStack; $this->cartContext = $cartContext; @@ -65,10 +64,11 @@ private function getCurrentOrder(): ?OrderInterface if (null === $tokenValue) { return null; } - /** - * @psalm-suppress MixedReturnStatement - */ - return $this->orderRepository->findOneBy(['tokenValue' => $tokenValue]); + + /** @var OrderInterface $order */ + $order = $this->orderRepository->findOneBy(['tokenValue' => $tokenValue]); + + return $order; } public function resolve(): OrderInterface diff --git a/src/Resolver/Version/VersionResolver.php b/src/Resolver/Version/VersionResolver.php index 85f2e432..8e98f82e 100644 --- a/src/Resolver/Version/VersionResolver.php +++ b/src/Resolver/Version/VersionResolver.php @@ -11,7 +11,6 @@ namespace BitBag\SyliusAdyenPlugin\Resolver\Version; use PackageVersions\FallbackVersions; -use Sylius\Bundle\CoreBundle\Application\Kernel; final class VersionResolver implements VersionResolverInterface { @@ -44,6 +43,15 @@ private function getPluginVersion(): string private function resolveApplicationInfo(): array { + $syliusVersion = ''; + if (5 === constant('Symfony\Component\HttpKernel\Kernel::MAJOR_VERSION')) { + /** @var string $syliusVersion */ + $syliusVersion = constant('Sylius\Bundle\CoreBundle\Application\Kernel::VERSION'); + } elseif (defined('Sylius\Bundle\CoreBundle\SyliusCoreBundle::VERSION')) { + /** @var string $syliusVersion */ + $syliusVersion = constant('Sylius\Bundle\CoreBundle\SyliusCoreBundle::VERSION'); + } + return [ 'merchantApplication' => [ 'name' => 'adyen-sylius', @@ -51,7 +59,7 @@ private function resolveApplicationInfo(): array ], 'externalPlatform' => [ 'name' => 'Sylius', - 'version' => Kernel::VERSION, + 'version' => $syliusVersion, 'integrator' => 'BitBag', ], ]; diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 4b4cc32e..f9a8ea07 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -22,7 +22,7 @@ class="BitBag\SyliusAdyenPlugin\Callback\PreserveOrderTokenUponRedirectionCallback" id="bitbag.sylius_adyen_plugin.callback.preserve_order_token_upon_redirection_callback" > - + - + diff --git a/src/Resources/config/sylius/state_machine.yml b/src/Resources/config/sylius/state_machine.yml index e5cb5d1a..50b994a0 100644 --- a/src/Resources/config/sylius/state_machine.yml +++ b/src/Resources/config/sylius/state_machine.yml @@ -26,6 +26,7 @@ winzou_state_machine: from: [awaiting_payment, partially_paid, authorized, processing] sylius_refund_refund_payment: + class: Sylius\RefundPlugin\Entity\RefundPayment transitions: confirm: from: [new] diff --git a/src/Validator/Constraint/AdyenCredentialsValidator.php b/src/Validator/Constraint/AdyenCredentialsValidator.php index dcd1ad5d..679fc9bc 100644 --- a/src/Validator/Constraint/AdyenCredentialsValidator.php +++ b/src/Validator/Constraint/AdyenCredentialsValidator.php @@ -86,7 +86,7 @@ public function isApiKeyValid( return true; } - public function validate($value, Constraint $constraint): void + public function validate(mixed $value, Constraint $constraint): void { Assert::isInstanceOf($constraint, AdyenCredentials::class); Assert::isArray($value); diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index b5fbd778..10fe8258 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -1,5 +1,11 @@ getConfigurationDirectories() as $confDir) { $this->loadRoutesConfiguration($routes, $confDir); @@ -67,7 +73,7 @@ protected function configureRoutes(RouteCollectionBuilder $routes): void protected function getContainerBaseClass(): string { - if ($this->isTestEnvironment()) { + if ($this->isTestEnvironment() && class_exists(MockerContainer::class)) { return MockerContainer::class; } @@ -87,11 +93,11 @@ private function loadContainerConfiguration(LoaderInterface $loader, string $con $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); } - private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string $confDir): void + private function loadRoutesConfiguration(RoutingConfigurator $routes, string $confDir): void { - $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob'); + $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS); + $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS); + $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS); } /** diff --git a/tests/Application/assets/admin/entry.js b/tests/Application/assets/admin/entry.js new file mode 100644 index 00000000..635f5acc --- /dev/null +++ b/tests/Application/assets/admin/entry.js @@ -0,0 +1 @@ +import 'sylius/bundle/AdminBundle/Resources/private/entry'; diff --git a/tests/Application/assets/shop/entry.js b/tests/Application/assets/shop/entry.js new file mode 100644 index 00000000..aadc3174 --- /dev/null +++ b/tests/Application/assets/shop/entry.js @@ -0,0 +1 @@ +import 'sylius/bundle/ShopBundle/Resources/private/entry'; diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php index d7ac51d8..2291ab42 100644 --- a/tests/Application/config/bootstrap.php +++ b/tests/Application/config/bootstrap.php @@ -15,7 +15,7 @@ throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); } else { // load all the .env files - (new Dotenv(true))->loadEnv(dirname(__DIR__) . '/.env'); + (new Dotenv())->loadEnv(dirname(__DIR__) . '/.env'); } $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index 1a0a9051..6c62174e 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -1,12 +1,18 @@ ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], - Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true], @@ -45,7 +51,6 @@ Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true], Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true], Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true], - Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['all' => true], Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true], Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true], Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], diff --git a/tests/Application/config/packages/security_checker.yaml b/tests/Application/config/packages/security_checker.yaml deleted file mode 100644 index 0f9cf00f..00000000 --- a/tests/Application/config/packages/security_checker.yaml +++ /dev/null @@ -1,9 +0,0 @@ -services: - SensioLabs\Security\SecurityChecker: - public: false - - SensioLabs\Security\Command\SecurityCheckerCommand: - arguments: ['@SensioLabs\Security\SecurityChecker'] - public: false - tags: - - { name: console.command, command: 'security:check' } diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml index 76d7e5e1..daf04d4e 100644 --- a/tests/Application/config/packages/test/framework.yaml +++ b/tests/Application/config/packages/test/framework.yaml @@ -1,4 +1,4 @@ framework: test: ~ session: - storage_id: session.storage.mock_file + handler_id: ~ diff --git a/tests/Application/config/packages/test/security.yaml b/tests/Application/config/packages/test/security.yaml index 21cc3772..8ccd5429 100644 --- a/tests/Application/config/packages/test/security.yaml +++ b/tests/Application/config/packages/test/security.yaml @@ -1,3 +1,3 @@ security: - encoders: + password_hashers: sha512: sha512 diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml index 76d7e5e1..daf04d4e 100644 --- a/tests/Application/config/packages/test_cached/framework.yaml +++ b/tests/Application/config/packages/test_cached/framework.yaml @@ -1,4 +1,4 @@ framework: test: ~ session: - storage_id: session.storage.mock_file + handler_id: ~ diff --git a/tests/Application/config/packages/webpack_encore.yaml b/tests/Application/config/packages/webpack_encore.yaml new file mode 100644 index 00000000..9bee2488 --- /dev/null +++ b/tests/Application/config/packages/webpack_encore.yaml @@ -0,0 +1,5 @@ +webpack_encore: + output_path: '%kernel.project_dir%/public/build/default' + builds: + shop: '%kernel.project_dir%/public/build/shop' + admin: '%kernel.project_dir%/public/build/admin' diff --git a/tests/Application/config/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml index 92eeae0c..fae46cbf 100644 --- a/tests/Application/config/routes/sylius_shop.yaml +++ b/tests/Application/config/routes/sylius_shop.yaml @@ -11,4 +11,4 @@ sylius_shop_default_locale: path: / methods: [GET] defaults: - _controller: sylius.controller.shop.locale_switch:switchAction + _controller: sylius.controller.shop.locale_switch::switchAction diff --git a/tests/Application/config/sylius/1.10/packages/_sylius.yaml b/tests/Application/config/sylius/1.10/packages/_sylius.yaml deleted file mode 100644 index cd01aaf7..00000000 --- a/tests/Application/config/sylius/1.10/packages/_sylius.yaml +++ /dev/null @@ -1,2 +0,0 @@ -sylius_api: - enabled: true diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.11/bundles.php index 90001976..77baf155 100644 --- a/tests/Application/config/sylius/1.11/bundles.php +++ b/tests/Application/config/sylius/1.11/bundles.php @@ -1,7 +1,16 @@ ['all' => true], + Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], + Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/packages/dev/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml similarity index 100% rename from tests/Application/config/packages/dev/swiftmailer.yaml rename to tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/sylius/1.11/packages/security.yaml similarity index 100% rename from tests/Application/config/packages/security.yaml rename to tests/Application/config/sylius/1.11/packages/security.yaml diff --git a/tests/Application/config/packages/staging/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/staging/swiftmailer.yaml similarity index 100% rename from tests/Application/config/packages/staging/swiftmailer.yaml rename to tests/Application/config/sylius/1.11/packages/staging/swiftmailer.yaml diff --git a/tests/Application/config/packages/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml similarity index 100% rename from tests/Application/config/packages/swiftmailer.yaml rename to tests/Application/config/sylius/1.11/packages/swiftmailer.yaml diff --git a/tests/Application/config/packages/test/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml similarity index 100% rename from tests/Application/config/packages/test/swiftmailer.yaml rename to tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml diff --git a/tests/Application/config/packages/test_cached/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml similarity index 100% rename from tests/Application/config/packages/test_cached/swiftmailer.yaml rename to tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml diff --git a/tests/Application/config/sylius/1.12/bundles.php b/tests/Application/config/sylius/1.12/bundles.php new file mode 100644 index 00000000..de39bb01 --- /dev/null +++ b/tests/Application/config/sylius/1.12/bundles.php @@ -0,0 +1,16 @@ + ['all' => true], + Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], + Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], +]; diff --git a/tests/Application/config/sylius/1.12/packages/mailer.yaml b/tests/Application/config/sylius/1.12/packages/mailer.yaml new file mode 100644 index 00000000..225ed598 --- /dev/null +++ b/tests/Application/config/sylius/1.12/packages/mailer.yaml @@ -0,0 +1,4 @@ +framework: + mailer: + dsn: '%env(MAILER_DSN)%' + diff --git a/tests/Application/config/sylius/1.12/packages/security.yaml b/tests/Application/config/sylius/1.12/packages/security.yaml new file mode 100644 index 00000000..71d89cd9 --- /dev/null +++ b/tests/Application/config/sylius/1.12/packages/security.yaml @@ -0,0 +1,122 @@ +security: + enable_authenticator_manager: true + providers: + sylius_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_api_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + sylius_api_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + + password_hashers: + Sylius\Component\User\Model\UserInterface: argon2i + firewalls: + admin: + switch_user: true + context: admin + pattern: "%sylius.security.admin_regex%" + provider: sylius_admin_user_provider + form_login: + provider: sylius_admin_user_provider + login_path: sylius_admin_login + check_path: sylius_admin_login_check + failure_path: sylius_admin_login + default_target_path: sylius_admin_dashboard + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_admin_security_token + csrf_token_id: admin_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + path: "/%sylius_admin.path_name%" + name: APP_ADMIN_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_admin_logout + target: sylius_admin_login + + new_api_admin_user: + pattern: "%sylius.security.new_api_admin_regex%/.*" + provider: sylius_api_admin_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_admin_route%/authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + new_api_shop_user: + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_shop_route%/authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + shop: + switch_user: { role: ROLE_ALLOWED_TO_SWITCH } + context: shop + pattern: "%sylius.security.shop_regex%" + provider: sylius_shop_user_provider + form_login: + success_handler: sylius.authentication.success_handler + failure_handler: sylius.authentication.failure_handler + provider: sylius_shop_user_provider + login_path: sylius_shop_login + check_path: sylius_shop_login_check + failure_path: sylius_shop_login + default_target_path: sylius_shop_homepage + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_shop_security_token + csrf_token_id: shop_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + name: APP_SHOP_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_shop_logout + target: sylius_shop_homepage + invalidate_session: false + + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + access_control: + - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } + - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } + + - { path: "%sylius.security.admin_regex%/forgotten-password", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } + - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } + + - { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.12/packages/test/mailer.yaml b/tests/Application/config/sylius/1.12/packages/test/mailer.yaml new file mode 100644 index 00000000..56cc28f9 --- /dev/null +++ b/tests/Application/config/sylius/1.12/packages/test/mailer.yaml @@ -0,0 +1,7 @@ +framework: + mailer: + dsn: 'null://null' + cache: + pools: + test.mailer_pool: + adapter: cache.adapter.filesystem diff --git a/tests/Application/package.json b/tests/Application/package.json index ad211b25..9bf5590f 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -1,7 +1,7 @@ { "dependencies": { "babel-polyfill": "^6.26.0", - "chart.js": "^2.9.3", + "chart.js": "^3.7.1", "global": "^4.4.0", "jquery": "^3.4.0", "jquery.dirtyforms": "^2.0.0", @@ -46,7 +46,7 @@ "yargs": "^6.4.0" }, "scripts": { - "build": "gulp build", + "build": "yarn encore prod", "gulp": "gulp build", "lint": "yarn lint:js", "lint:js": "eslint gulpfile.babel.js" diff --git a/tests/Application/public/media/image/.gitignore b/tests/Application/public/media/image/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js index ba0308f7..91d756a2 100644 --- a/tests/Application/webpack.config.js +++ b/tests/Application/webpack.config.js @@ -1,20 +1,20 @@ const path = require('path'); const Encore = require('@symfony/webpack-encore'); -const syliusBundles = path.resolve(__dirname, 'vendor/sylius/sylius/src/Sylius/Bundle/'); +const syliusBundles = path.resolve(__dirname, '../../vendor/sylius/sylius/src/Sylius/Bundle/'); const uiBundleScripts = path.resolve(syliusBundles, 'UiBundle/Resources/private/js/'); const uiBundleResources = path.resolve(syliusBundles, 'UiBundle/Resources/private/'); // Shop config Encore - .setOutputPath('public/build/shop/') - .setPublicPath('/build/shop') - .addEntry('shop-entry', './assets/shop/entry.js') - .disableSingleRuntimeChunk() - .cleanupOutputBeforeBuild() - .enableSourceMaps(!Encore.isProduction()) - .enableVersioning(Encore.isProduction()) - .enableSassLoader(); + .setOutputPath('public/build/shop/') + .setPublicPath('/build/shop') + .addEntry('shop-entry', './assets/shop/entry.js') + .disableSingleRuntimeChunk() + .cleanupOutputBeforeBuild() + .enableSourceMaps(!Encore.isProduction()) + .enableVersioning(Encore.isProduction()) + .enableSassLoader(); const shopConfig = Encore.getWebpackConfig(); @@ -27,21 +27,23 @@ Encore.reset(); // Admin config Encore - .setOutputPath('public/build/admin/') - .setPublicPath('/build/admin') - .addEntry('admin-entry', './assets/admin/entry.js') - .disableSingleRuntimeChunk() - .cleanupOutputBeforeBuild() - .enableSourceMaps(!Encore.isProduction()) - .enableVersioning(Encore.isProduction()) - .enableSassLoader(); + .setOutputPath('public/build/admin/') + .setPublicPath('/build/admin') + .addEntry('admin-entry', './assets/admin/entry.js') + .disableSingleRuntimeChunk() + .cleanupOutputBeforeBuild() + .enableSourceMaps(!Encore.isProduction()) + .enableVersioning(Encore.isProduction()) + .enableSassLoader(); const adminConfig = Encore.getWebpackConfig(); adminConfig.resolve.alias['sylius/ui'] = uiBundleScripts; adminConfig.resolve.alias['sylius/ui-resources'] = uiBundleResources; adminConfig.resolve.alias['sylius/bundle'] = syliusBundles; -adminConfig.externals = Object.assign({}, adminConfig.externals, { window: 'window', document: 'document' }); +adminConfig.resolve.alias['chart.js/dist/Chart.min'] = path.resolve(__dirname, 'node_modules/chart.js/dist/chart.min.js'); +adminConfig.externals = Object.assign({}, adminConfig.externals, {window: 'window', document: 'document'}); + adminConfig.name = 'admin'; module.exports = [shopConfig, adminConfig]; diff --git a/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodAdyenContext.php b/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodAdyenContext.php index c1a76080..7dea65d7 100644 --- a/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodAdyenContext.php +++ b/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodAdyenContext.php @@ -68,7 +68,11 @@ public function adyenServiceWillConfirmMerchantAccountAndApiKeyAreValid(string $ $this->kernel ->getContainer() ->get('tests.bitbag.sylius_adyen_plugin.behat.context.api_mock_client') - ->setJsonHandler(function (Service $service, string $url, array $payload) use ($merchantAccount, $apiKey) { + ->setJsonHandler(function ( + Service $service, + string $url, + array $payload + ) use ($merchantAccount, $apiKey) { $config = $service->getClient()->getConfig(); if ($config->getXApiKey() !== $apiKey) { diff --git a/tests/HttpClientStub.php b/tests/HttpClientStub.php index 9a28cd29..3e62e995 100644 --- a/tests/HttpClientStub.php +++ b/tests/HttpClientStub.php @@ -1,4 +1,5 @@ requestJson($service, $requestUrl, $params); } - public function requestPost(Service $service, $requestUrl, $params) - { - if (self::$postHandler !== null) { + public function requestPost( + Service $service, + $requestUrl, + $params + ) { + if (null !== self::$postHandler) { return call_user_func(static::$postHandler, $service, $requestUrl, $params); } diff --git a/tests/Unit/Bus/Handler/AlterPaymentHandlerTest.php b/tests/Unit/Bus/Handler/AlterPaymentHandlerTest.php index 8820ef01..aae81080 100644 --- a/tests/Unit/Bus/Handler/AlterPaymentHandlerTest.php +++ b/tests/Unit/Bus/Handler/AlterPaymentHandlerTest.php @@ -83,11 +83,11 @@ public function testForNonApplicablePayment(?PaymentInterface $payment = null, ? ; $order = new Order(); - if ($orderPaymentState !== null) { + if (null !== $orderPaymentState) { $order->setPaymentState($orderPaymentState); } - if ($payment !== null) { + if (null !== $payment) { $order->addPayment($payment); } diff --git a/tests/Unit/Bus/Handler/PaymentFinalizationHandlerTest.php b/tests/Unit/Bus/Handler/PaymentFinalizationHandlerTest.php index c8caf32d..5951bb62 100644 --- a/tests/Unit/Bus/Handler/PaymentFinalizationHandlerTest.php +++ b/tests/Unit/Bus/Handler/PaymentFinalizationHandlerTest.php @@ -19,7 +19,6 @@ use Sylius\Component\Core\Model\Order; use Sylius\Component\Core\Model\Payment; use Sylius\Component\Core\OrderPaymentStates; -use Symfony\Component\Messenger\MessageBusInterface; class PaymentFinalizationHandlerTest extends TestCase { diff --git a/tests/Unit/Bus/Handler/RefundPaymentGeneratedHandlerTest.php b/tests/Unit/Bus/Handler/RefundPaymentGeneratedHandlerTest.php index a03a8fc9..c800508b 100644 --- a/tests/Unit/Bus/Handler/RefundPaymentGeneratedHandlerTest.php +++ b/tests/Unit/Bus/Handler/RefundPaymentGeneratedHandlerTest.php @@ -101,7 +101,7 @@ public function testUnacceptable(?PaymentInterface $payment = null): void ->method('find') ->willReturn($payment); - if ($payment !== null) { + if (null !== $payment) { $this->paymentMethodRepository ->method('find') ->willReturn($payment->getMethod()) @@ -183,7 +183,7 @@ public function testAffirmative(): void ->expects($this->once()) ->method('dispatch') ->with($this->callback(static function (CreateReferenceForRefund $command) { - return $command->getRefundReference() === self::NEW_PSP_REFERENCE; + return self::NEW_PSP_REFERENCE === $command->getRefundReference(); })); ($this->handler)($command); diff --git a/tests/Unit/Client/PaymentMethodsFilterTest.php b/tests/Unit/Client/PaymentMethodsFilterTest.php index a23b90d5..fe237b01 100644 --- a/tests/Unit/Client/PaymentMethodsFilterTest.php +++ b/tests/Unit/Client/PaymentMethodsFilterTest.php @@ -53,8 +53,11 @@ public static function provideForTestFilter(): array /** * @dataProvider provideForTestFilter */ - public function testFilter(array $paymentMethodsResponseList, ?array $supportedMethodsList, array $expected): void - { + public function testFilter( + array $paymentMethodsResponseList, + ?array $supportedMethodsList, + array $expected + ): void { $response = [ 'paymentMethods' => $paymentMethodsResponseList, ]; diff --git a/tests/Unit/Normalizer/AdditionalDetailsNormalizerTest.php b/tests/Unit/Normalizer/AdditionalDetailsNormalizerTest.php index 57fa41ad..f49c33ff 100644 --- a/tests/Unit/Normalizer/AdditionalDetailsNormalizerTest.php +++ b/tests/Unit/Normalizer/AdditionalDetailsNormalizerTest.php @@ -58,8 +58,11 @@ public static function provideForSupportsNormalization(): array /** * @dataProvider provideForSupportsNormalization */ - public function testSupportsNormalization(array $context, ?OrderInterface $order, bool $pass): void - { + public function testSupportsNormalization( + array $context, + ?OrderInterface $order, + bool $pass + ): void { $this->assertEquals($pass, $this->normalizer->supportsNormalization($order, null, $context)); } diff --git a/tests/Unit/Normalizer/AddressNormalizerTest.php b/tests/Unit/Normalizer/AddressNormalizerTest.php index 6303fc51..93dc8ceb 100644 --- a/tests/Unit/Normalizer/AddressNormalizerTest.php +++ b/tests/Unit/Normalizer/AddressNormalizerTest.php @@ -56,8 +56,11 @@ public static function provideForSupportsNormalization(): array /** * @dataProvider provideForSupportsNormalization */ - public function testSupportsNormalization(array $context, ?AddressInterface $order, bool $pass): void - { + public function testSupportsNormalization( + array $context, + ?AddressInterface $order, + bool $pass + ): void { $this->assertEquals($pass, $this->normalizer->supportsNormalization($order, null, $context)); } diff --git a/tests/Unit/Normalizer/OrderItemToLineItemNormalizerTest.php b/tests/Unit/Normalizer/OrderItemToLineItemNormalizerTest.php index 4fad1ab0..407864a1 100644 --- a/tests/Unit/Normalizer/OrderItemToLineItemNormalizerTest.php +++ b/tests/Unit/Normalizer/OrderItemToLineItemNormalizerTest.php @@ -60,8 +60,11 @@ public static function provideForSupportsNormalization(): array /** * @dataProvider provideForSupportsNormalization */ - public function testSupportsNormalization(array $context, ?OrderItemInterface $order, bool $pass): void - { + public function testSupportsNormalization( + array $context, + ?OrderItemInterface $order, + bool $pass + ): void { $this->assertEquals($pass, $this->normalizer->supportsNormalization($order, null, $context)); } diff --git a/tests/Unit/Processor/PaymentResponseProcessor/AbstractProcessorTest.php b/tests/Unit/Processor/PaymentResponseProcessor/AbstractProcessorTest.php index 41d04d08..cb4e2ddb 100644 --- a/tests/Unit/Processor/PaymentResponseProcessor/AbstractProcessorTest.php +++ b/tests/Unit/Processor/PaymentResponseProcessor/AbstractProcessorTest.php @@ -70,7 +70,7 @@ protected function createRequestWithSession(): Request protected function getPayment(?string $resultCode = null, ?string $orderToken = null): PaymentInterface { $details = []; - if ($resultCode !== null) { + if (null !== $resultCode) { $details['resultCode'] = $resultCode; } @@ -80,7 +80,7 @@ protected function getPayment(?string $resultCode = null, ?string $orderToken = ->willReturn($details) ; - if ($orderToken !== null) { + if (null !== $orderToken) { $order = $this->createMock(OrderInterface::class); $order ->method('getTokenValue') diff --git a/tests/Unit/Processor/PaymentResponseProcessor/FailedResponseProcessorTest.php b/tests/Unit/Processor/PaymentResponseProcessor/FailedResponseProcessorTest.php index 79e6c4d4..100d27ab 100644 --- a/tests/Unit/Processor/PaymentResponseProcessor/FailedResponseProcessorTest.php +++ b/tests/Unit/Processor/PaymentResponseProcessor/FailedResponseProcessorTest.php @@ -27,8 +27,8 @@ protected function setUp(): void $this->dispatcher = $this->createMock(DispatcherInterface::class); $this->processor = new FailedResponseProcessor( - self::getRouter(self::$container), - self::$container->get('translator'), + self::getRouter($this->getContainer()), + $this->getContainer()->get('translator'), $this->dispatcher ); } diff --git a/tests/Unit/Processor/PaymentResponseProcessor/SuccessfulResponseProcessorTest.php b/tests/Unit/Processor/PaymentResponseProcessor/SuccessfulResponseProcessorTest.php index 5ec8f84e..38a57969 100644 --- a/tests/Unit/Processor/PaymentResponseProcessor/SuccessfulResponseProcessorTest.php +++ b/tests/Unit/Processor/PaymentResponseProcessor/SuccessfulResponseProcessorTest.php @@ -22,9 +22,9 @@ protected function setUp(): void parent::setUp(); $this->processor = new SuccessfulResponseProcessor( - self::$container->get('tests.bitbag.sylius_adyen_plugin.bus.dispatcher'), - self::getRouter(self::$container), - self::$container->get('translator') + $this->getContainer()->get('tests.bitbag.sylius_adyen_plugin.bus.dispatcher'), + self::getRouter($this->getContainer()), + $this->getContainer()->get('translator') ); } @@ -54,8 +54,11 @@ public static function provideForTestRedirect(): array /** * @dataProvider provideForTestRedirect */ - public function testRedirect(Request $request, string $expectedUrlEnding, bool $expectFlash = false) - { + public function testRedirect( + Request $request, + string $expectedUrlEnding, + bool $expectFlash = false + ) { $payment = $this->createMock(PaymentInterface::class); $result = $this->processor->process('Szczebrzeszyn', $request, $payment); @@ -72,7 +75,7 @@ public function testRedirect(Request $request, string $expectedUrlEnding, bool $ private function assertIsPaymentScheduledForFinalization(): void { - $messenger = self::$container->get('tests.bitbag.sylius_adyen_plugin.message_bus'); + $messenger = $this->getContainer()->get('tests.bitbag.sylius_adyen_plugin.message_bus'); $commands = $messenger->getDispatchedMessages(); $this->assertNotEmpty($commands); diff --git a/tests/Unit/Processor/PaymentResponseProcessorTest.php b/tests/Unit/Processor/PaymentResponseProcessorTest.php index 6caf47f7..c1bd9b7f 100644 --- a/tests/Unit/Processor/PaymentResponseProcessorTest.php +++ b/tests/Unit/Processor/PaymentResponseProcessorTest.php @@ -31,7 +31,7 @@ private function getPaymentResponseProcessor(array $processors = []): PaymentRes { return new PaymentResponseProcessor( $processors, - AbstractProcessorTest::getRouter(self::$container) + AbstractProcessorTest::getRouter($this->getContainer()) ); } @@ -45,7 +45,7 @@ private function getProcessor(bool $accepts, ?string $response = null): Processo ; } - if ($response !== null) { + if (null !== $response) { $result ->method('process') ->willReturn($response) diff --git a/tests/Unit/Resolver/Address/StreetAddressResolverTest.php b/tests/Unit/Resolver/Address/StreetAddressResolverTest.php index 6c398dd0..f696c2e7 100644 --- a/tests/Unit/Resolver/Address/StreetAddressResolverTest.php +++ b/tests/Unit/Resolver/Address/StreetAddressResolverTest.php @@ -1,4 +1,13 @@ -streetAddressResolver->resolve($streetAddress); self::assertEquals($street, $model->getStreet()); @@ -30,8 +42,11 @@ public function testResolveHouseNumberFirst(string $streetAddress, string $stree } /** @dataProvider provideHouseNumberLast */ - public function testResolveHouseNumberLast(string $streetAddress, string $street, string $houseNumber): void - { + public function testResolveHouseNumberLast( + string $streetAddress, + string $street, + string $houseNumber + ): void { $model = $this->streetAddressResolver->resolve($streetAddress); self::assertEquals($street, $model->getStreet()); @@ -73,7 +88,7 @@ public function provideHouseNumberFirst(): array ['1 Montfortanenlaan', 'Montfortanenlaan', '1'], ['2D Gasthuislaan', 'Gasthuislaan', '2D'], ['98 W Molstraat', 'Molstraat', '98 W'], - ['76B/2 ul. Akacjowa', 'ul. Akacjowa', '76B/2'] + ['76B/2 ul. Akacjowa', 'ul. Akacjowa', '76B/2'], ]; } }