diff --git a/.gitattributes b/.gitattributes index 53f8a7c0..06f3513c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,18 +1,16 @@ -/.github export-ignore -/etc export-ignore -/docs export-ignore -/.editorconfig export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore -/README.md export-ignore -/behat.yml.dist export-ignore -/composer-require-checker.json export-ignore -/docs export-ignore -/ecs.php export-ignore -/node_modules export-ignore -/phpunit.xml.dist export-ignore -/psalm-baseline.xml export-ignore -/psalm.xml export-ignore -/tests export-ignore -/CHANGELOG.md export-ignore -/UPGRADE.md export-ignore +/.github export-ignore +/docs export-ignore +/tests export-ignore +/node_modules export-ignore +/.editorconfig export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/CHANGELOG.md export-ignore +/CLAUDE.md export-ignore +/README.md export-ignore +/UPGRADE.md export-ignore +/composer-dependency-analyser.php export-ignore +/ecs.php export-ignore +/phpstan.neon export-ignore +/phpunit.xml.dist export-ignore +/rector.php export-ignore diff --git a/.github/workflows/backwards-compatibility-check.yaml b/.github/workflows/backwards-compatibility-check.yaml deleted file mode 100644 index 806dd6a9..00000000 --- a/.github/workflows/backwards-compatibility-check.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# See https://github.com/Roave/BackwardCompatibilityCheck - -name: "Backwards Compatibility Check" - -on: - pull_request: ~ - -jobs: - backwards-compatibility-check: - name: "Backwards Compatibility Check" - - runs-on: "ubuntu-latest" - - steps: - - name: "Checkout" - uses: "actions/checkout@v4" - with: - fetch-depth: 0 - - - name: "Setup PHP, with composer and extensions" - uses: "shivammathur/setup-php@v2" - with: - php-version: "8.1" - coverage: "none" - - - name: "Install tool" - run: "composer global require roave/backward-compatibility-check" - - - name: "Check for BC breaks" - run: "~/.composer/vendor/bin/roave-backward-compatibility-check --from=origin/${{ github.event.pull_request.base.ref }} --format=github-actions" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 13668636..42ec099d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,344 +1,74 @@ name: "build" + on: - push: - branches: - - "1.x" - paths-ignore: - - "**/*.md" - pull_request: - paths-ignore: - - "**/*.md" + push: ~ + pull_request: ~ workflow_dispatch: ~ -env: - APP_ENV: "test" - DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=8.0" - PHP_EXTENSIONS: "intl, mbstring" - jobs: coding-standards: - name: "Coding Standards (PHP${{ matrix.php-version }} | Deps: ${{ matrix.dependencies }})" - runs-on: "ubuntu-latest" - - strategy: - matrix: - php-version: - - "8.1" # Always use the lowest version of PHP since a higher version could create actual syntax errors in lower versions - - dependencies: - - "highest" - steps: - - name: "Checkout" - uses: "actions/checkout@v4" - - - name: "Setup PHP, with composer and extensions" - uses: "shivammathur/setup-php@v2" - with: - php-version: "${{ matrix.php-version }}" - extensions: "${{ env.PHP_EXTENSIONS }}" - coverage: "none" - - - name: "Install composer dependencies" - uses: "ramsey/composer-install@v3" - with: - dependency-versions: "${{ matrix.dependencies }}" - - - name: "Validate composer" - run: "composer validate --strict" - - - name: "Check composer normalized" - run: "composer normalize --dry-run" - - - name: "Check style" - run: "composer check-style" - - - name: "Rector" - run: "vendor/bin/rector process --dry-run" - continue-on-error: true - - - name: "Lint yaml files" - run: "(cd tests/Application && bin/console lint:yaml ../../src/Resources)" - - - name: "Lint twig files" - run: "(cd tests/Application && bin/console lint:twig ../../src/Resources)" + - uses: "setono/sylius-plugin/coding-standards@v2" dependency-analysis: - name: "Dependency Analysis (PHP${{ matrix.php-version }} | Deps: ${{ matrix.dependencies }} | SF${{ matrix.symfony }})" - runs-on: "ubuntu-latest" - strategy: + fail-fast: false matrix: - php-version: - - "8.1" - - "8.2" - - dependencies: - - "highest" - - symfony: - - "~5.4.0" - - "~6.4.0" - + php-version: ["8.2", "8.3", "8.4"] + dependencies: ["lowest", "highest"] + symfony: ["~6.4.0", "~7.4.0"] steps: - - name: "Checkout" - uses: "actions/checkout@v4" - - - name: "Setup PHP, with composer and extensions" - uses: "shivammathur/setup-php@v2" + - uses: "setono/sylius-plugin/dependency-analysis@v2" with: - coverage: "none" - extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" - tools: "composer-require-checker, composer-unused, flex" - - - name: "Remove require-dev section in composer.json" - run: "composer config --unset require-dev" - - - name: "Install composer dependencies" - uses: "ramsey/composer-install@v3" - env: - SYMFONY_REQUIRE: "${{ matrix.symfony }}" - with: - dependency-versions: "${{ matrix.dependencies }}" - - - name: "Run maglnet/composer-require-checker" - run: "composer-require-checker check" + dependencies: "${{ matrix.dependencies }}" + symfony: "${{ matrix.symfony }}" - - name: "Run composer-unused/composer-unused" - run: "composer-unused" - static-code-analysis: - name: "Static Code Analysis (PHP${{ matrix.php-version }} | Deps: ${{ matrix.dependencies }} | SF${{ matrix.symfony }})" - runs-on: "ubuntu-latest" - strategy: + fail-fast: false matrix: - php-version: - - "8.1" - - "8.2" - - dependencies: - - "lowest" - - "highest" - - symfony: - - "~5.4.0" - - "~6.4.0" - + php-version: ["8.2", "8.3", "8.4"] + dependencies: ["lowest", "highest"] + symfony: ["~6.4.0", "~7.4.0"] steps: - - name: "Checkout" - uses: "actions/checkout@v4" - - - name: "Setup PHP, with composer and extensions" - uses: "shivammathur/setup-php@v2" + - uses: "setono/sylius-plugin/static-code-analysis@v2" with: - coverage: "none" - extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" - tools: "flex" - - - name: "Remove sylius/sylius from composer.json" - run: "composer remove --dev --no-update --no-plugins --no-scripts sylius/sylius" - - - name: "Install composer dependencies" - uses: "ramsey/composer-install@v3" - env: - SYMFONY_REQUIRE: "${{ matrix.symfony }}" - with: - dependency-versions: "${{ matrix.dependencies }}" - - - name: "Static analysis" - run: "vendor/bin/psalm --php-version=${{ matrix.php-version }}" + dependencies: "${{ matrix.dependencies }}" + symfony: "${{ matrix.symfony }}" unit-tests: - name: "Unit tests (PHP${{ matrix.php-version }} | Deps: ${{ matrix.dependencies }} | SF${{ matrix.symfony }})" - runs-on: "ubuntu-latest" - strategy: + fail-fast: false matrix: - php-version: - - "8.1" - - "8.2" - - dependencies: - - "highest" - - symfony: - - "~5.4.0" - - "~6.4.0" - + php-version: ["8.2", "8.3", "8.4"] + dependencies: ["lowest", "highest"] + symfony: ["~6.4.0", "~7.4.0"] steps: - - name: "Checkout" - uses: "actions/checkout@v4" - - - name: "Setup PHP, with composer and extensions" - uses: "shivammathur/setup-php@v2" + - uses: "setono/sylius-plugin/unit-tests@v2" with: - coverage: "none" - extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" - tools: "flex" - - - name: "Install composer dependencies" - uses: "ramsey/composer-install@v3" - env: - SYMFONY_REQUIRE: "${{ matrix.symfony }}" - with: - dependency-versions: "${{ matrix.dependencies }}" - - - name: "Run phpunit" - run: "composer phpunit" - - - name: "Run phpspec" - run: "composer phpspec" - - integration-tests: - name: "Integration tests (PHP${{ matrix.php-version }} | Deps: ${{ matrix.dependencies }} | SF${{ matrix.symfony }})" + dependencies: "${{ matrix.dependencies }}" + symfony: "${{ matrix.symfony }}" + testsuite: "unit" + functional-tests: runs-on: "ubuntu-latest" - strategy: + fail-fast: false matrix: - php-version: - - "8.1" - - "8.2" - - dependencies: - - "highest" - - symfony: - - "~5.4.0" - - "~6.4.0" - + php-version: ["8.2", "8.3", "8.4"] + dependencies: ["highest"] + symfony: ["~6.4.0", "~7.4.0"] steps: - - name: "Start MySQL" - run: "sudo /etc/init.d/mysql start" - - - name: "Checkout" - uses: "actions/checkout@v4" - - - name: "Setup PHP, with composer and extensions" - uses: "shivammathur/setup-php@v2" + - uses: "setono/sylius-plugin/functional-tests@v2" with: - coverage: "none" - extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" - tools: "flex,symfony" - - - name: "Install composer dependencies" - uses: "ramsey/composer-install@v3" - env: - SYMFONY_REQUIRE: "${{ matrix.symfony }}" - with: - dependency-versions: "${{ matrix.dependencies }}" - - - name: "Lint container" - run: "(cd tests/Application && bin/console lint:container)" - - - name: "Create database" - run: "(cd tests/Application && bin/console doctrine:database:create)" - - - name: "Create database schema" - run: "(cd tests/Application && bin/console doctrine:schema:create)" - - - name: "Validate Doctrine mapping" - run: "(cd tests/Application && bin/console doctrine:schema:validate -vvv)" # The verbose flag will show 'missing' SQL statements, if any - - - name: "Get Yarn cache directory" - id: "yarn-cache" - run: "echo \"::set-output name=dir::$(yarn cache dir)\"" - - - name: "Cache Yarn" - uses: "actions/cache@v2" - with: - path: "${{ steps.yarn-cache.outputs.dir }}" - key: "yarn-${{ hashFiles('**/package.json **/yarn.lock') }}" - restore-keys: "yarn-" - - - name: "Install JS dependencies" - run: "(cd tests/Application && yarn install)" - - - name: "Install assets" - run: "(cd tests/Application && bin/console assets:install public -vvv)" - - - name: "Build assets" - run: "(cd tests/Application && yarn build)" - - - name: "Output PHP version for Symfony CLI" - run: "php -v | head -n 1 | awk '{ print $2 }' > .php-version" - - - name: "Install certificates" - run: "symfony server:ca:install" - - - name: "Run Chrome Headless" - run: "google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 &" - - - name: "Wait for Chrome to start" - run: | - until curl -s http://127.0.0.1:9222/json/version | grep "Browser" > /dev/null 2>&1 - do - sleep 1 - done - - - name: "Run webserver" - run: "(cd tests/Application && symfony server:start --port=8080 --dir=public --daemon)" - - - name: "Wait for webserver to start" - run: | - until symfony server:list | grep /public > /dev/null 2>&1 - do - sleep 1 - done - - - name: "Run behat" - run: "vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun" - - - name: "Upload Behat logs" - uses: "actions/upload-artifact@v4" - if: "failure()" - with: - name: "Behat logs" - path: "etc/build/" - if-no-files-found: "ignore" - - code-coverage: - name: "Code Coverage (PHP${{ matrix.php-version }} | Deps: ${{ matrix.dependencies }})" - - runs-on: "ubuntu-latest" - - strategy: - matrix: - php-version: - - "8.2" - - dependencies: - - "highest" - - steps: - - name: "Checkout" - uses: "actions/checkout@v4" - - - name: "Setup PHP, with composer and extensions" - uses: "shivammathur/setup-php@v2" - with: - coverage: "pcov" - extensions: "${{ env.PHP_EXTENSIONS }}" - php-version: "${{ matrix.php-version }}" - - - name: "Install composer dependencies" - uses: "ramsey/composer-install@v3" - with: - dependency-versions: "${{ matrix.dependencies }}" - - - name: "Collect code coverage with pcov and phpunit/phpunit" - run: "vendor/bin/phpunit --coverage-clover=.build/logs/clover.xml" - - - name: "Send code coverage report to Codecov.io" - uses: "codecov/codecov-action@v4" - with: - token: "${{ secrets.CODECOV_TOKEN }}" + dependencies: "${{ matrix.dependencies }}" + symfony: "${{ matrix.symfony }}" + testsuite: "functional" diff --git a/.gitignore b/.gitignore index 2efe830e..757fe535 100644 --- a/.gitignore +++ b/.gitignore @@ -3,15 +3,15 @@ /node_modules/ /composer.lock -/etc/build/* -!/etc/build/.gitignore - /tests/Application/yarn.lock -/behat.yml -/phpspec.yml /.phpunit.result.cache +/.phpunit.cache/ # Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project /.php-version /php.ini + +# Claude Code local config +/.claude/ +/.mcp.json diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..7b6b9ed2 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,93 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## What this is + +A Sylius plugin (`setono/sylius-pickup-point-plugin`, type `sylius-plugin`) that adds a pickup-point chooser to the shipping checkout step: once the page has rendered, a small framework-free script loads the points asynchronously and renders them as radio buttons (no `` that contains pickup points to your select shipping checkout step. +Add a pickup-point chooser to your shipping checkout step. - [Screenshots](#screenshots) - [Installation](#installation) @@ -15,20 +15,27 @@ Add a ` - - -
- - - -
- - -
- -{% endblock %} diff --git a/src/Resources/views/Shop/Label/Shipment/pickupPoint.html.twig b/src/Resources/views/Shop/Label/Shipment/pickupPoint.html.twig deleted file mode 100644 index b7a45f8f..00000000 --- a/src/Resources/views/Shop/Label/Shipment/pickupPoint.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{% set pickupPointId = shipment.pickupPointId %} - -{% if pickupPointId %} - -{% endif %} diff --git a/src/Resources/views/_javascripts.html.twig b/src/Resources/views/_javascripts.html.twig deleted file mode 100644 index 9514d506..00000000 --- a/src/Resources/views/_javascripts.html.twig +++ /dev/null @@ -1,6 +0,0 @@ - - diff --git a/src/SetonoSyliusPickupPointPlugin.php b/src/SetonoSyliusPickupPointPlugin.php index 1844b60a..a348d8f0 100644 --- a/src/SetonoSyliusPickupPointPlugin.php +++ b/src/SetonoSyliusPickupPointPlugin.php @@ -6,11 +6,10 @@ use Setono\SyliusPickupPointPlugin\DependencyInjection\Compiler\RegisterProvidersPass; use Sylius\Bundle\CoreBundle\Application\SyliusPluginTrait; -use Sylius\Bundle\ResourceBundle\AbstractResourceBundle; -use Sylius\Bundle\ResourceBundle\SyliusResourceBundle; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\Bundle\Bundle; -final class SetonoSyliusPickupPointPlugin extends AbstractResourceBundle +final class SetonoSyliusPickupPointPlugin extends Bundle { use SyliusPluginTrait; @@ -21,10 +20,8 @@ public function build(ContainerBuilder $container): void $container->addCompilerPass(new RegisterProvidersPass()); } - public function getSupportedDrivers(): array + public function getPath(): string { - return [ - SyliusResourceBundle::DRIVER_DOCTRINE_ORM, - ]; + return \dirname(__DIR__); } } diff --git a/src/Shipping/OrderShippingMethodSelectionRequirementChecker.php b/src/Shipping/OrderShippingMethodSelectionRequirementChecker.php index e58d3dd5..ef3e9982 100644 --- a/src/Shipping/OrderShippingMethodSelectionRequirementChecker.php +++ b/src/Shipping/OrderShippingMethodSelectionRequirementChecker.php @@ -10,29 +10,24 @@ use Sylius\Component\Core\Model\ShipmentInterface; use Sylius\Component\Shipping\Resolver\ShippingMethodsResolverInterface; -final class OrderShippingMethodSelectionRequirementChecker implements OrderShippingMethodSelectionRequirementCheckerInterface +final readonly class OrderShippingMethodSelectionRequirementChecker implements OrderShippingMethodSelectionRequirementCheckerInterface { - private OrderShippingMethodSelectionRequirementCheckerInterface $decorated; - - private ShippingMethodsResolverInterface $shippingMethodsResolver; - - public function __construct(OrderShippingMethodSelectionRequirementCheckerInterface $decorated, ShippingMethodsResolverInterface $shippingMethodsResolver) - { - $this->decorated = $decorated; - $this->shippingMethodsResolver = $shippingMethodsResolver; + public function __construct( + private OrderShippingMethodSelectionRequirementCheckerInterface $decorated, + private ShippingMethodsResolverInterface $shippingMethodsResolver, + ) { } public function isShippingMethodSelectionRequired(OrderInterface $order): bool { - $required = $this->decorated->isShippingMethodSelectionRequired($order); - if (true === $required) { + if ($this->decorated->isShippingMethodSelectionRequired($order)) { return true; } - // the original Sylius checker returns false in two cases + // The original Sylius checker returns false in two cases // 1. If shipping is not required // 2. If there only is one available shipping method - // we need to cover both cases here + // We need to cover both cases here if (!$order->isShippingRequired()) { return false; diff --git a/src/Validator/Constraints/HasPickupPointSelected.php b/src/Validator/Constraints/HasPickupPointSelected.php index e6cde63b..0e453f02 100644 --- a/src/Validator/Constraints/HasPickupPointSelected.php +++ b/src/Validator/Constraints/HasPickupPointSelected.php @@ -10,11 +10,6 @@ final class HasPickupPointSelected extends Constraint { public string $pickupPointNotBlank = 'setono_pickup_point.shipment.pickup_point.not_blank'; - public function validatedBy(): string - { - return 'setono_pickup_point_has_pickup_point_selected'; - } - public function getTargets(): string { return Constraint::CLASS_CONSTRAINT; diff --git a/src/Validator/Constraints/HasPickupPointSelectedValidator.php b/src/Validator/Constraints/HasPickupPointSelectedValidator.php index 936c3988..5696ce43 100644 --- a/src/Validator/Constraints/HasPickupPointSelectedValidator.php +++ b/src/Validator/Constraints/HasPickupPointSelectedValidator.php @@ -12,7 +12,7 @@ final class HasPickupPointSelectedValidator extends ConstraintValidator { - public function validate($value, Constraint $constraint): void + public function validate(mixed $value, Constraint $constraint): void { if (null === $value || '' === $value) { return; @@ -36,7 +36,7 @@ public function validate($value, Constraint $constraint): void return; } - if (!$value->hasPickupPointId()) { + if (!$value->hasPickupPoint()) { $this->context ->buildViolation($constraint->pickupPointNotBlank) ->addViolation() diff --git a/templates/_javascripts.html.twig b/templates/_javascripts.html.twig new file mode 100644 index 00000000..75c56464 --- /dev/null +++ b/templates/_javascripts.html.twig @@ -0,0 +1,2 @@ + + diff --git a/templates/_stylesheets.html.twig b/templates/_stylesheets.html.twig new file mode 100644 index 00000000..32ac47c2 --- /dev/null +++ b/templates/_stylesheets.html.twig @@ -0,0 +1 @@ + diff --git a/templates/admin/order/show/shipment/pickupPoint.html.twig b/templates/admin/order/show/shipment/pickupPoint.html.twig new file mode 100644 index 00000000..f2cad2e1 --- /dev/null +++ b/templates/admin/order/show/shipment/pickupPoint.html.twig @@ -0,0 +1,10 @@ +{% set pickupPoint = hookable_metadata.context.shipment.pickupPoint %} + +{% if pickupPoint %} + + {{ 'setono_sylius_pickup_point.ui.shipment_to'|trans }}
+ {{ pickupPoint.name }}, {{ pickupPoint.address }}, {{ pickupPoint.zipCode }} {{ pickupPoint.city }} + +{% else %} +   +{% endif %} diff --git a/templates/admin/shipping_method/form/configuration/pickupPointProvider.html.twig b/templates/admin/shipping_method/form/configuration/pickupPointProvider.html.twig new file mode 100644 index 00000000..b6e59262 --- /dev/null +++ b/templates/admin/shipping_method/form/configuration/pickupPointProvider.html.twig @@ -0,0 +1,3 @@ +
+ {{ form_row(hookable_metadata.context.form.pickupPointProvider) }} +
diff --git a/templates/shop/checkout/select_shipping/shipment/pickupPoint.html.twig b/templates/shop/checkout/select_shipping/shipment/pickupPoint.html.twig new file mode 100644 index 00000000..dde32adf --- /dev/null +++ b/templates/shop/checkout/select_shipping/shipment/pickupPoint.html.twig @@ -0,0 +1,23 @@ +{% set form = hookable_metadata.context.form %} + +{% if form.pickupPoint is defined %} + {# + Carrier only: the hidden field is what is submitted, and the data attributes hand the localized + strings to public/js/setono-pickup-point.js. The visible chooser is built by that script and + inserted into the selected pickup-capable shipping method's card, because the points are fetched + asynchronously after the page has rendered (a slow/down provider never blocks the page). + #} + +{% endif %} diff --git a/tests/Application/.env b/tests/Application/.env index 15b087f9..de7bee1c 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -23,13 +23,13 @@ APP_SECRET=EDITME # Format described at https://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url # For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db" # Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls -DATABASE_URL=mysql://root@127.0.0.1/setono_sylius_pickup_point_%kernel.environment%?serverVersion=5.7 +DATABASE_URL=mysql://root@127.0.0.1/sylius_pickup_point_plugin_%kernel.environment%?serverVersion=11.6.2-MariaDB ###< doctrine/doctrine-bundle ### ###> lexik/jwt-authentication-bundle ### JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem -JWT_PASSPHRASE=acme_plugin_development +JWT_PASSPHRASE=sylius_pickup_point_plugin_development ###< lexik/jwt-authentication-bundle ### ###> symfony/messenger ### @@ -45,22 +45,3 @@ MESSENGER_TRANSPORT_DSN=doctrine://default # Delivery is disabled by default via "null://localhost" MAILER_DSN=null://localhost ###< symfony/swiftmailer-bundle ### - -###> setono/dao-bundle ### -DAO_CUSTOMER_ID= -DAO_PASSWORD= -###< setono/dao-bundle ### - -###> setono/post-nord-bundle ### -POST_NORD_API_KEY= -###< setono/post-nord-bundle ### - -###> setono/coolrunner-bundle ### -COOLRUNNER_USERNAME= -COOLRUNNER_TOKEN= -###< setono/coolrunner-bundle ### - -###> setono/budbee-bundle ### -BUDBEE_API_KEY= -BUDBEE_API_SECRET= -###< setono/budbee-bundle ### diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore index bc600a8c..57ff3f19 100644 --- a/tests/Application/.gitignore +++ b/tests/Application/.gitignore @@ -21,3 +21,5 @@ ###> symfony/web-server-bundle ### /.web-server-pid ###< symfony/web-server-bundle ### + +/config/reference.php diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index 10aa2999..6f42149f 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -4,80 +4,10 @@ namespace Setono\SyliusPickupPointPlugin\Tests\Application; -use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Kernel as BaseKernel; -use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; final class Kernel extends BaseKernel { use MicroKernelTrait; - - private const CONFIG_EXTS = '.{php,xml,yaml,yml}'; - - public function getCacheDir(): string - { - return $this->getProjectDir() . '/var/cache/' . $this->environment; - } - - public function getLogDir(): string - { - return $this->getProjectDir() . '/var/log'; - } - - public function registerBundles(): iterable - { - foreach ($this->getConfigurationDirectories() as $confDir) { - $bundlesFile = $confDir . '/bundles.php'; - if (false === is_file($bundlesFile)) { - continue; - } - yield from $this->registerBundlesFromFile($bundlesFile); - } - } - - protected function configureRoutes(RoutingConfigurator $routes): void - { - foreach ($this->getConfigurationDirectories() as $confDir) { - $this->loadRoutesConfiguration($routes, $confDir); - } - } - - protected function getContainerBaseClass(): string - { - if (str_contains($this->environment, 'test')) { - return MockerContainer::class; - } - - return parent::getContainerBaseClass(); - } - - private function loadRoutesConfiguration(RoutingConfigurator $routes, string $confDir): void - { - $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS); - $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS); - $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS); - } - - /** - * @return BundleInterface[] - */ - private function registerBundlesFromFile(string $bundlesFile): iterable - { - $contents = require $bundlesFile; - foreach ($contents as $class => $envs) { - if (isset($envs['all']) || isset($envs[$this->environment])) { - yield new $class(); - } - } - } - - /** - * @return string[] - */ - private function getConfigurationDirectories(): iterable - { - yield $this->getProjectDir() . '/config'; - } } diff --git a/tests/Application/Model/Shipment.php b/tests/Application/Model/Shipment.php index e5c29d5d..2f9e07bb 100644 --- a/tests/Application/Model/Shipment.php +++ b/tests/Application/Model/Shipment.php @@ -9,11 +9,8 @@ use Setono\SyliusPickupPointPlugin\Model\ShipmentInterface; use Sylius\Component\Core\Model\Shipment as BaseShipment; -/** - * @ORM\Entity() - * - * @ORM\Table(name="sylius_shipment") - */ +#[ORM\Entity] +#[ORM\Table(name: 'sylius_shipment')] class Shipment extends BaseShipment implements ShipmentInterface { use PickupPointAwareTrait; diff --git a/tests/Application/Model/ShippingMethod.php b/tests/Application/Model/ShippingMethod.php index f379ecad..dfe76f28 100644 --- a/tests/Application/Model/ShippingMethod.php +++ b/tests/Application/Model/ShippingMethod.php @@ -9,11 +9,8 @@ use Setono\SyliusPickupPointPlugin\Model\ShippingMethodInterface; use Sylius\Component\Core\Model\ShippingMethod as BaseShippingMethod; -/** - * @ORM\Entity() - * - * @ORM\Table(name="sylius_shipping_method") - */ +#[ORM\Entity] +#[ORM\Table(name: 'sylius_shipping_method')] class ShippingMethod extends BaseShippingMethod implements ShippingMethodInterface { use PickupPointProviderAwareTrait; diff --git a/tests/Application/assets/admin/entry.js b/tests/Application/assets/admin/entry.js index 635f5acc..77914cf0 100644 --- a/tests/Application/assets/admin/entry.js +++ b/tests/Application/assets/admin/entry.js @@ -1 +1 @@ -import 'sylius/bundle/AdminBundle/Resources/private/entry'; +import '@sylius-ui/admin'; diff --git a/tests/Application/assets/shop/entry.js b/tests/Application/assets/shop/entry.js index aadc3174..b6c8b037 100644 --- a/tests/Application/assets/shop/entry.js +++ b/tests/Application/assets/shop/entry.js @@ -1 +1 @@ -import 'sylius/bundle/ShopBundle/Resources/private/entry'; +import '@sylius-ui/shop'; diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index d461970a..f9086c8d 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -2,7 +2,7 @@ declare(strict_types=1); -return [ +$bundles = [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], @@ -30,14 +30,8 @@ Sylius\Bundle\CoreBundle\SyliusCoreBundle::class => ['all' => true], Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true], Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], - winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true], - Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true], - Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true], - JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true], - FOS\RestBundle\FOSRestBundle::class => ['all' => true], Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true], Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true], - League\FlysystemBundle\FlysystemBundle::class => ['all' => true], Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true], Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true], Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], @@ -47,21 +41,33 @@ Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true], Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true], Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true], - Setono\SyliusPickupPointPlugin\SetonoSyliusPickupPointPlugin::class => ['all' => true], - Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], - Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], - ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], - Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], + Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], + ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], + Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true], - Setono\GlsWebserviceBundle\SetonoGlsWebserviceBundle::class => ['all' => true], - Setono\PostNordBundle\SetonoPostNordBundle::class => ['all' => true], - Setono\DAOBundle\SetonoDAOBundle::class => ['all' => true], - Setono\CoolRunnerBundle\SetonoCoolRunnerBundle::class => ['all' => true], - Setono\BudbeeBundle\SetonoBudbeeBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], + League\FlysystemBundle\FlysystemBundle::class => ['all' => true], + Sylius\TwigExtra\Symfony\SyliusTwigExtraBundle::class => ['all' => true], + Sylius\TwigHooks\SyliusTwigHooksBundle::class => ['all' => true], + Symfony\UX\Icons\UXIconsBundle::class => ['all' => true], + Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true], + Symfony\UX\LiveComponent\LiveComponentBundle::class => ['all' => true], + Symfony\UX\Autocomplete\AutocompleteBundle::class => ['all' => true], + Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true], + Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true], + DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true], + Setono\GlsWebserviceBundle\SetonoGlsWebserviceBundle::class => ['all' => true], + Setono\SyliusPickupPointPlugin\SetonoSyliusPickupPointPlugin::class => ['all' => true], ]; + +// Filter out bundles whose class is missing — needed for the `static-code-analysis` +// CI matrix which removes `sylius/sylius` (and with it many transitively-installed +// bundles) before booting the kernel. +return array_filter( + $bundles, + static fn (string $class): bool => class_exists($class), + \ARRAY_FILTER_USE_KEY, +); diff --git a/tests/Application/config/packages/_sylius.yaml b/tests/Application/config/packages/_sylius.yaml index 2f6645c0..f55710bc 100644 --- a/tests/Application/config/packages/_sylius.yaml +++ b/tests/Application/config/packages/_sylius.yaml @@ -1,11 +1,13 @@ imports: - { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" } + - { resource: "@SyliusPayumBundle/Resources/config/app/config.yaml" } - { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" } - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" } - { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" } parameters: sylius_core.public_dir: '%kernel.project_dir%/public' + sylius.form.type.checkout_select_shipping.validation_groups: ['sylius', 'checkout_select_shipping'] sylius_shop: product_grid: diff --git a/tests/Application/config/packages/api_platform.yaml b/tests/Application/config/packages/api_platform.yaml index 26def491..e6f25fbb 100644 --- a/tests/Application/config/packages/api_platform.yaml +++ b/tests/Application/config/packages/api_platform.yaml @@ -1,8 +1,9 @@ api_platform: mapping: paths: - - '%kernel.project_dir%/../../vendor/sylius/sylius/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources' + - '%kernel.project_dir%/../../vendor/sylius/sylius/src/Sylius/Bundle/ApiBundle/Resources/config/api_platform' - '%kernel.project_dir%/config/api_platform' + - '%kernel.project_dir%/src/Entity' patch_formats: json: ['application/merge-patch+json'] swagger: diff --git a/tests/Application/config/packages/buzz.yaml b/tests/Application/config/packages/buzz.yaml deleted file mode 100644 index 64fe575c..00000000 --- a/tests/Application/config/packages/buzz.yaml +++ /dev/null @@ -1,54 +0,0 @@ -# Read more about client options at: https://github.com/kriswallsmith/Buzz/blob/master/doc/client.md -services: - _defaults: - public: false - - # Tell the auto wire system to use "FileGetContents" client as default client. - # Set this to any of the other clients below (e.g. Curl or MultiCurl) to use a different default client. - Buzz\Client\BuzzClientInterface: '@buzz.client.file_get_contents' - Buzz\Client\BatchClientInterface: '@buzz.client.multi_curl' - - # Register alias for PSR-18 - Psr\Http\Client\ClientInterface: '@Buzz\Client\BuzzClientInterface' - - # Clients - buzz.client.file_get_contents: - class: Buzz\Client\FileGetContents - arguments: - - '@Psr\Http\Message\ResponseFactoryInterface' - - - timeout: 10 - allow_redirects: false - - buzz.client.curl: - class: Buzz\Client\Curl - arguments: - - '@Psr\Http\Message\ResponseFactoryInterface' - - - timeout: 10 - allow_redirects: false - - buzz.client.multi_curl: - class: Buzz\Client\MultiCurl - arguments: - - '@Psr\Http\Message\ResponseFactoryInterface' - - - timeout: 10 - allow_redirects: false - - # Browser - Buzz\Browser: - arguments: ['@Buzz\Client\BuzzClientInterface', '@Psr\Http\Message\RequestFactoryInterface'] - calls: - - ['addMiddleware', ['@buzz.middleware.content_length']] - - ['addMiddleware', ['@buzz.middleware.logger']] - - # Middleware - buzz.middleware.content_length: - class: Buzz\Middleware\ContentLengthMiddleware - - buzz.middleware.logger: - class: Buzz\Middleware\LoggerMiddleware - arguments: ['@?logger'] - tags: - - { name: monolog.logger, channel: buzz } diff --git a/tests/Application/config/packages/dev/framework.yaml b/tests/Application/config/packages/dev/framework.yaml deleted file mode 100644 index 4b116def..00000000 --- a/tests/Application/config/packages/dev/framework.yaml +++ /dev/null @@ -1,2 +0,0 @@ -framework: - profiler: { only_exceptions: false } diff --git a/tests/Application/config/packages/dev/jms_serializer.yaml b/tests/Application/config/packages/dev/jms_serializer.yaml deleted file mode 100644 index 2f32a9b1..00000000 --- a/tests/Application/config/packages/dev/jms_serializer.yaml +++ /dev/null @@ -1,12 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/packages/dev/monolog.yaml b/tests/Application/config/packages/dev/monolog.yaml deleted file mode 100644 index da2b092d..00000000 --- a/tests/Application/config/packages/dev/monolog.yaml +++ /dev/null @@ -1,9 +0,0 @@ -monolog: - handlers: - main: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug - firephp: - type: firephp - level: info diff --git a/tests/Application/config/packages/dev/routing.yaml b/tests/Application/config/packages/dev/routing.yaml deleted file mode 100644 index 4116679a..00000000 --- a/tests/Application/config/packages/dev/routing.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - router: - strict_requirements: true diff --git a/tests/Application/config/packages/dev/web_profiler.yaml b/tests/Application/config/packages/dev/web_profiler.yaml deleted file mode 100644 index 1f1cb2bb..00000000 --- a/tests/Application/config/packages/dev/web_profiler.yaml +++ /dev/null @@ -1,3 +0,0 @@ -web_profiler: - toolbar: true - intercept_redirects: false diff --git a/tests/Application/config/packages/doctrine.yaml b/tests/Application/config/packages/doctrine.yaml index 66aa54d1..ee541341 100644 --- a/tests/Application/config/packages/doctrine.yaml +++ b/tests/Application/config/packages/doctrine.yaml @@ -10,16 +10,48 @@ doctrine: driver: 'pdo_mysql' server_version: '5.7' charset: UTF8 + use_savepoints: true url: '%env(resolve:DATABASE_URL)%' + orm: - auto_generate_proxy_classes: '%kernel.debug%' - naming_strategy: doctrine.orm.naming_strategy.underscore - auto_mapping: true mappings: App: + type: attribute is_bundle: false - type: annotation dir: '%kernel.project_dir%/Model' prefix: 'Setono\SyliusPickupPointPlugin\Tests\Application\Model' alias: App + +when@prod: + doctrine: + orm: + metadata_cache_driver: + type: service + id: doctrine.system_cache_provider + query_cache_driver: + type: service + id: doctrine.system_cache_provider + result_cache_driver: + type: service + id: doctrine.result_cache_provider + + services: + doctrine.result_cache_provider: + class: Symfony\Component\Cache\DoctrineProvider + public: false + arguments: + - '@doctrine.result_cache_pool' + doctrine.system_cache_provider: + class: Symfony\Component\Cache\DoctrineProvider + public: false + arguments: + - '@doctrine.system_cache_pool' + + framework: + cache: + pools: + doctrine.result_cache_pool: + adapter: cache.app + doctrine.system_cache_pool: + adapter: cache.system diff --git a/tests/Application/config/packages/doctrine_migrations.yaml b/tests/Application/config/packages/doctrine_migrations.yaml index cdbc01ae..ec356494 100644 --- a/tests/Application/config/packages/doctrine_migrations.yaml +++ b/tests/Application/config/packages/doctrine_migrations.yaml @@ -2,3 +2,5 @@ doctrine_migrations: storage: table_storage: table_name: sylius_migrations + migrations_paths: + 'App\Migrations': '%kernel.project_dir%/../../src/Migrations/' diff --git a/tests/Application/config/packages/fos_rest.yaml b/tests/Application/config/packages/fos_rest.yaml deleted file mode 100644 index eaebb277..00000000 --- a/tests/Application/config/packages/fos_rest.yaml +++ /dev/null @@ -1,11 +0,0 @@ -fos_rest: - exception: true - view: - formats: - json: true - xml: true - empty_content: 204 - format_listener: - rules: - - { path: '^/api/v1/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true } - - { path: '^/', stop: true } diff --git a/tests/Application/config/packages/framework.yaml b/tests/Application/config/packages/framework.yaml index 3df2c0ad..0ef63311 100644 --- a/tests/Application/config/packages/framework.yaml +++ b/tests/Application/config/packages/framework.yaml @@ -1,9 +1,24 @@ framework: secret: '%env(APP_SECRET)%' - ide: phpstorm - form: - enabled: true - legacy_error_messages: false + ide: 'phpstorm' + form: true csrf_protection: true session: handler_id: ~ + +when@dev: + framework: + profiler: { only_exceptions: false } + +when@test: + framework: + test: ~ + session: + storage_factory_id: session.storage.factory.mock_file + + mailer: + dsn: '%env(MAILER_DSN)%' + cache: + pools: + test.mailer_pool: + adapter: cache.adapter.filesystem diff --git a/tests/Application/config/packages/http_discovery.yaml b/tests/Application/config/packages/http_discovery.yaml new file mode 100644 index 00000000..2a789e73 --- /dev/null +++ b/tests/Application/config/packages/http_discovery.yaml @@ -0,0 +1,10 @@ +services: + Psr\Http\Message\RequestFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\ResponseFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\ServerRequestFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\StreamFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\UploadedFileFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\UriFactoryInterface: '@http_discovery.psr17_factory' + + http_discovery.psr17_factory: + class: Http\Discovery\Psr17Factory diff --git a/tests/Application/config/packages/jms_serializer.yaml b/tests/Application/config/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc613..00000000 --- a/tests/Application/config/packages/jms_serializer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -jms_serializer: - visitors: - xml_serialization: - format_output: '%kernel.debug%' diff --git a/tests/Application/config/packages/monolog.yaml b/tests/Application/config/packages/monolog.yaml new file mode 100644 index 00000000..73e391ab --- /dev/null +++ b/tests/Application/config/packages/monolog.yaml @@ -0,0 +1,30 @@ +when@dev: + monolog: + handlers: + main: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug + firephp: + type: firephp + level: info + +when@test: + monolog: + handlers: + main: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: error + +when@prod: + monolog: + handlers: + main: + type: fingers_crossed + action_level: error + handler: nested + nested: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug diff --git a/tests/Application/config/packages/nyholm_psr7.yaml b/tests/Application/config/packages/nyholm_psr7.yaml deleted file mode 100644 index 761aa965..00000000 --- a/tests/Application/config/packages/nyholm_psr7.yaml +++ /dev/null @@ -1,14 +0,0 @@ -services: - _defaults: - public: false - - # Register nyholm/psr7 services for autowiring with PSR-17 (HTTP factories) - Psr\Http\Message\RequestFactoryInterface: '@nyholm.psr7.psr17_factory' - Psr\Http\Message\ResponseFactoryInterface: '@nyholm.psr7.psr17_factory' - Psr\Http\Message\ServerRequestFactoryInterface: '@nyholm.psr7.psr17_factory' - Psr\Http\Message\StreamFactoryInterface: '@nyholm.psr7.psr17_factory' - Psr\Http\Message\UploadedFileFactoryInterface: '@nyholm.psr7.psr17_factory' - Psr\Http\Message\UriFactoryInterface: '@nyholm.psr7.psr17_factory' - - nyholm.psr7.psr17_factory: - class: Nyholm\Psr7\Factory\Psr17Factory diff --git a/tests/Application/config/packages/prod/doctrine.yaml b/tests/Application/config/packages/prod/doctrine.yaml deleted file mode 100644 index 2f16f0fd..00000000 --- a/tests/Application/config/packages/prod/doctrine.yaml +++ /dev/null @@ -1,31 +0,0 @@ -doctrine: - orm: - metadata_cache_driver: - type: service - id: doctrine.system_cache_provider - query_cache_driver: - type: service - id: doctrine.system_cache_provider - result_cache_driver: - type: service - id: doctrine.result_cache_provider - -services: - doctrine.result_cache_provider: - class: Symfony\Component\Cache\DoctrineProvider - public: false - arguments: - - '@doctrine.result_cache_pool' - doctrine.system_cache_provider: - class: Symfony\Component\Cache\DoctrineProvider - public: false - arguments: - - '@doctrine.system_cache_pool' - -framework: - cache: - pools: - doctrine.result_cache_pool: - adapter: cache.app - doctrine.system_cache_pool: - adapter: cache.system diff --git a/tests/Application/config/packages/prod/jms_serializer.yaml b/tests/Application/config/packages/prod/jms_serializer.yaml deleted file mode 100644 index c2881820..00000000 --- a/tests/Application/config/packages/prod/jms_serializer.yaml +++ /dev/null @@ -1,10 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/packages/prod/monolog.yaml b/tests/Application/config/packages/prod/monolog.yaml deleted file mode 100644 index 64612114..00000000 --- a/tests/Application/config/packages/prod/monolog.yaml +++ /dev/null @@ -1,10 +0,0 @@ -monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug diff --git a/tests/Application/config/packages/prod/setono_sylius_pickup_point.yaml b/tests/Application/config/packages/prod/setono_sylius_pickup_point.yaml deleted file mode 100644 index 96b5b662..00000000 --- a/tests/Application/config/packages/prod/setono_sylius_pickup_point.yaml +++ /dev/null @@ -1,3 +0,0 @@ -setono_sylius_pickup_point: - providers: - faker: false diff --git a/tests/Application/config/packages/routing.yaml b/tests/Application/config/packages/routing.yaml index 368bc7f4..d0c2c76b 100644 --- a/tests/Application/config/packages/routing.yaml +++ b/tests/Application/config/packages/routing.yaml @@ -1,3 +1,8 @@ framework: router: - strict_requirements: ~ + strict_requirements: false + +when@dev: + framework: + router: + strict_requirements: true diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/packages/security.yaml index 2f5c6875..af38e750 100644 --- a/tests/Application/config/packages/security.yaml +++ b/tests/Application/config/packages/security.yaml @@ -1,5 +1,4 @@ security: - enable_authenticator_manager: true providers: sylius_admin_user_provider: id: sylius.admin_user_provider.email_or_name_based @@ -18,6 +17,7 @@ security: context: admin pattern: "%sylius.security.admin_regex%" provider: sylius_admin_user_provider + user_checker: security.user_checker.chain.admin form_login: provider: sylius_admin_user_provider login_path: sylius_admin_login @@ -39,26 +39,28 @@ security: path: sylius_admin_logout target: sylius_admin_login - new_api_admin_user: - pattern: "%sylius.security.new_api_admin_regex%/.*" + api_admin: + pattern: "%sylius.security.api_admin_regex%/.*" provider: sylius_api_admin_user_provider + user_checker: security.user_checker.chain.api_admin stateless: true entry_point: jwt json_login: - check_path: "%sylius.security.new_api_admin_route%/authentication-token" + check_path: "%sylius.security.api_admin_route%/administrators/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%/.*" + api_shop: + pattern: "%sylius.security.api_shop_regex%/.*" provider: sylius_api_shop_user_provider + user_checker: security.user_checker.chain.api_shop stateless: true entry_point: jwt json_login: - check_path: "%sylius.security.new_api_shop_route%/authentication-token" + check_path: "%sylius.security.api_shop_route%/customers/token" username_path: email password_path: password success_handler: lexik_jwt_authentication.handler.authentication_success @@ -70,6 +72,7 @@ security: context: shop pattern: "%sylius.security.shop_regex%" provider: sylius_shop_user_provider + user_checker: security.user_checker.chain.shop form_login: success_handler: sylius.authentication.success_handler failure_handler: sylius.authentication.failure_handler @@ -83,6 +86,12 @@ security: enable_csrf: true csrf_parameter: _csrf_shop_security_token csrf_token_id: shop_authenticate + json_login: + check_path: sylius_shop_json_login_check + username_path: _username + password_path: _password + success_handler: sylius.authentication.success_handler + failure_handler: sylius.authentication.failure_handler remember_me: secret: "%env(APP_SECRET)%" name: APP_SHOP_REMEMBER_ME @@ -93,16 +102,15 @@ security: target: sylius_shop_homepage invalidate_session: false + image_resolver: + pattern: ^/media/cache/resolve + security: 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 } @@ -114,9 +122,9 @@ security: - { 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 } + - { path: "%sylius.security.api_admin_route%/administrators/reset-password", role: PUBLIC_ACCESS } + - { path: "%sylius.security.api_admin_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.api_admin_route%/administrators/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.api_shop_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.api_shop_route%/customers/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/packages/setono_budbee.yaml b/tests/Application/config/packages/setono_budbee.yaml deleted file mode 100644 index 15cbe936..00000000 --- a/tests/Application/config/packages/setono_budbee.yaml +++ /dev/null @@ -1,3 +0,0 @@ -setono_budbee: - api_key: '%env(BUDBEE_API_KEY)%' - api_secret: '%env(BUDBEE_API_SECRET)%' diff --git a/tests/Application/config/packages/setono_coolrunner.yaml b/tests/Application/config/packages/setono_coolrunner.yaml deleted file mode 100644 index 1d842e67..00000000 --- a/tests/Application/config/packages/setono_coolrunner.yaml +++ /dev/null @@ -1,3 +0,0 @@ -setono_coolrunner: - username: '%env(COOLRUNNER_USERNAME)%' - token: '%env(COOLRUNNER_TOKEN)%' diff --git a/tests/Application/config/packages/setono_dao.yaml b/tests/Application/config/packages/setono_dao.yaml deleted file mode 100644 index 74428422..00000000 --- a/tests/Application/config/packages/setono_dao.yaml +++ /dev/null @@ -1,3 +0,0 @@ -setono_dao: - customer_id: '%env(DAO_CUSTOMER_ID)%' - password: '%env(DAO_PASSWORD)%' diff --git a/tests/Application/config/packages/setono_gls_webservice.yaml b/tests/Application/config/packages/setono_gls_webservice.yaml deleted file mode 100644 index 5971d0bb..00000000 --- a/tests/Application/config/packages/setono_gls_webservice.yaml +++ /dev/null @@ -1,2 +0,0 @@ -setono_gls_webservice: - connection_timeout: 5 diff --git a/tests/Application/config/packages/setono_post_nord.yaml b/tests/Application/config/packages/setono_post_nord.yaml deleted file mode 100644 index ced2841c..00000000 --- a/tests/Application/config/packages/setono_post_nord.yaml +++ /dev/null @@ -1,2 +0,0 @@ -setono_post_nord: - api_key: '%env(POST_NORD_API_KEY)%' diff --git a/tests/Application/config/packages/setono_sylius_pickup_point.yaml b/tests/Application/config/packages/setono_sylius_pickup_point.yaml index 0265651b..cba7c6bd 100644 --- a/tests/Application/config/packages/setono_sylius_pickup_point.yaml +++ b/tests/Application/config/packages/setono_sylius_pickup_point.yaml @@ -1,20 +1,62 @@ -imports: - - { resource: "@SetonoSyliusPickupPointPlugin/Resources/config/app/config.yaml" } - - { resource: "@SetonoSyliusPickupPointPlugin/Resources/config/app/fixtures.yaml" } - -framework: - cache: - pools: - setono_sylius_pickup_point.provider_cache_pool: - adapter: cache.app - setono_sylius_pickup_point: - cache: - enabled: true - pool: setono_sylius_pickup_point.provider_cache_pool - local: true providers: faker: true gls: true - post_nord: true - dao: true + +sylius_fixtures: + suites: + default: + fixtures: + geographical: + options: + countries: + - 'DK' + - 'SE' + - 'FI' + - 'US' + - 'FR' + - 'DE' + - 'AU' + - 'CA' + - 'MX' + - 'NZ' + - 'PT' + - 'ES' + - 'CN' + zones: + WORLD: + name: 'World' + countries: + - 'DK' + - 'SE' + - 'FI' + - 'US' + - 'FR' + - 'DE' + - 'AU' + - 'CA' + - 'MX' + - 'NZ' + - 'PT' + - 'ES' + - 'CN' + + setono_sylius_pickup_point_shipping_method: + options: + custom: + faker: + code: "faker" + name: "Fake delivery" + enabled: true + zone: "WORLD" + pickup_point_provider: faker + channels: + - "FASHION_WEB" + gls: + code: "gls" + name: "GLS pickup" + enabled: true + zone: "WORLD" + pickup_point_provider: gls + channels: + - "FASHION_WEB" diff --git a/tests/Application/config/packages/sylius_state_machine_abstraction.yaml b/tests/Application/config/packages/sylius_state_machine_abstraction.yaml new file mode 100644 index 00000000..7f43c0b2 --- /dev/null +++ b/tests/Application/config/packages/sylius_state_machine_abstraction.yaml @@ -0,0 +1,6 @@ +parameters: + test_default_state_machine_adapter: 'symfony_workflow' + test_sylius_state_machine_adapter: '%env(string:default:test_default_state_machine_adapter:TEST_SYLIUS_STATE_MACHINE_ADAPTER)%' + +sylius_state_machine_abstraction: + default_adapter: '%test_sylius_state_machine_adapter%' diff --git a/tests/Application/config/packages/sylius_theme.yaml b/tests/Application/config/packages/sylius_theme.yaml new file mode 100644 index 00000000..cbc95baa --- /dev/null +++ b/tests/Application/config/packages/sylius_theme.yaml @@ -0,0 +1,4 @@ +when@test: + sylius_theme: + sources: + test: ~ diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml deleted file mode 100644 index fc1d3c13..00000000 --- a/tests/Application/config/packages/test/framework.yaml +++ /dev/null @@ -1,4 +0,0 @@ -framework: - test: ~ - session: - storage_factory_id: session.storage.factory.mock_file diff --git a/tests/Application/config/packages/test/mailer.yaml b/tests/Application/config/packages/test/mailer.yaml deleted file mode 100644 index 092eb288..00000000 --- a/tests/Application/config/packages/test/mailer.yaml +++ /dev/null @@ -1,7 +0,0 @@ -framework: - mailer: - dsn: 'null://null' - cache: - pools: - test.mailer_pool: - adapter: cache.adapter.filesystem diff --git a/tests/Application/config/packages/test/monolog.yaml b/tests/Application/config/packages/test/monolog.yaml deleted file mode 100644 index 7e2b9e3a..00000000 --- a/tests/Application/config/packages/test/monolog.yaml +++ /dev/null @@ -1,6 +0,0 @@ -monolog: - handlers: - main: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: error diff --git a/tests/Application/config/packages/test/security.yaml b/tests/Application/config/packages/test/security.yaml deleted file mode 100644 index 4071d319..00000000 --- a/tests/Application/config/packages/test/security.yaml +++ /dev/null @@ -1,6 +0,0 @@ -security: - password_hashers: - Sylius\Component\User\Model\UserInterface: - algorithm: argon2i - time_cost: 3 - memory_cost: 10 diff --git a/tests/Application/config/packages/test/sylius_theme.yaml b/tests/Application/config/packages/test/sylius_theme.yaml deleted file mode 100644 index 4d34199f..00000000 --- a/tests/Application/config/packages/test/sylius_theme.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_theme: - sources: - test: ~ diff --git a/tests/Application/config/packages/test/web_profiler.yaml b/tests/Application/config/packages/test/web_profiler.yaml deleted file mode 100644 index 03752de2..00000000 --- a/tests/Application/config/packages/test/web_profiler.yaml +++ /dev/null @@ -1,6 +0,0 @@ -web_profiler: - toolbar: false - intercept_redirects: false - -framework: - profiler: { collect: false } diff --git a/tests/Application/config/packages/validator.yaml b/tests/Application/config/packages/validator.yaml index 61807db6..a695e1a6 100644 --- a/tests/Application/config/packages/validator.yaml +++ b/tests/Application/config/packages/validator.yaml @@ -1,3 +1,3 @@ framework: validation: - enable_annotations: true + email_validation_mode: html5 diff --git a/tests/Application/config/packages/web_profiler.yaml b/tests/Application/config/packages/web_profiler.yaml new file mode 100644 index 00000000..da7b5321 --- /dev/null +++ b/tests/Application/config/packages/web_profiler.yaml @@ -0,0 +1,12 @@ +when@dev: + web_profiler: + toolbar: true + intercept_redirects: false + +when@test: + web_profiler: + toolbar: false + intercept_redirects: false + + framework: + profiler: { collect: false } diff --git a/tests/Application/config/packages/workflow.yaml b/tests/Application/config/packages/workflow.yaml new file mode 100644 index 00000000..2a716ff0 --- /dev/null +++ b/tests/Application/config/packages/workflow.yaml @@ -0,0 +1,2 @@ +framework: + workflows: ~ diff --git a/tests/Application/config/routes/dev/web_profiler.yaml b/tests/Application/config/routes/dev/web_profiler.yaml deleted file mode 100644 index 3e79dc21..00000000 --- a/tests/Application/config/routes/dev/web_profiler.yaml +++ /dev/null @@ -1,7 +0,0 @@ -_wdt: - resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" - prefix: /_wdt - -_profiler: - resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" - prefix: /_profiler diff --git a/tests/Application/config/routes/setono_sylius_pickup_point.yaml b/tests/Application/config/routes/setono_sylius_pickup_point.yaml index bf90a14f..fbe51a5d 100644 --- a/tests/Application/config/routes/setono_sylius_pickup_point.yaml +++ b/tests/Application/config/routes/setono_sylius_pickup_point.yaml @@ -1,2 +1,2 @@ -setono_sylius_pickup_point_plugin: - resource: "@SetonoSyliusPickupPointPlugin/Resources/config/routing.yaml" +setono_sylius_pickup_point: + resource: "@SetonoSyliusPickupPointPlugin/config/routes.yaml" diff --git a/tests/Application/config/routes/sylius_api.yaml b/tests/Application/config/routes/sylius_api.yaml index ae01ffce..a7504e86 100644 --- a/tests/Application/config/routes/sylius_api.yaml +++ b/tests/Application/config/routes/sylius_api.yaml @@ -1,3 +1,3 @@ sylius_api: resource: "@SyliusApiBundle/Resources/config/routing.yml" - prefix: "%sylius.security.new_api_route%" + prefix: "%sylius.security.api_route%" diff --git a/tests/Application/config/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml index 22e7a4a9..8e3dd427 100644 --- a/tests/Application/config/routes/sylius_shop.yaml +++ b/tests/Application/config/routes/sylius_shop.yaml @@ -5,13 +5,16 @@ sylius_shop: _locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$ sylius_shop_payum: - resource: "@SyliusShopBundle/Resources/config/routing/payum.yml" + resource: "@SyliusPayumBundle/Resources/config/routing/integrations/sylius_shop.yaml" + +sylius_payment_notify: + resource: "@SyliusPaymentBundle/Resources/config/routing/integrations/sylius.yaml" sylius_shop_default_locale: path: / methods: [GET] defaults: - _controller: sylius.controller.shop.locale_switch::switchAction + _controller: sylius_shop.controller.locale_switch::switchAction # see https://web.dev/change-password-url/ sylius_shop_request_password_reset_token_redirect: diff --git a/tests/Application/config/routes/web_profiler.yaml b/tests/Application/config/routes/web_profiler.yaml new file mode 100644 index 00000000..e15ab243 --- /dev/null +++ b/tests/Application/config/routes/web_profiler.yaml @@ -0,0 +1,8 @@ +when@dev: + _wdt: + resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" + prefix: /_wdt + + _profiler: + resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" + prefix: /_profiler diff --git a/tests/Application/config/services.yaml b/tests/Application/config/services.yaml index 49f5ed01..615506eb 100644 --- a/tests/Application/config/services.yaml +++ b/tests/Application/config/services.yaml @@ -2,4 +2,3 @@ # https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration parameters: locale: en_US - sylius.form.type.checkout_select_shipping.validation_groups: ['sylius', 'checkout_select_shipping'] diff --git a/tests/Application/config/services_test.yaml b/tests/Application/config/services_test.yaml deleted file mode 100644 index d9b02e3d..00000000 --- a/tests/Application/config/services_test.yaml +++ /dev/null @@ -1,3 +0,0 @@ -imports: - - { resource: "../../Behat/Resources/services.xml" } - - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } diff --git a/tests/Application/package.json b/tests/Application/package.json index 8f62c4c7..bdebb615 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -1,30 +1,20 @@ { - "dependencies": { - "chart.js": "^3.9", - "jquery": "^3.6", - "jquery.dirtyforms": "^2.0", - "lightbox2": "^2.9", - "semantic-ui-css": "^2.2", - "slick-carousel": "^1.8" - }, - "devDependencies": { - "@symfony/webpack-encore": "^1.8", - "eslint": "^8.18", - "eslint-config-airbnb-base": "^15.0", - "eslint-import-resolver-babel-module": "^5.3", - "eslint-plugin-import": "^2.26", - "node-sass": "^7.0", - "sass-loader": "^12.0" - }, + "license": "UNLICENSED", "scripts": { - "dev": "encore dev", - "build": "encore production", + "build": "encore dev", + "build:prod": "encore production", "watch": "encore dev --watch" }, - "repository": { - "type": "git", - "url": "git+https://github.com/Sylius/Sylius.git" + "dependencies": { + "@sylius-ui/admin": "file:../../vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle", + "@sylius-ui/shop": "file:../../vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle", + "@symfony/ux-autocomplete": "file:../../vendor/symfony/ux-autocomplete/assets", + "@symfony/ux-live-component": "file:../../vendor/symfony/ux-live-component/assets" }, - "author": "Paweł Jędrzejewski", - "license": "MIT" + "devDependencies": { + "@hotwired/stimulus": "^3.0.0", + "@symfony/stimulus-bridge": "^3.2.0", + "@symfony/webpack-encore": "^5.0.1", + "tom-select": "^2.2.2" + } } diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php index 67e8d1b5..ea7179b6 100644 --- a/tests/Application/public/index.php +++ b/tests/Application/public/index.php @@ -15,7 +15,10 @@ } if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) { - Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); + Request::setTrustedProxies( + explode(',', $trustedProxies), + Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO, + ); } if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) { diff --git a/etc/build/.gitignore b/tests/Application/src/Entity/.gitignore similarity index 100% rename from etc/build/.gitignore rename to tests/Application/src/Entity/.gitignore diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/_shipment.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/_shipment.html.twig deleted file mode 100644 index f9581851..00000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/_shipment.html.twig +++ /dev/null @@ -1,40 +0,0 @@ -{% import '@SyliusUi/Macro/labels.html.twig' as label %} - -{% set shipped = constant('Sylius\\Component\\Shipping\\Model\\Shipment::STATE_SHIPPED') %} - -
-
- {% include '@SyliusAdmin/Common/Label/shipmentState.html.twig' with {'data': shipment.state} %} -
- -
-
- {{ shipment.method }} -
-
- {% include "@SetonoSyliusPickupPointPlugin/Shop/Label/Shipment/pickupPoint.html.twig" %} -
-
- {{ shipment.method.zone }} -
- {% if shipment.shippedAt is not empty %} - {{ 'sylius.ui.shipped_at'|trans }}: {{ shipment.shippedAt|date('d-m-Y H:i:s') }} - {% endif %} -
- {% if sm_can(shipment, 'ship', 'sylius_shipment') %} - {{ render(path('sylius_admin_partial_shipment_ship', {'orderId': order.id, 'id': shipment.id})) }} - {% endif %} - {% if shipment.tracking is not empty %} -
- {{ 'sylius.ui.tracking_code'|trans|upper }} -

{{ shipment.tracking }}

-
- {% endif %} - - {% if shipment.state == shipped %} - {% set path = path('sylius_admin_shipment_resend_confirmation_email', {'id': shipment.id, '_csrf_token': csrf_token(shipment.id)}) %} - - {{ 'sylius.ui.resend_the_shipment_confirmation_email'|trans }} - - {% endif %} -
diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/ShippingMethod/_form.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/ShippingMethod/_form.html.twig deleted file mode 100644 index 105281a7..00000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/ShippingMethod/_form.html.twig +++ /dev/null @@ -1,42 +0,0 @@ -{% from '@SyliusAdmin/Macro/translationForm.html.twig' import translationForm %} - -
-
-
- {{ form_errors(form) }} -
- {{ form_row(form.code) }} - {{ form_row(form.zone) }} - {{ form_row(form.position) }} -
- {{ form_row(form.enabled) }} - {{ form_row(form.pickupPointProvider) }} -

{{ 'sylius.ui.availability'|trans }}

- {{ form_row(form.channels) }} -

{{ 'sylius.ui.category_requirements'|trans }}

- {{ form_row(form.category) }} - {% for categoryRequirementChoiceForm in form.categoryRequirement %} - {{ form_row(categoryRequirementChoiceForm) }} - {% endfor %} -

{{ 'sylius.ui.taxes'|trans }}

- {{ form_row(form.taxCategory) }} -

{{ 'sylius.ui.shipping_charges'|trans }}

- {{ form_row(form.calculator) }} - {% for name, calculatorConfigurationPrototype in form.vars.prototypes %} -
-
- {% endfor %} -
- {% if form.configuration is defined %} - {% for field in form.configuration %} - {{ form_row(field) }} - {% endfor %} - {% endif %} -
-
-
-
- {{ translationForm(form.translations) }} -
-
diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Checkout/SelectShipping/_shipment.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Checkout/SelectShipping/_shipment.html.twig deleted file mode 100644 index 8d56afdc..00000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Checkout/SelectShipping/_shipment.html.twig +++ /dev/null @@ -1,20 +0,0 @@ -{% form_theme form.pickupPointId '@SetonoSyliusPickupPointPlugin/Form/theme.html.twig' %} - -
-
{{ 'sylius.ui.shipment'|trans }} #{{ loop.index }}
-
- {{ form_errors(form.method) }} - - {% for key, choice_form in form.method %} - {% set fee = form.method.vars.shipping_costs[choice_form.vars.value] %} - {% set method = form.method.vars.choices[key].data %} - {% include '@SyliusShop/Checkout/SelectShipping/_choice.html.twig' with {'form': choice_form, 'method': method, 'fee': fee} %} - {% else %} - {% include '@SyliusShop/Checkout/SelectShipping/_unavailable.html.twig' %} - {% endfor %} - - {% if form.method|length %} - {{ form_row(form.pickupPointId) }} - {% endif %} -
-
diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Common/Order/_shipments.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Common/Order/_shipments.html.twig deleted file mode 100644 index 276ba27d..00000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Common/Order/_shipments.html.twig +++ /dev/null @@ -1,21 +0,0 @@ -{% set state = order.shippingState %} -{% if state != 'cart' %} - {% include "@SyliusShop/Common/Order/Label/ShipmentState/orderShipmentState.html.twig" %} -{% endif %} -{% for shipment in order.shipments %} - {% set state = shipment.state %} -
- -
-
- {{ shipment.method }} -
- {% include "@SetonoSyliusPickupPointPlugin/Shop/Label/Shipment/pickupPoint.html.twig" %} - {% if state != 'cart' %} -

- {% include "@SyliusShop/Common/Order/Label/ShipmentState/singleShipmentState.html.twig" with { 'state': state } %} -

- {% endif %} -
-
-{% endfor %} diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig deleted file mode 100644 index bb594f7a..00000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -Sylius - diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Footer/Grid/_plus.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Layout/Footer/Grid/_plus.html.twig deleted file mode 100644 index 89301cf0..00000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Footer/Grid/_plus.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -
- -

- Need even more features? -
Check Sylius Plus out!
-

- Sylius Plus -
-
diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig deleted file mode 100644 index 5043fc31..00000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -
- - Sylius - -
diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js index fae14296..313e6f36 100644 --- a/tests/Application/webpack.config.js +++ b/tests/Application/webpack.config.js @@ -1,47 +1,8 @@ const path = require('path'); -const Encore = require('@symfony/webpack-encore'); +const SyliusAdmin = require('@sylius-ui/admin'); +const SyliusShop = require('@sylius-ui/shop'); -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(); - -const shopConfig = Encore.getWebpackConfig(); - -shopConfig.resolve.alias['sylius/ui'] = uiBundleScripts; -shopConfig.resolve.alias['sylius/ui-resources'] = uiBundleResources; -shopConfig.resolve.alias['sylius/bundle'] = syliusBundles; -shopConfig.name = 'shop'; - -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(); - -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.name = 'admin'; +const adminConfig = SyliusAdmin.getWebpackConfig(path.resolve(__dirname)); +const shopConfig = SyliusShop.getWebpackConfig(path.resolve(__dirname)); module.exports = [shopConfig, adminConfig]; diff --git a/tests/Behat/Context/Setup/ShippingContext.php b/tests/Behat/Context/Setup/ShippingContext.php deleted file mode 100644 index 54d2dd17..00000000 --- a/tests/Behat/Context/Setup/ShippingContext.php +++ /dev/null @@ -1,45 +0,0 @@ -providerRegistry = $providerRegistry; - $this->shippingMethodEntityManager = $shippingMethodEntityManager; - } - - /** - * @Given /^(shipping method "[^"]+") has the selected "([^"]+)" pickup point provider$/ - */ - public function theShippingMethodHasTheSelectedGlsPickupPointProvider( - ShippingMethodInterface $shippingMethod, - string $pickupPointProviderCode, - ): void { - if (!$this->providerRegistry->has($pickupPointProviderCode)) { - throw new RuntimeException(sprintf( - 'PickupPoint provider with code %s was not found in registry.', - $pickupPointProviderCode, - )); - } - $shippingMethod->setPickupPointProvider($pickupPointProviderCode); - $this->shippingMethodEntityManager->flush(); - } -} diff --git a/tests/Behat/Context/Ui/Admin/ShippingContext.php b/tests/Behat/Context/Ui/Admin/ShippingContext.php deleted file mode 100644 index 02726dfb..00000000 --- a/tests/Behat/Context/Ui/Admin/ShippingContext.php +++ /dev/null @@ -1,26 +0,0 @@ -createPage = $createPage; - } - - /** - * @When I select :providerCode as pickup point provider - */ - public function iSelectAsPickupPointProvider(string $providerCode): void - { - $this->createPage->selectPickupPointProvider($providerCode); - } -} diff --git a/tests/Behat/Context/Ui/Shop/ShippingContext.php b/tests/Behat/Context/Ui/Shop/ShippingContext.php deleted file mode 100644 index 6c198261..00000000 --- a/tests/Behat/Context/Ui/Shop/ShippingContext.php +++ /dev/null @@ -1,71 +0,0 @@ -selectShippingPage = $selectShippingPage; - $this->completePage = $completePage; - $this->sharedStorage = $sharedStorage; - $this->orderRepository = $orderRepository; - } - - /** - * @Given I choose the first option - */ - public function iChooseTheFirstOption(): void - { - $this->selectShippingPage->chooseFirstShippingPointFromRadio(); - } - - /** - * @Then the shipping method should have a pickup point - */ - public function theShippingMethodShouldHaveAPickupPoint(): void - { - /** @var OrderInterface $order */ - $order = $this->orderRepository->findAll()[0]; - - /** @var PickupPointAwareInterface $shipment */ - $shipment = $order->getShipments()->first(); - - Assert::notNull($shipment->getPickupPointId()); - } - - /** - * @Given I select :shippingMethod pickup point shipping method - */ - public function iSelectPickupPointShippingMethod(string $shippingMethod): void - { - $this->selectShippingPage->selectPickupPointShippingMethod($shippingMethod); - } -} diff --git a/tests/Behat/Mocker/GlsProviderMocker.php b/tests/Behat/Mocker/GlsProviderMocker.php deleted file mode 100644 index 036357b0..00000000 --- a/tests/Behat/Mocker/GlsProviderMocker.php +++ /dev/null @@ -1,55 +0,0 @@ -findPickupPoint(new PickupPointCode('', '', '')), - ]; - } - - public function findPickupPoint(PickupPointCode $code): PickupPointInterface - { - $pickupPoint = new PickupPoint(); - $pickupPoint->setCode(new PickupPointCode(self::PICKUP_POINT_ID, $this->getCode(), 'DK')); - $pickupPoint->setName('Somewhere'); - $pickupPoint->setAddress('1 Rainbow str'); - $pickupPoint->setZipCode('4499'); - $pickupPoint->setCity('Aalborg'); - $pickupPoint->setCountry('DK'); - $pickupPoint->setLatitude(57.046707); - $pickupPoint->setLongitude(9.935932); - - return $pickupPoint; - } - - public function findAllPickupPoints(): iterable - { - return [ - $this->findPickupPoint(new PickupPointCode('', '', '')), - ]; - } -} diff --git a/tests/Behat/Mocker/PostNordProviderMocker.php b/tests/Behat/Mocker/PostNordProviderMocker.php deleted file mode 100644 index 2b511ce7..00000000 --- a/tests/Behat/Mocker/PostNordProviderMocker.php +++ /dev/null @@ -1,55 +0,0 @@ -findPickupPoint(new PickupPointCode('', '', '')), - ]; - } - - public function findPickupPoint(PickupPointCode $code): PickupPointInterface - { - $pickupPoint = new PickupPoint(); - $pickupPoint->setCode(new PickupPointCode(self::PICKUP_POINT_ID, $this->getCode(), 'DK')); - $pickupPoint->setName('Somewhere'); - $pickupPoint->setAddress('1 Rainbow str'); - $pickupPoint->setZipCode('4499'); - $pickupPoint->setCity('Aalborg'); - $pickupPoint->setCountry('DK'); - $pickupPoint->setLatitude(57.046707); - $pickupPoint->setLongitude(9.935932); - - return $pickupPoint; - } - - public function findAllPickupPoints(): iterable - { - return [ - $this->findPickupPoint(new PickupPointCode('', '', '')), - ]; - } -} diff --git a/tests/Behat/Page/Admin/ShippingMethod/CreatePage.php b/tests/Behat/Page/Admin/ShippingMethod/CreatePage.php deleted file mode 100644 index 24dfd97c..00000000 --- a/tests/Behat/Page/Admin/ShippingMethod/CreatePage.php +++ /dev/null @@ -1,15 +0,0 @@ -getDocument()->selectFieldOption('sylius_shipping_method_pickupPointProvider', $providerCode); - } -} diff --git a/tests/Behat/Page/Admin/ShippingMethod/CreatePageInterface.php b/tests/Behat/Page/Admin/ShippingMethod/CreatePageInterface.php deleted file mode 100644 index 80153c08..00000000 --- a/tests/Behat/Page/Admin/ShippingMethod/CreatePageInterface.php +++ /dev/null @@ -1,12 +0,0 @@ -getDocument()->waitFor(15, function () use ($shippingMethod) { - return $this->hasElement('shipping_method_select', [ - '%shipping_method%' => $shippingMethod, - ]); - }), sprintf('Unable to find shipping method %s', $shippingMethod)); - - // @todo Fix proper way? - sleep(1); // Workaround to render shipping method - - $this->selectShippingMethod($shippingMethod); - - Assert::true($this->getDocument()->waitFor(15, function () { - return $this->hasElement('pickup_point_field'); - }), "Pickup point field expected to be visible, but it isn't"); - } - - public function chooseFirstShippingPointFromRadio(): void - { - $expectedFirstOptionValue = 'faker---0---US'; - - Assert::true($this->hasElement('pickup_point_field')); - - Assert::true($this->getDocument()->waitFor(15, function () { - return $this->hasElement('pickup_point_radios'); - }), 'Pickup point radios area not visible'); - - $this->getElement('pickup_point_radio_item', [ - '%value%' => $expectedFirstOptionValue, - ])->click(); - } - - protected function getDefinedElements(): array - { - return array_merge(parent::getDefinedElements(), [ - 'pickup_point_field' => '.setono-sylius-pickup-point-field:not([style*="display: none"])', - 'pickup_point_radios' => '.setono-sylius-pickup-point-field-choices:not([style*="display: none"])', - - // Workaround: Unable to click radio item as semantic ui hide it and we can click only label - // 'pickup_point_radio_item' => '.setono-sylius-pickup-point-field-choice-field[value="%value%"]', - 'pickup_point_radio_item' => '[for="sylius_checkout_select_shipping_shipments_0_pickupPointId_%value%"]', - ]); - } -} diff --git a/tests/Behat/Page/Shop/ShippingPickup/SelectShippingPageInterface.php b/tests/Behat/Page/Shop/ShippingPickup/SelectShippingPageInterface.php deleted file mode 100644 index 6c5967c4..00000000 --- a/tests/Behat/Page/Shop/ShippingPickup/SelectShippingPageInterface.php +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/Behat/Resources/suites.yml b/tests/Behat/Resources/suites.yml deleted file mode 100644 index 2fe3179f..00000000 --- a/tests/Behat/Resources/suites.yml +++ /dev/null @@ -1,51 +0,0 @@ -default: - suites: - ui_shipping: - contexts: - - sylius.behat.context.hook.doctrine_orm - - - sylius.behat.context.transform.address - - sylius.behat.context.transform.lexical - - sylius.behat.context.transform.product - - sylius.behat.context.transform.shipping_method - - - sylius.behat.context.setup.channel - - sylius.behat.context.setup.product - - sylius.behat.context.setup.shipping - - sylius.behat.context.setup.payment - - - setono_sylius_pickup_point.behat.context.setup.shipping_method - - - sylius.behat.context.ui.shop.cart - - sylius.behat.context.ui.shop.checkout - - sylius.behat.context.ui.shop.checkout.addressing - - sylius.behat.context.ui.shop.checkout.payment - - sylius.behat.context.ui.shop.checkout.shipping - - sylius.behat.context.ui.shop.currency - - sylius.behat.context.ui.shop.checkout.complete - - - sylius.behat.context.transform.channel - - - setono_sylius_pickup_point.behat.context.ui.shop.shipping - filters: - tags: "@shop_shipping_pickup" - - admin_shipping: - contexts: - - sylius.behat.context.hook.doctrine_orm - - - sylius.behat.context.setup.channel - - sylius.behat.context.setup.admin_security - - sylius.behat.context.setup.shipping - - sylius.behat.context.setup.locale - - sylius.behat.context.setup.zone - - - sylius.behat.context.transform.channel - - sylius.behat.context.transform.locale - - - sylius.behat.context.ui.admin.managing_shipping_methods - - sylius.behat.context.ui.admin.notification - - - setono_sylius_pickup_point.behat.context.ui.admin.shipping - filters: - tags: "@managing_shipping_providers" diff --git a/tests/Application/config/routes.yaml b/tests/Functional/.gitignore similarity index 100% rename from tests/Application/config/routes.yaml rename to tests/Functional/.gitignore diff --git a/tests/Functional/Admin/AdminPickupPointPagesTest.php b/tests/Functional/Admin/AdminPickupPointPagesTest.php new file mode 100644 index 00000000..75e79fef --- /dev/null +++ b/tests/Functional/Admin/AdminPickupPointPagesTest.php @@ -0,0 +1,107 @@ +logInAsAdmin($client); + + $order = $this->findOrderWithShipment(); + + $shipment = $order->getShipments()->first(); + self::assertInstanceOf(ShipmentInterface::class, $shipment); + + $pickupPoint = new PickupPoint(); + $pickupPoint->provider = 'faker'; + $pickupPoint->id = '42'; + $pickupPoint->name = 'Post office #42'; + $pickupPoint->address = 'Main Street 1'; + $pickupPoint->zipCode = '9000'; + $pickupPoint->city = 'Aalborg'; + $pickupPoint->country = 'DK'; + $shipment->setPickupPoint($pickupPoint); + + /** @var EntityManagerInterface $manager */ + $manager = self::getContainer()->get('doctrine.orm.entity_manager'); + $manager->flush(); + + $client->request('GET', '/admin/orders/' . $order->getId()); + + self::assertResponseIsSuccessful(); + self::assertSelectorTextContains('.setono-sylius-pickup-point-label', 'Post office #42'); + } + + public function testTheShippingMethodFormRendersThePickupPointProviderField(): void + { + $client = self::createClient(); + $this->logInAsAdmin($client); + + $shippingMethod = $this->repository('sylius.repository.shipping_method')->findOneBy([]); + self::assertInstanceOf(ShippingMethodInterface::class, $shippingMethod); + + $client->request('GET', '/admin/shipping-methods/' . $shippingMethod->getId() . '/edit'); + + self::assertResponseIsSuccessful(); + self::assertSelectorExists('[name*="pickupPointProvider"]'); + } + + private function logInAsAdmin(KernelBrowser $client): void + { + $admin = $this->repository('sylius.repository.admin_user')->findOneBy([]); + self::assertInstanceOf(UserInterface::class, $admin, 'No admin user found — were the test fixtures loaded?'); + + $client->loginUser($admin, 'admin'); + } + + private function findOrderWithShipment(): OrderInterface + { + foreach ($this->repository('sylius.repository.order')->findBy([], null, 100) as $order) { + if ($order instanceof OrderInterface && !$order->getShipments()->isEmpty()) { + return $order; + } + } + + self::fail('No order with a shipment found — were the test fixtures loaded?'); + } + + private function repository(string $id): ObjectRepository + { + $repository = self::getContainer()->get($id); + self::assertInstanceOf(ObjectRepository::class, $repository); + + return $repository; + } +} diff --git a/tests/PHPStan/console_application.php b/tests/PHPStan/console_application.php new file mode 100644 index 00000000..af503bdc --- /dev/null +++ b/tests/PHPStan/console_application.php @@ -0,0 +1,13 @@ +boot(); + +return new Application($kernel); diff --git a/tests/Provider/LocalProviderTest.php b/tests/Provider/LocalProviderTest.php deleted file mode 100644 index 237e4c64..00000000 --- a/tests/Provider/LocalProviderTest.php +++ /dev/null @@ -1,123 +0,0 @@ -getProvider(); - self::assertSame('faker', $provider->getCode()); - } - - /** - * @test - */ - public function it_gets_name_from_decorated_provider(): void - { - $provider = $this->getProvider(); - self::assertSame('Faker', $provider->getName()); - } - - /** - * @test - */ - public function it_uses_local_provider_if_decorated_timeouts(): void - { - $order = $this->prophesize(OrderInterface::class); - - $pickupPoint = new PickupPoint(); - $pickupPoint->setCode(new PickupPointCode('123', 'gls', 'DK')); - $pickupPoint->setName('Service Point'); - $pickupPoint->setAddress('Street 123'); - $pickupPoint->setZipCode('1235A'); - $pickupPoint->setCity('Great City'); - $pickupPoint->setCountry('DK'); - - $repository = $this->prophesize(PickupPointRepositoryInterface::class); - $repository->findByOrder($order, 'timeout_provider')->willReturn([$pickupPoint]); - - $provider = $this->getProvider(true, $repository->reveal()); - - $pickupPoints = $provider->findPickupPoints($order->reveal()); - - self::assertNotEmpty($pickupPoints); - self::assertSame($pickupPoint, self::getFirstElementOfIterable($pickupPoints)); - } - - private function getProvider(bool $timeout = false, PickupPointRepositoryInterface $pickupPointRepository = null): LocalProvider - { - $pickupPointFactory = new Factory(PickupPoint::class); - - $provider = new FakerProvider($pickupPointFactory); - if ($timeout) { - $provider = new class() implements ProviderInterface { - public function __toString(): string - { - return $this->getName(); - } - - public function getCode(): string - { - return 'timeout_provider'; - } - - public function getName(): string - { - return 'Timeout provider'; - } - - public function findPickupPoints(OrderInterface $order): iterable - { - throw new TimeoutException(); - } - - public function findPickupPoint(PickupPointCode $code): ?PickupPointInterface - { - throw new TimeoutException(); - } - - public function findAllPickupPoints(): iterable - { - throw new TimeoutException(); - } - }; - } - - if (null === $pickupPointRepository) { - $repository = $this->prophesize(PickupPointRepositoryInterface::class); - $pickupPointRepository = $repository->reveal(); - } - - return new LocalProvider($provider, $pickupPointRepository); - } - - private static function getFirstElementOfIterable(iterable $list) - { - foreach ($list as $elm) { - return $elm; - } - - throw new \InvalidArgumentException('No elements in $list'); - } -} diff --git a/tests/Unit/DTO/PickupPointIdentifierTest.php b/tests/Unit/DTO/PickupPointIdentifierTest.php new file mode 100644 index 00000000..82da856e --- /dev/null +++ b/tests/Unit/DTO/PickupPointIdentifierTest.php @@ -0,0 +1,96 @@ +provider = 'gls'; + $pickupPoint->id = '12345'; + $pickupPoint->country = 'DK'; + $pickupPoint->metadata = ['region' => 'north']; + + $identifier = PickupPointIdentifier::fromPickupPoint($pickupPoint); + + self::assertNotNull($identifier); + self::assertSame('gls', $identifier->provider); + self::assertSame('12345', $identifier->id); + // the first-class country property travels inside the identifier's metadata + self::assertSame(['country' => 'DK', 'region' => 'north'], $identifier->metadata); + } + + public function testItReturnsNullWhenProviderIsMissing(): void + { + $pickupPoint = new PickupPoint(); + $pickupPoint->id = '12345'; + + self::assertNull(PickupPointIdentifier::fromPickupPoint($pickupPoint)); + } + + public function testItReturnsNullWhenIdIsMissing(): void + { + $pickupPoint = new PickupPoint(); + $pickupPoint->provider = 'gls'; + + self::assertNull(PickupPointIdentifier::fromPickupPoint($pickupPoint)); + } + + public function testItBuildsFromAnArray(): void + { + $identifier = PickupPointIdentifier::fromArray([ + 'provider' => 'gls', + 'id' => '12345', + 'metadata' => ['country' => 'DK'], + ]); + + self::assertSame('gls', $identifier->provider); + self::assertSame('12345', $identifier->id); + self::assertSame(['country' => 'DK'], $identifier->metadata); + } + + public function testFromArrayDefaultsMetadataToAnEmptyArray(): void + { + $identifier = PickupPointIdentifier::fromArray(['provider' => 'gls', 'id' => '12345']); + + self::assertSame([], $identifier->metadata); + } + + public function testFromArrayThrowsWhenProviderIsMissing(): void + { + $this->expectException(\InvalidArgumentException::class); + + PickupPointIdentifier::fromArray(['id' => '12345']); + } + + public function testFromArrayThrowsWhenIdIsMissing(): void + { + $this->expectException(\InvalidArgumentException::class); + + PickupPointIdentifier::fromArray(['provider' => 'gls']); + } + + public function testItSerializesToTheWireShape(): void + { + $identifier = new PickupPointIdentifier('gls', '12345', ['country' => 'DK']); + + self::assertSame( + ['provider' => 'gls', 'id' => '12345', 'metadata' => ['country' => 'DK']], + $identifier->jsonSerialize(), + ); + } + + public function testFromArrayIsTheInverseOfJsonSerialize(): void + { + $identifier = new PickupPointIdentifier('gls', '12345', ['country' => 'DK', 'region' => 'north']); + + self::assertEquals($identifier, PickupPointIdentifier::fromArray($identifier->jsonSerialize())); + } +} diff --git a/tests/Unit/DTO/PickupPointTest.php b/tests/Unit/DTO/PickupPointTest.php new file mode 100644 index 00000000..54826c8a --- /dev/null +++ b/tests/Unit/DTO/PickupPointTest.php @@ -0,0 +1,48 @@ + 'gls', + 'id' => '12345', + 'name' => 'Post office', + 'address' => 'Some street 1', + 'zipCode' => '9000', + 'city' => 'Aalborg', + 'country' => 'DK', + 'latitude' => '57.0', + 'longitude' => '9.9', + 'metadata' => ['region' => 'north', 'warehouse' => 7], + ]; + + $pickupPoint = PickupPoint::fromArray($data); + + self::assertSame('DK', $pickupPoint->country); + self::assertSame(['region' => 'north', 'warehouse' => 7], $pickupPoint->metadata); + self::assertSame($data, $pickupPoint->jsonSerialize()); + } + + public function testItDefaultsCountryAndMetadataWhenAbsent(): void + { + $pickupPoint = PickupPoint::fromArray(['provider' => 'gls', 'id' => '1']); + + self::assertNull($pickupPoint->country); + self::assertSame([], $pickupPoint->metadata); + } + + public function testItDefaultsMetadataToAnEmptyArrayWhenItIsNotAnArray(): void + { + $pickupPoint = PickupPoint::fromArray(['provider' => 'gls', 'id' => '1', 'metadata' => 'not-an-array']); + + self::assertSame([], $pickupPoint->metadata); + } +} diff --git a/tests/DependencyInjection/SetonoSyliusPickupPointExtensionTest.php b/tests/Unit/DependencyInjection/SetonoSyliusPickupPointExtensionTest.php similarity index 59% rename from tests/DependencyInjection/SetonoSyliusPickupPointExtensionTest.php rename to tests/Unit/DependencyInjection/SetonoSyliusPickupPointExtensionTest.php index 4b5ce4b5..097c8456 100644 --- a/tests/DependencyInjection/SetonoSyliusPickupPointExtensionTest.php +++ b/tests/Unit/DependencyInjection/SetonoSyliusPickupPointExtensionTest.php @@ -2,23 +2,19 @@ declare(strict_types=1); -namespace Setono\SyliusPickupPointPlugin\Tests\DependencyInjection; +namespace Setono\SyliusPickupPointPlugin\Tests\Unit\DependencyInjection; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; use Setono\SyliusPickupPointPlugin\DependencyInjection\SetonoSyliusPickupPointExtension; +use Setono\SyliusPickupPointPlugin\Registry\ProviderRegistry; final class SetonoSyliusPickupPointExtensionTest extends AbstractExtensionTestCase { protected function getMinimalConfiguration(): array { return [ - 'cache' => [ - 'enabled' => false, - ], 'providers' => [ 'faker' => false, - 'budbee' => false, - 'coolrunner' => false, 'dao' => false, 'gls' => false, 'post_nord' => false, @@ -33,14 +29,10 @@ protected function getContainerExtensions(): array ]; } - /** - * @test - */ - public function after_loading_the_correct_parameters_has_been_set(): void + public function testItRegistersTheProviderRegistry(): void { $this->load(); - $this->assertContainerBuilderHasParameter('setono_sylius_pickup_point.local', true); - $this->assertContainerBuilderHasParameter('setono_sylius_pickup_point.cache.enabled', false); + $this->assertContainerBuilderHasService(ProviderRegistry::class); } } diff --git a/tests/Unit/Encoder/PickupPointEncoderTest.php b/tests/Unit/Encoder/PickupPointEncoderTest.php new file mode 100644 index 00000000..7a607018 --- /dev/null +++ b/tests/Unit/Encoder/PickupPointEncoderTest.php @@ -0,0 +1,71 @@ +encoder = new PickupPointEncoder(); + } + + public function testItRoundTripsAFullPickupPoint(): void + { + $pickupPoint = new PickupPoint(); + $pickupPoint->provider = 'faker'; + $pickupPoint->id = '0'; + $pickupPoint->name = 'Post office #0'; + $pickupPoint->address = 'Main Street 1'; + $pickupPoint->zipCode = '9000'; + $pickupPoint->city = 'Aalborg'; + $pickupPoint->country = 'DK'; + $pickupPoint->latitude = '57.0488'; + $pickupPoint->longitude = '9.9217'; + $pickupPoint->metadata = ['warehouse' => '42']; + + self::assertEquals($pickupPoint, $this->encoder->decode($this->encoder->encode($pickupPoint))); + } + + public function testItProducesAUrlSafeTokenEvenForNonAsciiData(): void + { + $pickupPoint = new PickupPoint(); + $pickupPoint->name = 'Æøå Pakkeshop café'; + + self::assertSame(1, preg_match('/^[A-Za-z0-9\-_]+$/', $this->encoder->encode($pickupPoint))); + } + + public function testItThrowsEncodingANonUtf8String(): void + { + $pickupPoint = new PickupPoint(); + $pickupPoint->name = "\xFF"; // not valid UTF-8, so json_encode cannot serialize it + + $this->expectException(\JsonException::class); + + $this->encoder->encode($pickupPoint); + } + + public function testItThrowsDecodingInvalidBase64(): void + { + $this->expectException(InvalidArgumentException::class); + + $this->encoder->decode('!!! not base64 !!!'); + } + + public function testItThrowsDecodingATokenThatIsNotAnObject(): void + { + $token = rtrim(strtr(base64_encode('123'), '+/', '-_'), '='); + + $this->expectException(InvalidArgumentException::class); + + $this->encoder->decode($token); + } +} diff --git a/tests/Unit/Encoder/PickupPointIdentifierEncoderTest.php b/tests/Unit/Encoder/PickupPointIdentifierEncoderTest.php new file mode 100644 index 00000000..0a14cef6 --- /dev/null +++ b/tests/Unit/Encoder/PickupPointIdentifierEncoderTest.php @@ -0,0 +1,75 @@ +encoder = new PickupPointIdentifierEncoder(); + } + + public function testItRoundTripsAnIdentifier(): void + { + $decoded = $this->encoder->decode( + $this->encoder->encode(new PickupPointIdentifier('gls', '12345', ['country' => 'DK'])), + ); + + self::assertSame('gls', $decoded->provider); + self::assertSame('12345', $decoded->id); + self::assertSame(['country' => 'DK'], $decoded->metadata); + } + + public function testItRoundTripsArbitraryMetadata(): void + { + $metadata = ['country' => 'DK', 'region' => 'north', 'warehouse' => 7]; + + $decoded = $this->encoder->decode( + $this->encoder->encode(new PickupPointIdentifier('acme', 'a-b/c', $metadata)), + ); + + self::assertSame('acme', $decoded->provider); + self::assertSame('a-b/c', $decoded->id); + self::assertSame($metadata, $decoded->metadata); + } + + public function testItProducesAUrlSafeToken(): void + { + $token = $this->encoder->encode(new PickupPointIdentifier('gls', '12345', ['country' => 'DK'])); + + self::assertSame(1, preg_match('/^[A-Za-z0-9\-_]+$/', $token)); + } + + public function testItDefaultsToEmptyMetadata(): void + { + $decoded = $this->encoder->decode($this->encoder->encode(new PickupPointIdentifier('gls', '12345'))); + + self::assertSame([], $decoded->metadata); + } + + public function testItThrowsWhenDecodingAMalformedToken(): void + { + $this->expectException(InvalidArgumentException::class); + + $this->encoder->decode('!!! not base64 or json !!!'); + } + + public function testItThrowsWhenTheTokenLacksProviderAndId(): void + { + $json = json_encode(['foo' => 'bar'], \JSON_THROW_ON_ERROR); + $token = rtrim(strtr(base64_encode($json), '+/', '-_'), '='); + + $this->expectException(InvalidArgumentException::class); + + $this->encoder->decode($token); + } +} diff --git a/tests/Unit/Exception/NonUniqueProviderCodeExceptionTest.php b/tests/Unit/Exception/NonUniqueProviderCodeExceptionTest.php new file mode 100644 index 00000000..8182714c --- /dev/null +++ b/tests/Unit/Exception/NonUniqueProviderCodeExceptionTest.php @@ -0,0 +1,20 @@ +encoder = new PickupPointEncoder(); + } + + public function testItTransformsNullToNull(): void + { + self::assertNull($this->transformer()->transform(null)); + } + + public function testItThrowsTransformingANonPickupPoint(): void + { + $this->expectException(TransformationFailedException::class); + + $this->transformer()->transform('not a pickup point'); + } + + public function testItTransformsAPickupPointToAToken(): void + { + $pickupPoint = new PickupPoint(); + $pickupPoint->provider = 'faker'; + $pickupPoint->id = '0'; + + self::assertSame($this->encoder->encode($pickupPoint), $this->transformer()->transform($pickupPoint)); + } + + public function testItReverseTransformsNullToNull(): void + { + self::assertNull($this->transformer()->reverseTransform(null)); + } + + public function testItReverseTransformsAnEmptyStringToNull(): void + { + self::assertNull($this->transformer()->reverseTransform('')); + } + + public function testItThrowsReverseTransformingANonString(): void + { + $this->expectException(TransformationFailedException::class); + + $this->transformer()->reverseTransform(123); + } + + public function testItThrowsReverseTransformingAMalformedToken(): void + { + $this->expectException(TransformationFailedException::class); + + $this->transformer()->reverseTransform('!!! not a valid token !!!'); + } + + public function testItReverseTransformsATokenBackToTheSamePickupPoint(): void + { + $pickupPoint = new PickupPoint(); + $pickupPoint->provider = 'faker'; + $pickupPoint->id = '0'; + $pickupPoint->name = 'Post office #0'; + $pickupPoint->city = 'Aalborg'; + + self::assertEquals( + $pickupPoint, + $this->transformer()->reverseTransform($this->encoder->encode($pickupPoint)), + ); + } + + private function transformer(): PickupPointTransformer + { + return new PickupPointTransformer($this->encoder); + } +} diff --git a/tests/Unit/Form/Extension/ShipmentTypeExtensionTest.php b/tests/Unit/Form/Extension/ShipmentTypeExtensionTest.php new file mode 100644 index 00000000..652870a4 --- /dev/null +++ b/tests/Unit/Form/Extension/ShipmentTypeExtensionTest.php @@ -0,0 +1,39 @@ +prophesize(FormBuilderInterface::class); + $builder->add('pickupPoint', PickupPointType::class, Argument::type('array')) + ->shouldBeCalled() + ->willReturn($builder->reveal()); + + (new ShipmentTypeExtension())->buildForm($builder->reveal(), []); + } +} diff --git a/tests/Unit/Form/Extension/ShippingMethodChoiceTypeExtensionTest.php b/tests/Unit/Form/Extension/ShippingMethodChoiceTypeExtensionTest.php new file mode 100644 index 00000000..6c5cba85 --- /dev/null +++ b/tests/Unit/Form/Extension/ShippingMethodChoiceTypeExtensionTest.php @@ -0,0 +1,71 @@ +createExtension()); + } + + public function testItExtendsShippingMethodChoiceType(): void + { + self::assertContains(ShippingMethodChoiceType::class, ShippingMethodChoiceTypeExtension::getExtendedTypes()); + } + + public function testItStampsTheProviderCodeOnPickupCapableMethods(): void + { + $registry = $this->prophesize(ProviderRegistryInterface::class); + $registry->has('faker')->willReturn(true); + + $method = $this->prophesize(PickupPointProviderAwareInterface::class); + $method->hasPickupPointProvider()->willReturn(true); + $method->getPickupPointProvider()->willReturn('faker'); + + self::assertSame( + ['data-pickup-point-provider' => 'faker'], + ($this->choiceAttr($registry->reveal()))($method->reveal()), + ); + } + + public function testItStampsNothingOnMethodsWithoutAProvider(): void + { + $method = $this->prophesize(PickupPointProviderAwareInterface::class); + $method->hasPickupPointProvider()->willReturn(false); + + self::assertSame([], ($this->choiceAttr($this->prophesize(ProviderRegistryInterface::class)->reveal()))($method->reveal())); + } + + private function createExtension(): ShippingMethodChoiceTypeExtension + { + return new ShippingMethodChoiceTypeExtension( + $this->prophesize(ProviderRegistryInterface::class)->reveal(), + ); + } + + private function choiceAttr(ProviderRegistryInterface $registry): callable + { + $resolver = new OptionsResolver(); + $resolver->setDefined('choice_attr'); + (new ShippingMethodChoiceTypeExtension($registry))->configureOptions($resolver); + + $choiceAttr = $resolver->resolve()['choice_attr']; + self::assertIsCallable($choiceAttr); + + return $choiceAttr; + } +} diff --git a/tests/Unit/Form/Extension/ShippingMethodTypeExtensionTest.php b/tests/Unit/Form/Extension/ShippingMethodTypeExtensionTest.php new file mode 100644 index 00000000..12995519 --- /dev/null +++ b/tests/Unit/Form/Extension/ShippingMethodTypeExtensionTest.php @@ -0,0 +1,32 @@ +prophesize(FormBuilderInterface::class); + $builder->add(Argument::type('string'), Argument::type('string'), Argument::any())->willReturn($builder->reveal()); + + $extension->buildForm($builder->reveal(), []); + } +} diff --git a/tests/Unit/Form/Type/PickupPointTypeTest.php b/tests/Unit/Form/Type/PickupPointTypeTest.php new file mode 100644 index 00000000..0a9aaea8 --- /dev/null +++ b/tests/Unit/Form/Type/PickupPointTypeTest.php @@ -0,0 +1,80 @@ +encoder = new PickupPointEncoder(); + + $this->point = new PickupPoint(); + $this->point->provider = 'faker'; + $this->point->id = '0'; + $this->point->name = 'Post office #0'; + $this->point->country = 'DK'; + + parent::setUp(); + } + + public function testSubmittingATokenDecodesToThePickupPoint(): void + { + $form = $this->factory->create(PickupPointType::class); + $form->submit($this->encoder->encode($this->point)); + + self::assertTrue($form->isSynchronized()); + self::assertEquals($this->point, $form->getData()); + } + + public function testAnExistingPickupPointRendersBackAsAToken(): void + { + $form = $this->factory->create(PickupPointType::class, $this->point); + + self::assertSame($this->encoder->encode($this->point), $form->getViewData()); + } + + public function testSubmittingAnEmptyValueResultsInNull(): void + { + $form = $this->factory->create(PickupPointType::class); + $form->submit(''); + + self::assertTrue($form->isSynchronized()); + self::assertNull($form->getData()); + } + + public function testSubmittingAMalformedTokenFailsTransformation(): void + { + $form = $this->factory->create(PickupPointType::class); + $form->submit('!!! not a valid token !!!'); + + self::assertFalse($form->isSynchronized()); + self::assertNull($form->getData()); + } + + protected function getExtensions(): array + { + return [ + new PreloadedExtension([ + new PickupPointType(new PickupPointTransformer($this->encoder)), + ], []), + ]; + } +} diff --git a/tests/Unit/Validator/Constraints/HasPickupPointSelectedTest.php b/tests/Unit/Validator/Constraints/HasPickupPointSelectedTest.php new file mode 100644 index 00000000..453ecc24 --- /dev/null +++ b/tests/Unit/Validator/Constraints/HasPickupPointSelectedTest.php @@ -0,0 +1,39 @@ +validatedBy(), + ); + } + + public function testItHasClassTarget(): void + { + self::assertSame(Constraint::CLASS_CONSTRAINT, (new HasPickupPointSelected())->getTargets()); + } + + public function testItHasMessage(): void + { + self::assertSame( + 'setono_pickup_point.shipment.pickup_point.not_blank', + (new HasPickupPointSelected())->pickupPointNotBlank, + ); + } +} diff --git a/tests/Unit/Validator/Constraints/HasPickupPointSelectedValidatorTest.php b/tests/Unit/Validator/Constraints/HasPickupPointSelectedValidatorTest.php new file mode 100644 index 00000000..7f3d4a9a --- /dev/null +++ b/tests/Unit/Validator/Constraints/HasPickupPointSelectedValidatorTest.php @@ -0,0 +1,62 @@ +validator->validate($this->shipment(hasProvider: false, hasPickupPoint: false)->reveal(), new HasPickupPointSelected()); + + $this->assertNoViolation(); + } + + public function testItDoesNotViolateWhenAPickupPointIsSelected(): void + { + $this->validator->validate($this->shipment(hasProvider: true, hasPickupPoint: true)->reveal(), new HasPickupPointSelected()); + + $this->assertNoViolation(); + } + + public function testItViolatesWhenTheProviderIsSetButNoPickupPointIsSelected(): void + { + $constraint = new HasPickupPointSelected(); + + $this->validator->validate($this->shipment(hasProvider: true, hasPickupPoint: false)->reveal(), $constraint); + + $this->buildViolation($constraint->pickupPointNotBlank)->assertRaised(); + } + + protected function createValidator(): ConstraintValidatorInterface + { + return new HasPickupPointSelectedValidator(); + } + + /** + * @return ObjectProphecy + */ + private function shipment(bool $hasProvider, bool $hasPickupPoint): ObjectProphecy + { + $method = $this->prophesize(ShippingMethodInterface::class); + $method->hasPickupPointProvider()->willReturn($hasProvider); + + $shipment = $this->prophesize(ShipmentInterface::class); + $shipment->getMethod()->willReturn($method->reveal()); + $shipment->hasPickupPoint()->willReturn($hasPickupPoint); + + return $shipment; + } +} diff --git a/translations/messages.cs.yml b/translations/messages.cs.yml new file mode 100644 index 00000000..c8f95f18 --- /dev/null +++ b/translations/messages.cs.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Na výdejní místo + loading_pickup_points: Načítání výdejních míst… + no_pickup_points: Pro zadanou adresu nejsou k dispozici žádná výdejní místa. + error_loading_pickup_points: Výdejní místa se nepodařilo načíst. Zkuste prosím znovu vybrat způsob dopravy. + change: Změnit + keep_this: Ponechat toto + currently: 'Aktuálně:' + selected: Vybráno + form: + shipment: + pickup_point: Výdejní místo + select_pickup_point: Vyberte výdejní místo + shipping_method: + pickup_point_provider: Poskytovatel výdejního místa + select_pickup_point_provider: Vyberte poskytovatele výdejního místa diff --git a/translations/messages.da.yml b/translations/messages.da.yml new file mode 100644 index 00000000..26997da8 --- /dev/null +++ b/translations/messages.da.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Til afhentningssted + loading_pickup_points: Henter afhentningssteder… + no_pickup_points: Der er ingen afhentningssteder for den indtastede adresse. + error_loading_pickup_points: Vi kunne ikke hente afhentningsstederne. Prøv at vælge leveringsmetoden igen. + change: Skift + keep_this: Behold denne + currently: 'Nuværende:' + selected: Valgt + form: + shipment: + pickup_point: Afhentningssted + select_pickup_point: Vælg afhentningssted + shipping_method: + pickup_point_provider: Afhentningsudbyder + select_pickup_point_provider: Vælg afhentningsudbyder diff --git a/translations/messages.de.yml b/translations/messages.de.yml new file mode 100644 index 00000000..c4d65be6 --- /dev/null +++ b/translations/messages.de.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: An Abholstation + loading_pickup_points: Abholstationen werden geladen… + no_pickup_points: Für die angegebene Adresse sind keine Abholstationen verfügbar. + error_loading_pickup_points: Die Abholstationen konnten nicht geladen werden. Bitte wählen Sie die Versandart erneut aus. + change: Ändern + keep_this: Beibehalten + currently: 'Aktuell:' + selected: Ausgewählt + form: + shipment: + pickup_point: Abholstation + select_pickup_point: Abholstation auswählen + shipping_method: + pickup_point_provider: Anbieter der Abholstation + select_pickup_point_provider: Anbieter der Abholstation auswählen diff --git a/translations/messages.en.yml b/translations/messages.en.yml new file mode 100644 index 00000000..bdda6e47 --- /dev/null +++ b/translations/messages.en.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: To pickup point + loading_pickup_points: Loading pickup points… + no_pickup_points: No pickup points are available for the entered address. + error_loading_pickup_points: We could not load the pickup points. Please try selecting the shipping method again. + change: Change + keep_this: Keep this + currently: 'Currently:' + selected: Selected + form: + shipment: + pickup_point: Pickup point + select_pickup_point: Select pickup point + shipping_method: + pickup_point_provider: Pickup point provider + select_pickup_point_provider: Select pickup point provider diff --git a/translations/messages.es.yml b/translations/messages.es.yml new file mode 100644 index 00000000..0e9ce4fc --- /dev/null +++ b/translations/messages.es.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Al punto de recogida + loading_pickup_points: Cargando puntos de recogida… + no_pickup_points: No hay puntos de recogida disponibles para la dirección introducida. + error_loading_pickup_points: No hemos podido cargar los puntos de recogida. Inténtalo seleccionando de nuevo el método de envío. + change: Cambiar + keep_this: Mantener este + currently: 'Actual:' + selected: Seleccionado + form: + shipment: + pickup_point: Punto de recogida + select_pickup_point: Seleccionar punto de recogida + shipping_method: + pickup_point_provider: Proveedor de punto de recogida + select_pickup_point_provider: Seleccionar proveedor de punto de recogida diff --git a/translations/messages.fi.yml b/translations/messages.fi.yml new file mode 100644 index 00000000..e041689b --- /dev/null +++ b/translations/messages.fi.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Noutopisteeseen + loading_pickup_points: Ladataan noutopisteitä… + no_pickup_points: Annetulle osoitteelle ei ole saatavilla noutopisteitä. + error_loading_pickup_points: Noutopisteiden lataaminen epäonnistui. Yritä valita toimitustapa uudelleen. + change: Vaihda + keep_this: Pidä tämä + currently: 'Nykyinen:' + selected: Valittu + form: + shipment: + pickup_point: Noutopiste + select_pickup_point: Valitse noutopiste + shipping_method: + pickup_point_provider: Noutopisteen palveluntarjoaja + select_pickup_point_provider: Valitse noutopisteen palveluntarjoaja diff --git a/translations/messages.fr.yml b/translations/messages.fr.yml new file mode 100644 index 00000000..f8ac9058 --- /dev/null +++ b/translations/messages.fr.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Vers le point de retrait + loading_pickup_points: Chargement des points de retrait… + no_pickup_points: Aucun point de retrait n'est disponible pour l'adresse saisie. + error_loading_pickup_points: Nous n'avons pas pu charger les points de retrait. Veuillez sélectionner à nouveau le mode de livraison. + change: Modifier + keep_this: Conserver + currently: 'Actuel :' + selected: Sélectionné + form: + shipment: + pickup_point: Point de retrait + select_pickup_point: Sélectionner un point de retrait + shipping_method: + pickup_point_provider: Fournisseur de point de retrait + select_pickup_point_provider: Sélectionner un fournisseur de point de retrait diff --git a/translations/messages.hu.yml b/translations/messages.hu.yml new file mode 100644 index 00000000..8d1a636b --- /dev/null +++ b/translations/messages.hu.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Átvételi pontra + loading_pickup_points: Átvételi pontok betöltése… + no_pickup_points: A megadott címhez nem érhetők el átvételi pontok. + error_loading_pickup_points: Nem sikerült betölteni az átvételi pontokat. Kérjük, válassza ki újra a szállítási módot. + change: Módosítás + keep_this: Ennek megtartása + currently: 'Jelenleg:' + selected: Kiválasztva + form: + shipment: + pickup_point: Átvételi pont + select_pickup_point: Válasszon átvételi pontot + shipping_method: + pickup_point_provider: Átvételi pont szolgáltatója + select_pickup_point_provider: Válassza ki az átvételi pont szolgáltatóját diff --git a/translations/messages.it.yml b/translations/messages.it.yml new file mode 100644 index 00000000..a4ec01d6 --- /dev/null +++ b/translations/messages.it.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Al punto di ritiro + loading_pickup_points: Caricamento dei punti di ritiro… + no_pickup_points: Non sono disponibili punti di ritiro per l'indirizzo inserito. + error_loading_pickup_points: Non è stato possibile caricare i punti di ritiro. Prova a selezionare di nuovo il metodo di spedizione. + change: Modifica + keep_this: Mantieni questo + currently: 'Attuale:' + selected: Selezionato + form: + shipment: + pickup_point: Punto di ritiro + select_pickup_point: Seleziona un punto di ritiro + shipping_method: + pickup_point_provider: Fornitore del punto di ritiro + select_pickup_point_provider: Seleziona un fornitore del punto di ritiro diff --git a/translations/messages.nl.yml b/translations/messages.nl.yml new file mode 100644 index 00000000..19e317ed --- /dev/null +++ b/translations/messages.nl.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Naar afhaalpunt + loading_pickup_points: Afhaalpunten laden… + no_pickup_points: Er zijn geen afhaalpunten beschikbaar voor het ingevoerde adres. + error_loading_pickup_points: We konden de afhaalpunten niet laden. Selecteer de verzendmethode opnieuw. + change: Wijzigen + keep_this: Deze behouden + currently: 'Huidig:' + selected: Geselecteerd + form: + shipment: + pickup_point: Afhaalpunt + select_pickup_point: Selecteer een afhaalpunt + shipping_method: + pickup_point_provider: Afhaalpuntaanbieder + select_pickup_point_provider: Selecteer een afhaalpuntaanbieder diff --git a/translations/messages.no.yml b/translations/messages.no.yml new file mode 100644 index 00000000..b1c70600 --- /dev/null +++ b/translations/messages.no.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Til hentested + loading_pickup_points: Henter hentesteder… + no_pickup_points: Det finnes ingen hentesteder for den oppgitte adressen. + error_loading_pickup_points: Vi kunne ikke hente hentestedene. Prøv å velge leveringsmetode på nytt. + change: Endre + keep_this: Behold dette + currently: 'Nåværende:' + selected: Valgt + form: + shipment: + pickup_point: Hentested + select_pickup_point: Velg hentested + shipping_method: + pickup_point_provider: Leverandør av hentested + select_pickup_point_provider: Velg leverandør av hentested diff --git a/translations/messages.pl.yml b/translations/messages.pl.yml new file mode 100644 index 00000000..bb8c671e --- /dev/null +++ b/translations/messages.pl.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Do punktu odbioru + loading_pickup_points: Ładowanie punktów odbioru… + no_pickup_points: Brak dostępnych punktów odbioru dla podanego adresu. + error_loading_pickup_points: Nie udało się załadować punktów odbioru. Spróbuj ponownie wybrać metodę dostawy. + change: Zmień + keep_this: Zachowaj ten + currently: 'Obecnie:' + selected: Wybrany + form: + shipment: + pickup_point: Punkt odbioru + select_pickup_point: Wybierz punkt odbioru + shipping_method: + pickup_point_provider: Dostawca punktu odbioru + select_pickup_point_provider: Wybierz dostawcę punktu odbioru diff --git a/translations/messages.pt.yml b/translations/messages.pt.yml new file mode 100644 index 00000000..3af00044 --- /dev/null +++ b/translations/messages.pt.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Para o ponto de recolha + loading_pickup_points: A carregar pontos de recolha… + no_pickup_points: Não há pontos de recolha disponíveis para a morada introduzida. + error_loading_pickup_points: Não foi possível carregar os pontos de recolha. Tente selecionar novamente o método de envio. + change: Alterar + keep_this: Manter este + currently: 'Atual:' + selected: Selecionado + form: + shipment: + pickup_point: Ponto de recolha + select_pickup_point: Selecionar ponto de recolha + shipping_method: + pickup_point_provider: Fornecedor de ponto de recolha + select_pickup_point_provider: Selecionar fornecedor de ponto de recolha diff --git a/translations/messages.ro.yml b/translations/messages.ro.yml new file mode 100644 index 00000000..e3daccb1 --- /dev/null +++ b/translations/messages.ro.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Către punctul de ridicare + loading_pickup_points: Se încarcă punctele de ridicare… + no_pickup_points: Nu există puncte de ridicare disponibile pentru adresa introdusă. + error_loading_pickup_points: Nu am putut încărca punctele de ridicare. Încercați să selectați din nou metoda de livrare. + change: Modifică + keep_this: Păstrează acesta + currently: 'În prezent:' + selected: Selectat + form: + shipment: + pickup_point: Punct de ridicare + select_pickup_point: Selectați un punct de ridicare + shipping_method: + pickup_point_provider: Furnizor de puncte de ridicare + select_pickup_point_provider: Selectați un furnizor de puncte de ridicare diff --git a/translations/messages.sv.yml b/translations/messages.sv.yml new file mode 100644 index 00000000..65cdc741 --- /dev/null +++ b/translations/messages.sv.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: Till utlämningsställe + loading_pickup_points: Hämtar utlämningsställen… + no_pickup_points: Det finns inga utlämningsställen för den angivna adressen. + error_loading_pickup_points: Vi kunde inte hämta utlämningsställena. Försök att välja leveranssätt igen. + change: Ändra + keep_this: Behåll detta + currently: 'Nuvarande:' + selected: Vald + form: + shipment: + pickup_point: Utlämningsställe + select_pickup_point: Välj utlämningsställe + shipping_method: + pickup_point_provider: Leverantör av utlämningsställe + select_pickup_point_provider: Välj leverantör av utlämningsställe diff --git a/translations/messages.uk.yml b/translations/messages.uk.yml new file mode 100644 index 00000000..623f401f --- /dev/null +++ b/translations/messages.uk.yml @@ -0,0 +1,17 @@ +setono_sylius_pickup_point: + ui: + shipment_to: До пункту видачі + loading_pickup_points: Завантаження пунктів видачі… + no_pickup_points: Для вказаної адреси немає доступних пунктів видачі. + error_loading_pickup_points: Не вдалося завантажити пункти видачі. Спробуйте ще раз вибрати спосіб доставки. + change: Змінити + keep_this: Залишити цей + currently: 'Зараз:' + selected: Вибрано + form: + shipment: + pickup_point: Пункт видачі + select_pickup_point: Виберіть пункт видачі + shipping_method: + pickup_point_provider: Постачальник пункту видачі + select_pickup_point_provider: Виберіть постачальника пункту видачі diff --git a/translations/validators.cs.yml b/translations/validators.cs.yml new file mode 100644 index 00000000..1d56595b --- /dev/null +++ b/translations/validators.cs.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Výdejní místo nesmí být prázdné. diff --git a/src/Resources/translations/validators.da.yml b/translations/validators.da.yml similarity index 100% rename from src/Resources/translations/validators.da.yml rename to translations/validators.da.yml diff --git a/translations/validators.de.yml b/translations/validators.de.yml new file mode 100644 index 00000000..6ebb98d6 --- /dev/null +++ b/translations/validators.de.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Abholstation darf nicht leer sein. diff --git a/src/Resources/translations/validators.en.yml b/translations/validators.en.yml similarity index 100% rename from src/Resources/translations/validators.en.yml rename to translations/validators.en.yml diff --git a/translations/validators.es.yml b/translations/validators.es.yml new file mode 100644 index 00000000..66ed27d3 --- /dev/null +++ b/translations/validators.es.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: El punto de recogida no puede estar vacío. diff --git a/translations/validators.fi.yml b/translations/validators.fi.yml new file mode 100644 index 00000000..c6070056 --- /dev/null +++ b/translations/validators.fi.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Noutopiste ei voi olla tyhjä. diff --git a/translations/validators.fr.yml b/translations/validators.fr.yml new file mode 100644 index 00000000..0af0db4b --- /dev/null +++ b/translations/validators.fr.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Le point de retrait ne peut pas être vide. diff --git a/translations/validators.hu.yml b/translations/validators.hu.yml new file mode 100644 index 00000000..9102b492 --- /dev/null +++ b/translations/validators.hu.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Az átvételi pont nem lehet üres. diff --git a/translations/validators.it.yml b/translations/validators.it.yml new file mode 100644 index 00000000..93a0d120 --- /dev/null +++ b/translations/validators.it.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Il punto di ritiro non può essere vuoto. diff --git a/translations/validators.nl.yml b/translations/validators.nl.yml new file mode 100644 index 00000000..290c1349 --- /dev/null +++ b/translations/validators.nl.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Afhaalpunt mag niet leeg zijn. diff --git a/translations/validators.no.yml b/translations/validators.no.yml new file mode 100644 index 00000000..9da67923 --- /dev/null +++ b/translations/validators.no.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Hentested kan ikke være tomt. diff --git a/translations/validators.pl.yml b/translations/validators.pl.yml new file mode 100644 index 00000000..f635b81a --- /dev/null +++ b/translations/validators.pl.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Punkt odbioru nie może być pusty. diff --git a/translations/validators.pt.yml b/translations/validators.pt.yml new file mode 100644 index 00000000..a0e977cf --- /dev/null +++ b/translations/validators.pt.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: O ponto de recolha não pode estar vazio. diff --git a/translations/validators.ro.yml b/translations/validators.ro.yml new file mode 100644 index 00000000..86d182e0 --- /dev/null +++ b/translations/validators.ro.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Punctul de ridicare nu poate fi gol. diff --git a/translations/validators.sv.yml b/translations/validators.sv.yml new file mode 100644 index 00000000..81434a63 --- /dev/null +++ b/translations/validators.sv.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Utlämningsställe får inte vara tomt. diff --git a/translations/validators.uk.yml b/translations/validators.uk.yml new file mode 100644 index 00000000..750dd4ef --- /dev/null +++ b/translations/validators.uk.yml @@ -0,0 +1,4 @@ +setono_pickup_point: + shipment: + pickup_point: + not_blank: Пункт видачі не може бути порожнім.