From 1d313a5c04723c99cc6b673703702e374d73163a Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Wed, 7 Jan 2026 18:59:43 +0100 Subject: [PATCH 01/28] WIP - update to sylius 2.0 --- .docker/nginx/nginx.conf | 48 ------- .docker/php/php.ini | 5 - .github/CODEOWNERS | 1 - .github/actions/roave-bc-check/Dockerfile | 12 -- .github/actions/roave-bc-check/action.yml | 5 - .github/workflows/build.yml | 102 ++++++++------ .gitignore | 10 +- Makefile | 79 +++++++---- README.md | 57 +++++--- assets/admin/controllers.json | 4 + .../.gitignore => assets/admin/entrypoint.js | 0 assets/shop/controllers.json | 4 + .../.gitignore => assets/shop/entrypoint.js | 0 behat.yml.dist | 7 +- bin/create_node_symlink.php | 45 ------- compose.yml | 24 ++++ composer.json | 120 ++++++++++------- config/config.yaml | 2 + config/services.yaml | 2 + config/services/services.yaml | 25 ++++ .../prod => config/twig_hooks}/.gitignore | 0 docker-compose.yml | 42 ------ ecs.php | 6 + phpstan.neon | 7 +- phpunit.xml.dist | 42 ++++-- psalm.xml | 7 + src/DependencyInjection/Configuration.php | 8 +- ...SyliusItalianInvoiceableOrderExtension.php | 43 ++++-- src/Resources/config/services.xml | 31 ----- ...ffeSyliusItalianInvoiceableOrderPlugin.php | 6 +- ...kSelectInvoiceableDataAttributes.html.twig | 0 .../Common/_invoiceableAddressInfo.html.twig | 0 tests/Application/.env | 33 ----- tests/Application/.env.test | 3 - tests/Application/.eslintrc.js | 20 --- tests/Application/.gitignore | 23 ---- tests/Application/Kernel.php | 97 -------------- tests/Application/assets/admin/entry.js | 1 - tests/Application/assets/shop/entry.js | 1 - tests/Application/bin/console | 38 ------ tests/Application/composer.json | 5 - tests/Application/config/bootstrap.php | 27 ---- tests/Application/config/bundles.php | 67 ---------- tests/Application/config/jwt/private.pem | 54 -------- tests/Application/config/jwt/public.pem | 14 -- .../Application/config/packages/_sylius.yaml | 30 ----- .../config/packages/api_platform.yaml | 10 -- tests/Application/config/packages/assets.yaml | 7 - .../config/packages/dev/framework.yaml | 2 - .../config/packages/dev/jms_serializer.yaml | 12 -- .../config/packages/dev/monolog.yaml | 9 -- .../config/packages/dev/routing.yaml | 3 - .../config/packages/dev/web_profiler.yaml | 3 - .../Application/config/packages/doctrine.yaml | 22 ---- .../config/packages/doctrine_migrations.yaml | 4 - .../Application/config/packages/fos_rest.yaml | 11 -- .../config/packages/framework.yaml | 9 -- .../config/packages/jms_serializer.yaml | 4 - .../packages/lexik_jwt_authentication.yaml | 4 - .../config/packages/liip_imagine.yaml | 6 - tests/Application/config/packages/mailer.yaml | 3 - .../config/packages/prod/doctrine.yaml | 31 ----- .../config/packages/prod/jms_serializer.yaml | 10 -- .../config/packages/prod/monolog.yaml | 10 -- .../Application/config/packages/routing.yaml | 3 - .../Application/config/packages/security.yaml | 124 ------------------ .../config/packages/staging/monolog.yaml | 10 -- .../packages/stof_doctrine_extensions.yaml | 4 - .../config/packages/test/framework.yaml | 4 - .../config/packages/test/mailer.yaml | 5 - .../config/packages/test/monolog.yaml | 6 - .../config/packages/test/security.yaml | 6 - .../config/packages/test/sylius_theme.yaml | 3 - .../config/packages/test/sylius_uploader.yaml | 3 - .../config/packages/test/web_profiler.yaml | 6 - .../config/packages/test_cached/doctrine.yaml | 16 --- .../config/packages/test_cached/fos_rest.yaml | 3 - .../packages/test_cached/framework.yaml | 2 - .../config/packages/test_cached/mailer.yaml | 2 - .../config/packages/test_cached/monolog.yaml | 6 - .../config/packages/test_cached/security.yaml | 2 - .../packages/test_cached/sylius_channel.yaml | 2 - .../packages/test_cached/sylius_theme.yaml | 3 - .../packages/test_cached/sylius_uploader.yaml | 2 - .../config/packages/test_cached/twig.yaml | 2 - .../config/packages/translation.yaml | 8 -- tests/Application/config/packages/twig.yaml | 12 -- .../config/packages/validator.yaml | 3 - .../config/packages/webpack_encore.yaml | 5 - .../config/routes/dev/web_profiler.yaml | 7 - .../config/routes/liip_imagine.yaml | 2 - .../config/routes/sylius_admin.yaml | 3 - .../Application/config/routes/sylius_api.yaml | 3 - .../config/routes/sylius_shop.yaml | 14 -- .../config/routes/test/routing.yaml | 5 - .../routes/test/sylius_test_plugin.yaml | 5 - .../config/routes/test_cached/routing.yaml | 5 - .../test_cached/sylius_test_plugin.yaml | 5 - tests/Application/config/services.yaml | 5 - tests/Application/config/services_test.yaml | 11 -- .../config/services_test_cached.yaml | 2 - tests/Application/package.json | 68 ---------- tests/Application/public/.htaccess | 25 ---- tests/Application/public/favicon.ico | Bin 32038 -> 0 bytes tests/Application/public/index.php | 29 ---- tests/Application/public/robots.txt | 4 - tests/Application/webpack.config.js | 49 ------- tests/Behat/Resources/suites.yml | 6 +- .../secrets/test => Functional}/.gitignore | 0 .../test_cached => Integration}/.gitignore | 0 tests/TestApplication/.env | 7 + tests/TestApplication/.env.test | 1 + tests/TestApplication/config/bundles.php | 5 + tests/TestApplication/config/config.yaml | 7 + .../config/routes.yaml} | 0 .../TestApplication/config/services_test.php | 14 ++ .../config/validator/Address.xml | 0 .../config/validator/Order.xml | 0 .../src/Entity/.gitignore | 0 .../src/Entity/Addressing/Address.php | 0 .../src/Entity/Order/Order.php | 0 .../templates/.gitignore | 0 .../Common/Form/_address.html.twig | 0 .../Common/_address.html.twig | 0 .../SyliusAdminBundle/Layout/_logo.html.twig | 0 .../Security/_content.html.twig | 0 .../SyliusAdminBundle/_scripts.html.twig | 0 .../SyliusAdminBundle/_styles.html.twig | 0 .../Address/_addressBookSelect.html.twig | 0 .../Common/Form/_address.html.twig | 0 .../Common/_address.html.twig | 0 .../Homepage/_banner.html.twig | 0 .../Layout/Header/_logo.html.twig | 0 .../SyliusShopBundle/_scripts.html.twig | 0 .../SyliusShopBundle/_styles.html.twig | 0 .../translations => Unit}/.gitignore | 0 .../messages+intl-icu.en.yaml | 0 .../messages+intl-icu.it.yaml | 0 .../validators+intl-icu.en.yaml | 0 .../validators+intl-icu.it.yaml | 0 140 files changed, 420 insertions(+), 1421 deletions(-) delete mode 100644 .docker/nginx/nginx.conf delete mode 100644 .docker/php/php.ini delete mode 100644 .github/CODEOWNERS delete mode 100644 .github/actions/roave-bc-check/Dockerfile delete mode 100644 .github/actions/roave-bc-check/action.yml create mode 100644 assets/admin/controllers.json rename tests/Application/config/api_platform/.gitignore => assets/admin/entrypoint.js (100%) create mode 100644 assets/shop/controllers.json rename tests/Application/config/secrets/dev/.gitignore => assets/shop/entrypoint.js (100%) delete mode 100644 bin/create_node_symlink.php create mode 100644 compose.yml create mode 100644 config/config.yaml create mode 100644 config/services.yaml create mode 100644 config/services/services.yaml rename {tests/Application/config/secrets/prod => config/twig_hooks}/.gitignore (100%) delete mode 100644 docker-compose.yml delete mode 100644 src/Resources/config/services.xml rename {src/Resources/views => templates/shop}/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig (100%) rename {src/Resources/views => templates/shop}/Common/_invoiceableAddressInfo.html.twig (100%) delete mode 100644 tests/Application/.env delete mode 100644 tests/Application/.env.test delete mode 100644 tests/Application/.eslintrc.js delete mode 100644 tests/Application/.gitignore delete mode 100644 tests/Application/Kernel.php delete mode 100644 tests/Application/assets/admin/entry.js delete mode 100644 tests/Application/assets/shop/entry.js delete mode 100755 tests/Application/bin/console delete mode 100644 tests/Application/composer.json delete mode 100644 tests/Application/config/bootstrap.php delete mode 100644 tests/Application/config/bundles.php delete mode 100644 tests/Application/config/jwt/private.pem delete mode 100644 tests/Application/config/jwt/public.pem delete mode 100644 tests/Application/config/packages/_sylius.yaml delete mode 100644 tests/Application/config/packages/api_platform.yaml delete mode 100644 tests/Application/config/packages/assets.yaml delete mode 100644 tests/Application/config/packages/dev/framework.yaml delete mode 100644 tests/Application/config/packages/dev/jms_serializer.yaml delete mode 100644 tests/Application/config/packages/dev/monolog.yaml delete mode 100644 tests/Application/config/packages/dev/routing.yaml delete mode 100644 tests/Application/config/packages/dev/web_profiler.yaml delete mode 100644 tests/Application/config/packages/doctrine.yaml delete mode 100644 tests/Application/config/packages/doctrine_migrations.yaml delete mode 100644 tests/Application/config/packages/fos_rest.yaml delete mode 100644 tests/Application/config/packages/framework.yaml delete mode 100644 tests/Application/config/packages/jms_serializer.yaml delete mode 100644 tests/Application/config/packages/lexik_jwt_authentication.yaml delete mode 100644 tests/Application/config/packages/liip_imagine.yaml delete mode 100644 tests/Application/config/packages/mailer.yaml delete mode 100644 tests/Application/config/packages/prod/doctrine.yaml delete mode 100644 tests/Application/config/packages/prod/jms_serializer.yaml delete mode 100644 tests/Application/config/packages/prod/monolog.yaml delete mode 100644 tests/Application/config/packages/routing.yaml delete mode 100644 tests/Application/config/packages/security.yaml delete mode 100644 tests/Application/config/packages/staging/monolog.yaml delete mode 100644 tests/Application/config/packages/stof_doctrine_extensions.yaml delete mode 100644 tests/Application/config/packages/test/framework.yaml delete mode 100644 tests/Application/config/packages/test/mailer.yaml delete mode 100644 tests/Application/config/packages/test/monolog.yaml delete mode 100644 tests/Application/config/packages/test/security.yaml delete mode 100644 tests/Application/config/packages/test/sylius_theme.yaml delete mode 100644 tests/Application/config/packages/test/sylius_uploader.yaml delete mode 100644 tests/Application/config/packages/test/web_profiler.yaml delete mode 100644 tests/Application/config/packages/test_cached/doctrine.yaml delete mode 100644 tests/Application/config/packages/test_cached/fos_rest.yaml delete mode 100644 tests/Application/config/packages/test_cached/framework.yaml delete mode 100644 tests/Application/config/packages/test_cached/mailer.yaml delete mode 100644 tests/Application/config/packages/test_cached/monolog.yaml delete mode 100644 tests/Application/config/packages/test_cached/security.yaml delete mode 100644 tests/Application/config/packages/test_cached/sylius_channel.yaml delete mode 100644 tests/Application/config/packages/test_cached/sylius_theme.yaml delete mode 100644 tests/Application/config/packages/test_cached/sylius_uploader.yaml delete mode 100644 tests/Application/config/packages/test_cached/twig.yaml delete mode 100644 tests/Application/config/packages/translation.yaml delete mode 100644 tests/Application/config/packages/twig.yaml delete mode 100644 tests/Application/config/packages/validator.yaml delete mode 100644 tests/Application/config/packages/webpack_encore.yaml delete mode 100644 tests/Application/config/routes/dev/web_profiler.yaml delete mode 100644 tests/Application/config/routes/liip_imagine.yaml delete mode 100644 tests/Application/config/routes/sylius_admin.yaml delete mode 100644 tests/Application/config/routes/sylius_api.yaml delete mode 100644 tests/Application/config/routes/sylius_shop.yaml delete mode 100644 tests/Application/config/routes/test/routing.yaml delete mode 100644 tests/Application/config/routes/test/sylius_test_plugin.yaml delete mode 100644 tests/Application/config/routes/test_cached/routing.yaml delete mode 100644 tests/Application/config/routes/test_cached/sylius_test_plugin.yaml delete mode 100644 tests/Application/config/services.yaml delete mode 100644 tests/Application/config/services_test.yaml delete mode 100644 tests/Application/config/services_test_cached.yaml delete mode 100644 tests/Application/package.json delete mode 100644 tests/Application/public/.htaccess delete mode 100644 tests/Application/public/favicon.ico delete mode 100644 tests/Application/public/index.php delete mode 100644 tests/Application/public/robots.txt delete mode 100644 tests/Application/webpack.config.js rename tests/{Application/config/secrets/test => Functional}/.gitignore (100%) rename tests/{Application/config/secrets/test_cached => Integration}/.gitignore (100%) create mode 100644 tests/TestApplication/.env create mode 100644 tests/TestApplication/.env.test create mode 100644 tests/TestApplication/config/bundles.php create mode 100644 tests/TestApplication/config/config.yaml rename tests/{Application/config/serialization/.gitignore => TestApplication/config/routes.yaml} (100%) create mode 100644 tests/TestApplication/config/services_test.php rename tests/{Application => TestApplication}/config/validator/Address.xml (100%) rename tests/{Application => TestApplication}/config/validator/Order.xml (100%) rename tests/{Application => TestApplication}/src/Entity/.gitignore (100%) rename tests/{Application => TestApplication}/src/Entity/Addressing/Address.php (100%) rename tests/{Application => TestApplication}/src/Entity/Order/Order.php (100%) rename tests/{Application => TestApplication}/templates/.gitignore (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusAdminBundle/Common/_address.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusAdminBundle/Security/_content.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusAdminBundle/_scripts.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusAdminBundle/_styles.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusShopBundle/Common/_address.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusShopBundle/_scripts.html.twig (100%) rename tests/{Application => TestApplication}/templates/bundles/SyliusShopBundle/_styles.html.twig (100%) rename tests/{Application/translations => Unit}/.gitignore (100%) rename {src/Resources/translations => translations}/messages+intl-icu.en.yaml (100%) rename {src/Resources/translations => translations}/messages+intl-icu.it.yaml (100%) rename {src/Resources/translations => translations}/validators+intl-icu.en.yaml (100%) rename {src/Resources/translations => translations}/validators+intl-icu.it.yaml (100%) diff --git a/.docker/nginx/nginx.conf b/.docker/nginx/nginx.conf deleted file mode 100644 index 6bfbd29..0000000 --- a/.docker/nginx/nginx.conf +++ /dev/null @@ -1,48 +0,0 @@ -user www-data; -worker_processes auto; -daemon off; -pid /run/nginx.pid; - -include /etc/nginx/modules-enabled/*.conf; - -events { - worker_connections 1024; -} - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - server_tokens off; - - client_max_body_size 64m; - sendfile on; - tcp_nodelay on; - tcp_nopush on; - - gzip_vary on; - - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; - - server { - listen 80; - - root /app/tests/Application/public; - index index.php; - - location / { - try_files $uri /index.php$is_args$args; - } - - location ~ \.php$ { - include fastcgi_params; - - fastcgi_pass unix:/var/run/php8-fpm.sock; - fastcgi_split_path_info ^(.+\.php)(/.*)$; - - fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; - fastcgi_param DOCUMENT_ROOT $realpath_root; - } - } -} diff --git a/.docker/php/php.ini b/.docker/php/php.ini deleted file mode 100644 index 13f0abe..0000000 --- a/.docker/php/php.ini +++ /dev/null @@ -1,5 +0,0 @@ -[PHP] -memory_limit=512M - -[date] -date.timezone=${PHP_DATE_TIMEZONE} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 92faea2..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @Sylius/core-team diff --git a/.github/actions/roave-bc-check/Dockerfile b/.github/actions/roave-bc-check/Dockerfile deleted file mode 100644 index 4ce17bf..0000000 --- a/.github/actions/roave-bc-check/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM nyholm/roave-bc-check-ga:latest - -RUN docker-php-ext-install -j$(nproc) exif - -RUN apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev libxml2-dev && \ - docker-php-ext-configure gd \ - --with-freetype \ - --with-jpeg \ - NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \ - docker-php-ext-install -j$(nproc) gd && \ - docker-php-ext-install -j$(nproc) soap && \ - apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev libxml2-dev diff --git a/.github/actions/roave-bc-check/action.yml b/.github/actions/roave-bc-check/action.yml deleted file mode 100644 index ebb18ea..0000000 --- a/.github/actions/roave-bc-check/action.yml +++ /dev/null @@ -1,5 +0,0 @@ -name: 'Roave BC Check' -description: 'Roave BC Check' -runs: - using: 'docker' - image: 'Dockerfile' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55638cd..4918f40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,19 +21,20 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.1", "8.2", "8.3"] - symfony: ["5.4.*", "^6.0"] - sylius: ["^1.12.0", "^1.13.1"] - node: ["18.x"] - mysql: ["8.0"] + php: ["8.4"] + symfony: ["^7.3"] + sylius: ["~2.1.0"] + node: ["22.x"] + mysql: ["8.4"] env: APP_ENV: test + BEHAT_BASE_URL: "https://127.0.0.1:8080/" DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP @@ -67,20 +68,12 @@ jobs: - 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: Run webserver - run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) + run: symfony server:ca:install || true - name: Get Composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer @@ -91,16 +84,12 @@ jobs: restore-keys: | ${{ runner.os }}-php-${{ matrix.php }}-composer- - - - name: Configure global composer - run: | - composer global config --no-plugins allow-plugins.symfony/flex true - composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.2.2" - - name: Restrict Symfony version if: matrix.symfony != '' run: | + composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.4" + composer global config --no-plugins allow-plugins.symfony/flex true composer config extra.symfony.require "${{ matrix.symfony }}" - @@ -111,13 +100,15 @@ jobs: - name: Install PHP dependencies run: composer install --no-interaction - env: - SYMFONY_REQUIRE: ${{ matrix.symfony }} + + - + name: Run unit tests + run: vendor/bin/phpunit --colors=always --testsuite=unit - name: Get Yarn cache directory id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache Yarn @@ -130,35 +121,39 @@ jobs: - name: Install JS dependencies - run: (cd tests/Application && yarn install) + run: (cd vendor/sylius/test-application && yarn install) - name: Prepare test application database run: | - (cd tests/Application && bin/console doctrine:database:create -vvv) - (cd tests/Application && bin/console doctrine:schema:create -vvv) + (vendor/bin/console doctrine:database:create -vvv) + (vendor/bin/console doctrine:schema:create -vvv) - name: Prepare test application assets run: | - (cd tests/Application && bin/console assets:install public -vvv) - (cd tests/Application && yarn build:prod) + vendor/bin/console assets:install -vvv + (cd vendor/sylius/test-application && yarn build) - name: Prepare test application cache - run: (cd tests/Application && bin/console cache:warmup -vvv) + run: vendor/bin/console cache:warmup -vvv - name: Load fixtures in test application - run: (cd tests/Application && bin/console sylius:fixtures:load -n) + run: vendor/bin/console sylius:fixtures:load -n - name: Validate composer.json run: composer validate --ansi --strict + - + name: Validate container + run: vendor/bin/console lint:container + - name: Validate database schema - run: (cd tests/Application && bin/console doctrine:schema:validate) + run: vendor/bin/console doctrine:schema:validate - name: Run PHPStan @@ -173,8 +168,16 @@ jobs: run: vendor/bin/phpspec run --ansi -f progress --no-interaction - - name: Run PHPUnit - run: vendor/bin/phpunit --colors=always + name: Run Non-unit PHPUnit tests + run: vendor/bin/phpunit --colors=always --testsuite=non-unit + + - + 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: Run webserver + run: symfony server:start --port=8080 --daemon - name: Run Behat @@ -185,16 +188,33 @@ jobs: uses: actions/upload-artifact@v4 if: failure() with: - name: Behat logs + name: "Behat logs - ${{ matrix.sylius }}-${{ github.run_id }}-${{ github.run_number }}" path: etc/build/ if-no-files-found: ignore + compression-level: 6 + overwrite: true roave_bc_check: name: Roave BC Check runs-on: ubuntu-latest + env: + PHP_VERSION: 8.4 steps: - - uses: actions/checkout@v3 - - name: fetch tags - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - - name: Roave BC Check - uses: ./.github/actions/roave-bc-check + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ env.PHP_VERSION }}" + extensions: intl + tools: flex,symfony + coverage: none + + - name: Install roave/backward-compatibility-check. + run: composer require --dev roave/backward-compatibility-check --no-plugins + + - name: Run roave/backward-compatibility-check. + run: vendor/bin/roave-backward-compatibility-check --format=github-actions diff --git a/.gitignore b/.gitignore index 29046b9..4f8e12d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,23 @@ /vendor/ +/var/ /node_modules/ +/drivers/ /composer.lock /etc/build/* !/etc/build/.gitignore -/tests/Application/yarn.lock - /.phpunit.result.cache /behat.yml /phpspec.yml /phpunit.xml +/compose.override.yml +/docker-compose.override.yml +.phpunit.result.cache # Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project /.php-version /php.ini + +/tests/TestApplication/.env.local +/tests/TestApplication/.env.*.local diff --git a/Makefile b/Makefile index 01d9607..0b57e25 100644 --- a/Makefile +++ b/Makefile @@ -1,36 +1,67 @@ -phpunit: - vendor/bin/phpunit +.PHONY: run -phpspec: - vendor/bin/phpspec run --ansi --no-interaction -f dot +DOCKER_COMPOSE ?= docker compose +DOCKER_USER ?= "$(shell id -u):$(shell id -g)" +ENV ?= "dev" -phpstan: - vendor/bin/phpstan analyse +init: + @make -s docker-compose-check + @if [ ! -e compose.override.yml ]; then \ + cp compose.override.dist.yml compose.override.yml; \ + fi + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php composer install --no-interaction --no-scripts --no-plugins + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm nodejs + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) up -d -psalm: - vendor/bin/psalm +run: + @make -s up -behat-js: - APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress +debug: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) -f compose.yml -f compose.override.yml -f compose.debug.yml up -d -install: - composer install --no-interaction --no-scripts +up: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) up -d -backend: - tests/Application/bin/console sylius:install --no-interaction - tests/Application/bin/console sylius:fixtures:load default --no-interaction +down: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) down -frontend: - (cd tests/Application && yarn install --pure-lockfile) - (cd tests/Application && GULP_ENV=prod yarn build) +clean: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) down -v -behat: - APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress +php-shell: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) exec php sh + +node-shell: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm -i nodejs sh + +node-watch: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm -i nodejs "npm run watch" + +docker-compose-check: + @$(DOCKER_COMPOSE) version >/dev/null 2>&1 || (echo "Please install docker compose binary or set DOCKER_COMPOSE=\"docker-compose\" for legacy binary" && exit 1) + @echo "You are using \"$(DOCKER_COMPOSE)\" binary" + @echo "Current version is \"$$($(DOCKER_COMPOSE) version)\"" -init: install backend frontend +database-init: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console doctrine:database:create -n --if-not-exists + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console doctrine:migrations:migrate -n -ci: init phpstan psalm phpunit phpspec behat +database-reset: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console doctrine:database:drop -n --force --if-exists + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console doctrine:database:create -n + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console doctrine:migrations:migrate -n -integration: init phpunit behat +load-fixtures: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console sylius:fixtures:load -n -static: install phpspec phpstan psalm +phpstan: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/phpstan analyse -c phpstan.neon + +ecs: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/ecs check src + +phpunit: + @ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/phpunit + +behat: + @ENV=$(ENV) DOCKER_USER=root $(DOCKER_COMPOSE) run --rm php vendor/bin/behat diff --git a/README.md b/README.md index 3d755cd..ff4111d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@

- - + +

Italian Invoiceable Order Plugin

+

Sylius plugin which allows Italian merchants to collect invoice data for their orders such as tax code, VAT number, SDI code, etc... as well as allowing the merchant to only apply taxes to those customers that can (and must) pay taxes in advance.

Build Status

@@ -55,8 +56,9 @@ 9. Run a diff of your Doctrine's migrations and then run it: ```bash - bin/console doctrine:migrations:diff - bin/console doctrine:migrations:migrate + vendor/bin/console cache:clear + vendor/bin/console doctrine:migrations:diff + vendor/bin/console doctrine:migrations:migrate ``` 10. Add invoiceable address fields to your shop address form template. To do so you have to override the template: @@ -236,33 +238,48 @@ This plugin also allows to select an invoiceable address from the address book i To contribute you need to: -1. Clone this repository into your development environment +1. Clone this repository into you development environment and go to the plugin's root directory, -2. Create `tests/Application/.env.local` and `tests/Application/.env.test.local` files to customize env vars according to your specific development environment (for example the `DATABASE_URL` variable). - -3. Then, from the plugin's root directory, run the following commands: +2. Then, from the plugin's root directory, run the following commands: ```bash - (cd tests/Application && yarn install) - (cd tests/Application && yarn build) - (cd tests/Application && bin/console assets:install public) - (cd tests/Application && bin/console doctrine:database:create) - (cd tests/Application && bin/console doctrine:schema:create) - (cd tests/Application && bin/console sylius:fixtures:load) - (cd tests/Application && symfony server:start -d) # Requires Symfony CLI (https://symfony.com/download) + composer install ``` -4. Now at https://127.0.0.1:8000/ you have a full Sylius testing application which runs the plugin. +3. Copy `tests/TestApplication/.env` in `tests/TestApplication/.env.local` and set configuration specific for your development environment. + +4. Run docker (create a `compose.override.yml` if you need to customize services): + + ```bash + docker-compose up -d + ``` + +4. Then, from the plugin's root directory, run the following commands: + + ```bash + composer test-app-init + ``` + +5. Run your local server: + + ```bash + symfony server:ca:install + symfony server:start -d + ``` + +6. Now at http://localhost:8080/ you have a full Sylius testing application which runs the plugin -### Running plugin tests +### Testing After your changes you must ensure that the tests are still passing. First setup your test database: ```bash -(cd tests/Application && bin/console -e test doctrine:database:create) -(cd tests/Application && bin/console -e test doctrine:schema:create) + APP_ENV=test vendor/bin/console doctrine:database:create + APP_ENV=test vendor/bin/console doctrine:migrations:migrate -n + # Optionally load data fixtures + APP_ENV=test vendor/bin/console sylius:fixtures:load -n ``` The current CI suite runs the following tests: @@ -299,7 +316,7 @@ The current CI suite runs the following tests: ```bash symfony server:ca:install - APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public --daemon + APP_ENV=test symfony server:start --port=8080 --dir=tests/TestApplication/public --daemon ``` 4. Run Behat: diff --git a/assets/admin/controllers.json b/assets/admin/controllers.json new file mode 100644 index 0000000..e2ce9b5 --- /dev/null +++ b/assets/admin/controllers.json @@ -0,0 +1,4 @@ +{ + "controllers": [], + "entrypoints": [] +} diff --git a/tests/Application/config/api_platform/.gitignore b/assets/admin/entrypoint.js similarity index 100% rename from tests/Application/config/api_platform/.gitignore rename to assets/admin/entrypoint.js diff --git a/assets/shop/controllers.json b/assets/shop/controllers.json new file mode 100644 index 0000000..e2ce9b5 --- /dev/null +++ b/assets/shop/controllers.json @@ -0,0 +1,4 @@ +{ + "controllers": [], + "entrypoints": [] +} diff --git a/tests/Application/config/secrets/dev/.gitignore b/assets/shop/entrypoint.js similarity index 100% rename from tests/Application/config/secrets/dev/.gitignore rename to assets/shop/entrypoint.js diff --git a/behat.yml.dist b/behat.yml.dist index 5a07d2c..90cd22f 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -20,7 +20,7 @@ default: Behat\MinkExtension: files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/" - base_url: "https://127.0.0.1:8080/" + base_url: "%env(BEHAT_BASE_URL)%" default_session: symfony javascript_session: chromedriver sessions: @@ -49,9 +49,10 @@ default: show_auto: false FriendsOfBehat\SymfonyExtension: - bootstrap: tests/Application/config/bootstrap.php + bootstrap: vendor/sylius/test-application/config/bootstrap.php kernel: - class: Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Application\Kernel + class: Sylius\TestApplication\Kernel + environment: test FriendsOfBehat\VariadicExtension: ~ diff --git a/bin/create_node_symlink.php b/bin/create_node_symlink.php deleted file mode 100644 index 10d69b4..0000000 --- a/bin/create_node_symlink.php +++ /dev/null @@ -1,45 +0,0 @@ - `' . NODE_MODULES_FOLDER_NAME . '` already exists as a link or folder, keeping existing as may be intentional.' . PHP_EOL; - exit(0); - } else { - echo '> Invalid symlink `' . NODE_MODULES_FOLDER_NAME . '` detected, recreating...' . PHP_EOL; - if (!@unlink(NODE_MODULES_FOLDER_NAME)) { - echo '> Could not delete file `' . NODE_MODULES_FOLDER_NAME . '`.' . PHP_EOL; - exit(1); - } - } -} - -/* try to create the symlink using PHP internals... */ -$success = @symlink(PATH_TO_NODE_MODULES, NODE_MODULES_FOLDER_NAME); - -/* if case it has failed, but OS is Windows... */ -if (!$success && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - /* ...then try a different approach which does not require elevated permissions and folder to exist */ - echo '> This system is running Windows, creation of links requires elevated privileges,' . PHP_EOL; - echo '> and target path to exist. Fallback to NTFS Junction:' . PHP_EOL; - exec(sprintf('mklink /J %s %s 2> NUL', NODE_MODULES_FOLDER_NAME, PATH_TO_NODE_MODULES), $output, $returnCode); - $success = $returnCode === 0; - if (!$success) { - echo '> Failed o create the required symlink' . PHP_EOL; - exit(2); - } -} - -$path = @readlink(NODE_MODULES_FOLDER_NAME); -/* check if link points to the intended directory */ -if ($path && realpath($path) === realpath(PATH_TO_NODE_MODULES)) { - echo '> Successfully created the symlink.' . PHP_EOL; - exit(0); -} - -echo '> Failed to create the symlink to `' . NODE_MODULES_FOLDER_NAME . '`.' . PHP_EOL; -exit(3); diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..bda2372 --- /dev/null +++ b/compose.yml @@ -0,0 +1,24 @@ +services: + php: + image: ghcr.io/sylius/sylius-php:8.4-alpine + mysql: + image: mysql:8.4 + platform: linux/amd64 + healthcheck: + test: '/usr/bin/mysql --execute "SHOW databases;"' + timeout: 3s + interval: 1s + retries: 10 + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: 1 + cap_add: + - SYS_NICE # prevent "mbind: Operation not permitted" errors + ports: + - ${MYSQL_PORT:-3306}:3306 + nginx: + image: ghcr.io/sylius/sylius-nginx:latest + depends_on: + - php + mailhog: + # do not use in production! + image: mailhog/mailhog:latest diff --git a/composer.json b/composer.json index c2e4a40..2e54eba 100644 --- a/composer.json +++ b/composer.json @@ -4,91 +4,113 @@ "description": "Sylius plugin which allows Italian merchants to collect invoice data for their orders.", "keywords": [ "sylius", - "sylius-plugin" + "sylius-plugin", + "test-appication" ], "license": "MIT", "require": { - "php": "^8.1", + "php": "^8.2", "dragonbe/vies": "^2.3.2", "sandwich/vies-bundle": "^2.1", - "sylius/sylius": "^1.12", - "symfony/webpack-encore-bundle": "^1.15", + "sylius/sylius": "^2.0", "webmozart/assert": "^1.9" }, "require-dev": { - "behat/behat": "^3.6.1", - "behat/mink-selenium2-driver": "^1.6", - "dbrekelmans/bdi": "^1.1", - "dmore/behat-chrome-extension": "^1.3", - "dmore/chrome-mink-driver": "^2.7", - "friends-of-behat/mink": "^1.8", - "friends-of-behat/mink-browserkit-driver": "^1.4", - "friends-of-behat/mink-debug-extension": "^2.0.0", - "friends-of-behat/mink-extension": "^2.4", + "behat/behat": "^3.16", + "behat/mink": "^1.13", + "behat/mink-selenium2-driver": "^1.7", + "dbrekelmans/bdi": "^1.4", + "dmore/behat-chrome-extension": "^1.4", + "dmore/chrome-mink-driver": "^2.9", + "friends-of-behat/mink-browserkit-driver": "^1.6", + "friends-of-behat/mink-debug-extension": "^2.1", + "friends-of-behat/mink-extension": "^2.7", "friends-of-behat/page-object-extension": "^0.3", - "friends-of-behat/suite-settings-extension": "^1.0", - "friends-of-behat/symfony-extension": "^2.1", - "friends-of-behat/variadic-extension": "^1.3", - "phpspec/phpspec": "^7.2", + "friends-of-behat/suite-settings-extension": "^1.1", + "friends-of-behat/symfony-extension": "^2.6", + "friends-of-behat/variadic-extension": "^1.6", + "phpspec/phpspec": "^8.0", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.8.1", - "phpstan/phpstan-doctrine": "1.3.16", + "phpstan/phpstan": "^1.12", + "phpstan/phpstan-doctrine": "^1.3", "phpstan/phpstan-strict-rules": "^1.3.0", - "phpstan/phpstan-webmozart-assert": "^1.2.0", - "phpunit/phpunit": "^9.6 || ^10.5", + "phpstan/phpstan-webmozart-assert": "^1.2", + "phpunit/phpunit": "^10.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", - "rector/rector": "^0.15.0", + "psalm/plugin-symfony": "^5.2", + "rector/rector": "^1.0", "robertfausk/behat-panther-extension": "^1.1", - "sylius-labs/coding-standard": "^4.2", - "sylius-labs/suite-tags-extension": "^0.2", - "symfony/browser-kit": "^5.4 || ^6.0", - "symfony/debug-bundle": "^5.4 || ^6.0", - "symfony/dotenv": "^5.4 || ^6.0", - "symfony/flex": "^2.2.2", - "symfony/intl": "^5.4 || ^6.0", - "symfony/web-profiler-bundle": "^5.4 || ^6.0", - "vimeo/psalm": "^4.27" + "sylius-labs/coding-standard": "^4.4", + "sylius-labs/suite-tags-extension": "~0.2", + "sylius/sylius-rector": "^2.0", + "sylius/test-application": "^2.0.0@alpha", + "symfony/browser-kit": "^6.4 || ^7.1", + "symfony/debug-bundle": "^6.4 || ^7.1", + "symfony/dotenv": "^6.4 || ^7.1", + "symfony/http-client": "^6.4 || ^7.1", + "symfony/intl": "^6.4 || ^7.1", + "symfony/runtime": "^6.4 || ^7.1", + "symfony/web-profiler-bundle": "^6.4 || ^7.1", + "symfony/webpack-encore-bundle": "^2.2", + "vimeo/psalm": "^6.13" }, "config": { "sort-packages": true, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": false, + "php-http/discovery": false, "phpstan/extension-installer": true, - "symfony/flex": true + "symfony/flex": true, + "symfony/runtime": true } }, "extra": { "branch-alias": { - "dev-master": "1.12-dev" - } + "dev-master": "2.0-dev" + }, + "symfony": { + "require": "^6.4" + }, + "public-dir": "vendor/sylius/test-application/public" }, "autoload": { "psr-4": { - "Webgriffe\\SyliusItalianInvoiceableOrderPlugin\\": "src/", - "Tests\\Webgriffe\\SyliusItalianInvoiceableOrderPlugin\\Behat\\": "tests/Behat/" + "Webgriffe\\SyliusItalianInvoiceableOrderPlugin\\": "src/" } }, "autoload-dev": { "psr-4": { - "App\\": "tests/Application/src" - }, - "classmap": [ - "tests/Application/Kernel.php" - ] + "Tests\\Webgriffe\\SyliusItalianInvoiceableOrderPlugin\\": ["tests/", "tests/TestApplication/src/"] + } }, "scripts": { - "post-install-cmd": [ - "php bin/create_node_symlink.php" + "database-reset": [ + "vendor/bin/console doctrine:database:drop --force --if-exists", + "vendor/bin/console doctrine:database:create", + "vendor/bin/console doctrine:migration:migrate -n", + "vendor/bin/console sylius:fixtures:load -n" + ], + "frontend-clear": [ + "cd vendor/sylius/test-application && yarn install && yarn build", + "vendor/bin/console assets:install" ], - "post-update-cmd": [ - "php bin/create_node_symlink.php" + "test-app-init": [ + "@database-reset", + "@frontend-clear" ], - "post-create-project-cmd": [ - "php bin/create_node_symlink.php" + "ecs": "ecs check src/ tests/Behat/", + "phpstan": "phpstan analyse -c phpstan.neon -l max src/", + "phpunit": "phpunit", + "phpspec": "phpspec run", + "behat": "behat --strict -vvv --no-interaction || behat --strict -vvv --no-interaction --rerun", + "suite": [ + "@ecs", + "@phpstan", + "@phpunit", + "@phpspec", + "@behat" ], "auto-scripts": { - "cache:clear": "symfony-cmd", - "assets:install %PUBLIC_DIR%": "symfony-cmd", "security-checker security:check": "script" } } diff --git a/config/config.yaml b/config/config.yaml new file mode 100644 index 0000000..239a74a --- /dev/null +++ b/config/config.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: 'twig_hooks/**/*.yaml' } diff --git a/config/services.yaml b/config/services.yaml new file mode 100644 index 0000000..94946d5 --- /dev/null +++ b/config/services.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "services/**/*.yaml" } diff --git a/config/services/services.yaml b/config/services/services.yaml new file mode 100644 index 0000000..bff1845 --- /dev/null +++ b/config/services/services.yaml @@ -0,0 +1,25 @@ +parameters: + app.taxation.eu_zone_code: ~ + +services: + webgriffe_sylius_italian_invoiceable_order.form.extension.italian_invoiceable_address: + class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Form\Extension\ItalianInvoiceableAddressTypeExtension + tags: + - { name: form.type_extension, extended_type: Sylius\Bundle\AddressingBundle\Form\Type\AddressType } + + webgriffe_sylius_italian_invoiceable_order.address_comparator: + class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Comparator\ItalianInvoiceableAddressComparatorDecorator + decorates: sylius.address_comparator + arguments: + - '@webgriffe_sylius_italian_invoiceable_order.address_comparator.inner' + + app.taxation.italian_tax_calculation_strategy: + class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianTaxCalculation + arguments: + - 'italian_tax_calculation_strategy' + - + - '@sylius.taxation.order_item_units_taxes_applicator' + - '@sylius.taxation.order_shipment_taxes_applicator' + - '%app.taxation.eu_zone_code%' + tags: + - { name: sylius.taxation.calculation_strategy, type: italian_tax_calculation_strategy, label: 'Italian tax calculation' } diff --git a/tests/Application/config/secrets/prod/.gitignore b/config/twig_hooks/.gitignore similarity index 100% rename from tests/Application/config/secrets/prod/.gitignore rename to config/twig_hooks/.gitignore diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index a3e00ab..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,42 +0,0 @@ -services: - app: - image: sylius/standard:1.11-traditional-alpine - environment: - APP_ENV: "dev" - DATABASE_URL: "mysql://root:mysql@mysql/sylius_%kernel.environment%?charset=utf8mb4" -# DATABASE_URL: "pgsql://root:postgres@postgres/sylius_%kernel.environment%?charset=utf8" # When using postgres - PHP_DATE_TIMEZONE: "Europe/Warsaw" - volumes: - - ./:/app:delegated - - ./.docker/php/php.ini:/etc/php8/php.ini:delegated - - ./.docker/nginx/nginx.conf:/etc/nginx/nginx.conf:delegated - ports: - - 80:80 - depends_on: - - mysql - networks: - - sylius - - mysql: - image: mysql:8.0 - platform: linux/amd64 - environment: - MYSQL_ROOT_PASSWORD: mysql - ports: - - ${MYSQL_PORT:-3306}:3306 - networks: - - sylius - -# postgres: -# image: postgres:14-alpine -# environment: -# POSTGRES_USER: root -# POSTGRES_PASSWORD: postgres -# ports: -# - ${POSTGRES_PORT:-5432}:5432 -# networks: -# - sylius - -networks: - sylius: - driver: bridge diff --git a/ecs.php b/ecs.php index eee8ae6..fb0426f 100644 --- a/ecs.php +++ b/ecs.php @@ -6,6 +6,12 @@ use Symplify\EasyCodingStandard\Config\ECSConfig; return static function (ECSConfig $ecsConfig): void { + $ecsConfig->paths([ + __DIR__ . '/src', + __DIR__ . '/tests/Behat', + __DIR__ . '/ecs.php', + ]); + $ecsConfig->import('vendor/sylius-labs/coding-standard/ecs.php'); $ecsConfig->skip([ diff --git a/phpstan.neon b/phpstan.neon index 8dc24b0..6ffb394 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -10,12 +10,11 @@ parameters: - 'src/DependencyInjection/Configuration.php' # Test dependencies - - 'tests/Application/app/**.php' - - 'tests/Application/src/**.php' + - 'tests/TestApplication/src/**.php' ignoreErrors: - - - identifier: missingType.iterableValue - identifier: missingType.generics + - + identifier: missingType.iterableValue - '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./' diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 91e858b..6352309 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,40 @@ - + bootstrap="vendor/sylius/test-application/config/bootstrap.php" +> + + + + + + + + + - + tests - - - + + tests/Unit + - - + + tests/Functional + - - - + + tests/Integration + + + + tests/Functional + tests/Integration + + diff --git a/psalm.xml b/psalm.xml index 3240886..5611b5f 100644 --- a/psalm.xml +++ b/psalm.xml @@ -5,6 +5,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + phpVersion="8.4" > @@ -12,4 +13,10 @@ + + + var/cache/dev/Sylius_TestApplication_KernelDevDebugContainer.xml + var/cache/test/Sylius_TestApplication_KernelTestDebugContainer.xml + + diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index f5c7eaf..8860e46 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -7,15 +7,15 @@ use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; +/** + * @psalm-api + */ final class Configuration implements ConfigurationInterface { - /** - * @psalm-suppress UnusedVariable - */ + #[\Override] public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('webgriffe_sylius_italian_invoiceable_order_plugin'); - $rootNode = $treeBuilder->getRootNode(); return $treeBuilder; } diff --git a/src/DependencyInjection/WebgriffeSyliusItalianInvoiceableOrderExtension.php b/src/DependencyInjection/WebgriffeSyliusItalianInvoiceableOrderExtension.php index bbc745e..0cb99ee 100644 --- a/src/DependencyInjection/WebgriffeSyliusItalianInvoiceableOrderExtension.php +++ b/src/DependencyInjection/WebgriffeSyliusItalianInvoiceableOrderExtension.php @@ -4,27 +4,46 @@ namespace Webgriffe\SyliusItalianInvoiceableOrderPlugin\DependencyInjection; -use Symfony\Component\Config\Definition\ConfigurationInterface; +use Sylius\Bundle\CoreBundle\DependencyInjection\PrependDoctrineMigrationsTrait; +use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Extension\Extension; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -final class WebgriffeSyliusItalianInvoiceableOrderExtension extends Extension +final class WebgriffeSyliusItalianInvoiceableOrderExtension extends AbstractResourceExtension implements PrependExtensionInterface { - /** - * @psalm-suppress UnusedVariable - */ + use PrependDoctrineMigrationsTrait; + + #[\Override] public function load(array $configs, ContainerBuilder $container): void { - $config = $this->processConfiguration($this->getConfiguration([], $container), $configs); - $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); + $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../config')); + + $loader->load('services.yaml'); + } + + #[\Override] + public function prepend(ContainerBuilder $container): void + { + $this->prependDoctrineMigrations($container); + } - $loader->load('services.xml'); + #[\Override] + protected function getMigrationsNamespace(): string + { + return 'Webgriffe\SyliusItalianInvoiceableOrderPlugin\Migrations'; + } + + #[\Override] + protected function getMigrationsDirectory(): string + { + return '@WebgriffeSyliusItalianInvoiceableOrderPlugin/src/Migrations'; } - public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface + #[\Override] + protected function getNamespacesOfMigrationsExecutedBefore(): array { - return new Configuration(); + return ['Sylius\Bundle\CoreBundle\Migrations']; } } diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml deleted file mode 100644 index d4b912e..0000000 --- a/src/Resources/config/services.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - italian_tax_calculation_strategy - - - - - %app.taxation.eu_zone_code% - - - - diff --git a/src/WebgriffeSyliusItalianInvoiceableOrderPlugin.php b/src/WebgriffeSyliusItalianInvoiceableOrderPlugin.php index 628756b..36f5bd3 100644 --- a/src/WebgriffeSyliusItalianInvoiceableOrderPlugin.php +++ b/src/WebgriffeSyliusItalianInvoiceableOrderPlugin.php @@ -7,12 +7,16 @@ use Sylius\Bundle\CoreBundle\Application\SyliusPluginTrait; use Symfony\Component\HttpKernel\Bundle\Bundle; +/** + * @psalm-api + */ final class WebgriffeSyliusItalianInvoiceableOrderPlugin extends Bundle { use SyliusPluginTrait; + #[\Override] public function getPath(): string { - return __DIR__; + return \dirname(__DIR__); } } diff --git a/src/Resources/views/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig b/templates/shop/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig similarity index 100% rename from src/Resources/views/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig rename to templates/shop/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig diff --git a/src/Resources/views/Common/_invoiceableAddressInfo.html.twig b/templates/shop/Common/_invoiceableAddressInfo.html.twig similarity index 100% rename from src/Resources/views/Common/_invoiceableAddressInfo.html.twig rename to templates/shop/Common/_invoiceableAddressInfo.html.twig diff --git a/tests/Application/.env b/tests/Application/.env deleted file mode 100644 index 46db94f..0000000 --- a/tests/Application/.env +++ /dev/null @@ -1,33 +0,0 @@ -# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file -# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production. -# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration - -###> symfony/framework-bundle ### -APP_ENV=dev -APP_DEBUG=1 -APP_SECRET=EDITME -###< symfony/framework-bundle ### - -###> doctrine/doctrine-bundle ### -# Format described at http://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/webgriffe_sylius_italian_invoiceable_order_plugin_%kernel.environment%?serverVersion=5.7 -###< 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 -###< lexik/jwt-authentication-bundle ### - -###> symfony/mailer ### -MAILER_DSN=null://null -###< symfony/mailer ### - -###> symfony/messenger ### -# Choose one of the transports below -# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages -MESSENGER_TRANSPORT_DSN=doctrine://default -# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages -###< symfony/messenger ### diff --git a/tests/Application/.env.test b/tests/Application/.env.test deleted file mode 100644 index 79ffbf9..0000000 --- a/tests/Application/.env.test +++ /dev/null @@ -1,3 +0,0 @@ -APP_SECRET='ch4mb3r0f5ecr3ts' - -KERNEL_CLASS='Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Application\Kernel' diff --git a/tests/Application/.eslintrc.js b/tests/Application/.eslintrc.js deleted file mode 100644 index 92c4cee..0000000 --- a/tests/Application/.eslintrc.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - extends: 'airbnb-base', - env: { - node: true, - }, - rules: { - 'object-shorthand': ['error', 'always', { - avoidQuotes: true, - avoidExplicitReturnArrows: true, - }], - 'function-paren-newline': ['error', 'consistent'], - 'max-len': ['warn', 120, 2, { - ignoreUrls: true, - ignoreComments: false, - ignoreRegExpLiterals: true, - ignoreStrings: true, - ignoreTemplateLiterals: true, - }], - }, -}; diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore deleted file mode 100644 index bc600a8..0000000 --- a/tests/Application/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -/public/assets -/public/build -/public/css -/public/js -/public/media/* -!/public/media/image/ -/public/media/image/* -!/public/media/image/.gitignore - -/node_modules - -###> symfony/framework-bundle ### -/.env.*.local -/.env.local -/.env.local.php -/public/bundles -/var/ -/vendor/ -###< symfony/framework-bundle ### - -###> symfony/web-server-bundle ### -/.web-server-pid -###< symfony/web-server-bundle ### diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php deleted file mode 100644 index dd55e89..0000000 --- a/tests/Application/Kernel.php +++ /dev/null @@ -1,97 +0,0 @@ -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 ($this->isTestEnvironment() && class_exists(MockerContainer::class)) { - return MockerContainer::class; - } - - return parent::getContainerBaseClass(); - } - - private function isTestEnvironment(): bool - { - return 0 === strpos($this->getEnvironment(), 'test'); - } - - 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'; - $syliusConfigDir = $this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION; - if (is_dir($syliusConfigDir)) { - yield $syliusConfigDir; - } - $symfonyConfigDir = $this->getProjectDir() . '/config/symfony/' . BaseKernel::MAJOR_VERSION . '.' . BaseKernel::MINOR_VERSION; - if (is_dir($symfonyConfigDir)) { - yield $symfonyConfigDir; - } - } -} diff --git a/tests/Application/assets/admin/entry.js b/tests/Application/assets/admin/entry.js deleted file mode 100644 index 635f5ac..0000000 --- a/tests/Application/assets/admin/entry.js +++ /dev/null @@ -1 +0,0 @@ -import 'sylius/bundle/AdminBundle/Resources/private/entry'; diff --git a/tests/Application/assets/shop/entry.js b/tests/Application/assets/shop/entry.js deleted file mode 100644 index aadc317..0000000 --- a/tests/Application/assets/shop/entry.js +++ /dev/null @@ -1 +0,0 @@ -import 'sylius/bundle/ShopBundle/Resources/private/entry'; diff --git a/tests/Application/bin/console b/tests/Application/bin/console deleted file mode 100755 index a8fe7aa..0000000 --- a/tests/Application/bin/console +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env php -getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); -} - -if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); -} - -require dirname(__DIR__).'/config/bootstrap.php'; - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists(Debug::class)) { - Debug::enable(); - } -} - -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$application = new Application($kernel); -$application->run($input); diff --git a/tests/Application/composer.json b/tests/Application/composer.json deleted file mode 100644 index 326735f..0000000 --- a/tests/Application/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "sylius/plugin-skeleton-test-application", - "description": "Sylius application for plugin testing purposes (composer.json needed for project dir resolving)", - "license": "MIT" -} diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php deleted file mode 100644 index c9951a7..0000000 --- a/tests/Application/config/bootstrap.php +++ /dev/null @@ -1,27 +0,0 @@ -=1.2) -if (is_array($env = @include dirname(__DIR__) . '/.env.local.php')) { - $_SERVER += $env; - $_ENV += $env; -} elseif (!class_exists(Dotenv::class)) { - throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); -} elseif (method_exists(Dotenv::class, 'bootEnv')) { - (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); - - return; -} else { - // load all the .env files - (new Dotenv(true))->loadEnv(dirname(__DIR__) . '/.env'); -} - -$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; -$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; -$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php deleted file mode 100644 index 5920af2..0000000 --- a/tests/Application/config/bundles.php +++ /dev/null @@ -1,67 +0,0 @@ - ['all' => true], - Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], - Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], - Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], - Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], - Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true], - Sylius\Bundle\MoneyBundle\SyliusMoneyBundle::class => ['all' => true], - Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle::class => ['all' => true], - Sylius\Bundle\LocaleBundle\SyliusLocaleBundle::class => ['all' => true], - Sylius\Bundle\ProductBundle\SyliusProductBundle::class => ['all' => true], - Sylius\Bundle\ChannelBundle\SyliusChannelBundle::class => ['all' => true], - Sylius\Bundle\AttributeBundle\SyliusAttributeBundle::class => ['all' => true], - Sylius\Bundle\TaxationBundle\SyliusTaxationBundle::class => ['all' => true], - Sylius\Bundle\ShippingBundle\SyliusShippingBundle::class => ['all' => true], - Sylius\Bundle\PaymentBundle\SyliusPaymentBundle::class => ['all' => true], - Sylius\Bundle\MailerBundle\SyliusMailerBundle::class => ['all' => true], - Sylius\Bundle\PromotionBundle\SyliusPromotionBundle::class => ['all' => true], - Sylius\Bundle\AddressingBundle\SyliusAddressingBundle::class => ['all' => true], - Sylius\Bundle\InventoryBundle\SyliusInventoryBundle::class => ['all' => true], - Sylius\Bundle\TaxonomyBundle\SyliusTaxonomyBundle::class => ['all' => true], - Sylius\Bundle\UserBundle\SyliusUserBundle::class => ['all' => true], - Sylius\Bundle\CustomerBundle\SyliusCustomerBundle::class => ['all' => true], - Sylius\Bundle\UiBundle\SyliusUiBundle::class => ['all' => true], - Sylius\Bundle\ReviewBundle\SyliusReviewBundle::class => ['all' => true], - 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], - Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true], - Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true], - Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], - Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], - Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true], - Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true], - Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true], - Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true], - Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true], - Sandwich\ViesBundle\SandwichViesBundle::class => ['all' => true], - Webgriffe\SyliusItalianInvoiceableOrderPlugin\WebgriffeSyliusItalianInvoiceableOrderPlugin::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], - FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], - Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true], - ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], - Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], - Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], - SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], - BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], - Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], - League\FlysystemBundle\FlysystemBundle::class => ['all' => true], -]; -if (class_exists(Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class)) { - $bundles[Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class] = ['all' => true]; -} - -return $bundles; diff --git a/tests/Application/config/jwt/private.pem b/tests/Application/config/jwt/private.pem deleted file mode 100644 index 2bcf023..0000000 --- a/tests/Application/config/jwt/private.pem +++ /dev/null @@ -1,54 +0,0 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIJrTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIDbthk+aF5EACAggA -MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBA3DYfh2mXByUxFNke/Wf5SBIIJ -UBckIgXeXBWPLQAAq07pN8uNFMUcUirFuEvbmxVe1PupCCAqriNxi1DqeSu/M7c1 -h66y0BqKZu/0G9SVTg63iCKDEiRAM3hLyD2CsjYg8h2LAaqQ9dFYGV0cHRhCXagZ -Sdt9YTfn2rarRbxauMSt0z9zwCaiUrBU4JwSM3g+tD7W0lxAm9TeaqBZek5DIX+j -3Gom5tPYQe8jvfGMGdMPuanoEwH4WbWzGcqypWriy4JwaggwKCQ4ituWfa9kqMMC -8HRmBBDg0gtafmQP910RZh18JL2ewF5Pl7GDsLtOj5gNLNuAiQxDCcYRnD4/Cdsl -bH91btmGX1nUVIFViUTW93eBsjBgdgqOMRVxUKkSSX6CmIZWlE3AazgwSbvOvNrN -JGa8X21UwfuS/JHLmfRmgdti0YxRjJkBYLPpcd3ILsi+MMhSHy0uycAM/dB80Q1B -vkW1UXGbCw/PzA5yHrzULzAl69E3Tt5nTVMIIcBGxw2rf+ej+AVjsuOl7etwecdC -gnA90ViNlGOACLVnhsjd4WVF9Oircosf0UYoblwcT6gw1GSVF9pWuu7k5hy/7Pt/ -o1BvonUgz/4VHG+K58qvtnlto+JE0XWzPvukNUyggtekTLyoQCI3ZKge6ui3qLax -N6whHpzFnFVF3GJAisTk5naHFawHNvH7t85pmc+UnjNUUmyl9RStl9LMYDSBKNlR -LzPlJK27E5SLhhyJCni4+UYjH6PdlJuKXJ0365fufJ+5ajHRatwt039xLnK0W+oa -L35NxCuXrn8YxOgJIomt7IrkV3AuxoWxcx4lRFoM0WCdn9SWZVtfFFiyX/Xr1qDg -dUysw3/bePEkOKr5JWx09hT0OKDpkwLFo2Ljtvjln4EMXYEvvVqFciKw0kqF73Dw -NyoSubwR4qs6FQclKW1TAP6UW4B6ffq1iagKOCTZ5bBtsPBZk8UGCJb57q4fUj4P -nJy0hnSdlOH4Am+US4HF4ayOGuaV1Be1taurdJnt5cNnUYRah0wg4nG+wVdG5HJk -f4dJ4nih9d6WA/8LfxdpB7NCwdR+KK6lky+GgLSdhmIT9lzjj2GDsU4lBf29TkBn -lyt98/LWGrgCQgZAQ/obxLT8CZtY+tNejGoMppY+ub8DIaLBFID+fcz13kgA9x7a -TeVB8RPok+S3yHXP9a4WSFe9DGjjN+m7EnRtte7MEjyMoekXVnT04gNbTMoGAjNb -lrR4g3ICygZtsoGSB2VEu7o3azAspXNBMOuJfRCuC0LDXcjH3TbvjX0da5wHBoK9 -clRxu+CDo9A849HMkmSje8wED7ysZnkvSX0OdPjXahVd4t1tDRI6jSlzFo9fGcjp -S8Ikm9iMrHXaWcDdtcq4C63CjSynIBr4mNIxe/f2e9nynm3AIv+aOan891RWHqrd -DdpSSPShtzATI9PbB+b+S0Gw58Y8fpO7yoZ87VW1BMpadmFZ87YY78jdB7BwInNI -JqtnivinM6qCsvbdMoGinUyL6PUcfQGiEAibouKr3zNRDC4aesBZZmj7w0dnf+HK -YC905aR0cddlc6DBo/ed3o9krMcZ6oY/vruemPTc5G7Cg3t4H3mInRgURw22X1wo -FsioU1yOdkK+MYxvmGsQvQuSJhp7h1Uz37t/olkPRafZgy2nEtw6DQO0Dm4UfSsD -nysq6dn1WeZPkOipGBRgQmY1FTRzwPoCxi7+/EuHhD8hr962rHOglSuNqPG89J8r -wdbTDr8kgXj2A9p+jI3TVKEX+h6FEhrCHW9SHUqATOZ7RiNL6hKld9j0U4D9gQwZ -dflA0TxpVsHXm7pd1idkr46jIFgw7HA89Erm0Ty7RolfHkqlRca805AVmsKkviIz -sbF5uv4WzIE3ViO8P1KMUhCyElm72mpyNTXBhkxkup9hJ4fQieaN6pET6dQ2xyjs -SBIvQoXI0JQKpespcyAdoh88ULQjRUXEOaNFfN7q+itTcocwmPZfzW2nXORJT2p8 -SXLqSE73nYZdqzSYFq1hLcnlubJ7yPBYYG1fI0IydjSGKfnjtB0DReR32OToRZ7m -laduZ8O+IaBUY4Sp6QdYcVbGGpG/wsPmTQyScc/O2bfSI7AiPnL9EnwebI9sPSWQ -R0t0QMXZOSSqNY6jkYjsOCxeekRIdY6havo2Y52Ywti0QNrkT4BQ+175VVTmRMdy -LNaMFeEq6ehSEdaHaozvjHvP50HQT43tCK+RJiL+Gf9FqawoQRt693yO5LFbQsuw -QsUSMi41txpINMa+HEc2K5FvGoPr7FmajLK7X2fr+3c/yZ4fahoMKEAVFWl5kRYx -Fe1smlw1Vxl/qNQ32LFWsBIK+XnYBteYmlpVyYrTgXyjnp1rK2zz0118DPFuYiAP -O0r6nnBz0NbwnSKb7S4CjxBKDvDbWTzP35Q5L/vySnO2zRbM64Gw7sjeLiJittWS -gQfbFpEk9k8KVndKM4H50Jp0WznmYpm1Tman8hUOiCvmq0qdI3bJ5Bnj0K+q2zFV -+noGpMFdq1+8WaUFLQFGCPM+yJgCqDgT1RAgfsGcomckGcmenDtHaTbcSFabEdpM -Tsa2qLdg/Kju+7JyGrkmobXl/azuyjYTHfRvSZrvO5WUDFzhChrJpIL4nA3ZGRlS -gvy+OzyyBh4sRyHwLItwUwE81aya3W4llAkhQ7OycmqniJgjtJzLwnxv2RQsB8bF -pyoqQdKVxkqHdbUFeh9igI4ffRAK+8xDER5J+RUoZ4mO8qJebxar54XTb6I/Lepc -g8ITX8bJ/GH+M6JdP7tLCikDTSGS+i1ReMQXE5XuEajYOVbzQdyWU5jleZIx0f6X -mTa4WvMEGNyNxKZZXsy9FAaBkZqrNzEv8k0uFgFMNWQcMMtiqbei86yACdqe+jiW -HqHv8wfoBHR+eIARub2itOJ/cI+oKv96d4it4FqQ9Lml8RUFFZj7Hrd6EjDb6Nq4 -P9ti7eku/xZvS0saBNChvv44GhP6FZJS0i/gidVffLna7Wua98tPZEAXp57k+XUL -PzsRJ4a+hFuQjkyXFoz/v8YuUdyCFUSVVr9ArVu0v4+4euFWpQLav5sXv0Gh9X58 -Ek1KIf7Z/tZAJnSjTjFuSbDX/AoTMTxpRBKKnFW6zY0Nw2pjTVMtTVDkv9xkBpBK -wod7FPD5f0T7y9YOARVZnBxVRSkkcYpEJFy5pLNeadg9 ------END ENCRYPTED PRIVATE KEY----- diff --git a/tests/Application/config/jwt/public.pem b/tests/Application/config/jwt/public.pem deleted file mode 100644 index cb4e13d..0000000 --- a/tests/Application/config/jwt/public.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA6QkmF/Xi5nAYb8Kzr7qC -d63V2K+d/nCXbpDUKKDPJAqOtTlMoQSuJRLNnhhp7z1i/Cp4Bhifr20Pu2dq8JYg -6pRT4ctqvYb/MXxAaPZc3EcBC0S6AhgKO/fDvR3LcqYqGJmQQOXZvxTsgqongdvV -4XbqFBMMgngyayoBk0VKTaI/s+LQhIce+1QaxbAI0+/zbR0hZ1hWT73orJi3do+1 -TBzQol+V7WGa8LlJfmgM56qO3BmVkeTDMBc27pGp6g3+Oufk/l29jEGJlUT9yu7Q -BRhaQTWNVASa2aD+AKjVBzJh53O2zD8slAbjF1M9U7bbWN28Sv+xC/dUz0q9HnPu -RsY2tnwryqTyYn/Hf2xyP3/KvjJ6oslAwemu5JirdJkO7KVQAthWG42gLuhZg3ks -cSZhCLZH7nO2UDsf+2ZZgdbhpYZwR4gDRfNt7GKWXnWZOz9Uw1yVCPgylyZRZwg8 -l0y9aABdj3379I22icrwpMZbAgkyxNSV6UNJuxZksLUoP3i9OvXYgPYU9E4tU/Ul -Dm/T1rGSReGoPkU1YQnI50bq7p1byIoUu2scTflvpTVI5a7zULkS1tg60xk7vBRC -aBc7nr4UEtA235N6uLtcGxH11WBMwsKX69sSU0sQdC4Sk25zXM2gc8R1XV9K3qz2 -wQorQRlCwrkG44VRDgbFH+8CAwEAAQ== ------END PUBLIC KEY----- diff --git a/tests/Application/config/packages/_sylius.yaml b/tests/Application/config/packages/_sylius.yaml deleted file mode 100644 index 2b2ce07..0000000 --- a/tests/Application/config/packages/_sylius.yaml +++ /dev/null @@ -1,30 +0,0 @@ -imports: - - { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" } - - - { 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_shop: - product_grid: - include_all_descendants: true - -sylius_api: - enabled: true - -sylius_addressing: - resources: - address: - classes: - model: App\Entity\Addressing\Address - -sylius_order: - resources: - order: - classes: - model: App\Entity\Order\Order diff --git a/tests/Application/config/packages/api_platform.yaml b/tests/Application/config/packages/api_platform.yaml deleted file mode 100644 index b428304..0000000 --- a/tests/Application/config/packages/api_platform.yaml +++ /dev/null @@ -1,10 +0,0 @@ -api_platform: - mapping: - paths: - - '%kernel.project_dir%/../../vendor/sylius/sylius/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources' - - '%kernel.project_dir%/config/api_platform' - - '%kernel.project_dir%/src/Entity' - patch_formats: - json: ['application/merge-patch+json'] - swagger: - versions: [3] diff --git a/tests/Application/config/packages/assets.yaml b/tests/Application/config/packages/assets.yaml deleted file mode 100644 index 2468901..0000000 --- a/tests/Application/config/packages/assets.yaml +++ /dev/null @@ -1,7 +0,0 @@ -framework: - assets: - packages: - shop: - json_manifest_path: '%kernel.project_dir%/public/build/shop/manifest.json' - admin: - json_manifest_path: '%kernel.project_dir%/public/build/admin/manifest.json' diff --git a/tests/Application/config/packages/dev/framework.yaml b/tests/Application/config/packages/dev/framework.yaml deleted file mode 100644 index 4b116de..0000000 --- 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 2f32a9b..0000000 --- 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 da2b092..0000000 --- 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 4116679..0000000 --- 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 1f1cb2b..0000000 --- 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 deleted file mode 100644 index 040ee06..0000000 --- a/tests/Application/config/packages/doctrine.yaml +++ /dev/null @@ -1,22 +0,0 @@ -parameters: - # Adds a fallback DATABASE_URL if the env var is not set. - # This allows you to run cache:warmup even if your - # environment variables are not available yet. - # You should not need to change this value. - env(DATABASE_URL): '' - -doctrine: - dbal: - driver: 'pdo_mysql' - server_version: '5.7' - charset: UTF8 - - url: '%env(resolve:DATABASE_URL)%' - orm: - mappings: - App: - is_bundle: false - type: annotation - dir: '%kernel.project_dir%/src/Entity' - prefix: 'App' - alias: App diff --git a/tests/Application/config/packages/doctrine_migrations.yaml b/tests/Application/config/packages/doctrine_migrations.yaml deleted file mode 100644 index cdbc01a..0000000 --- a/tests/Application/config/packages/doctrine_migrations.yaml +++ /dev/null @@ -1,4 +0,0 @@ -doctrine_migrations: - storage: - table_storage: - table_name: sylius_migrations diff --git a/tests/Application/config/packages/fos_rest.yaml b/tests/Application/config/packages/fos_rest.yaml deleted file mode 100644 index eaebb27..0000000 --- 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 deleted file mode 100644 index 8be076b..0000000 --- a/tests/Application/config/packages/framework.yaml +++ /dev/null @@ -1,9 +0,0 @@ -framework: - secret: '%env(APP_SECRET)%' - form: true - csrf_protection: true - session: - handler_id: ~ - serializer: - mapping: - paths: [ '%kernel.project_dir%/config/serialization' ] diff --git a/tests/Application/config/packages/jms_serializer.yaml b/tests/Application/config/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc61..0000000 --- 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/lexik_jwt_authentication.yaml b/tests/Application/config/packages/lexik_jwt_authentication.yaml deleted file mode 100644 index edfb69d..0000000 --- a/tests/Application/config/packages/lexik_jwt_authentication.yaml +++ /dev/null @@ -1,4 +0,0 @@ -lexik_jwt_authentication: - secret_key: '%env(resolve:JWT_SECRET_KEY)%' - public_key: '%env(resolve:JWT_PUBLIC_KEY)%' - pass_phrase: '%env(JWT_PASSPHRASE)%' diff --git a/tests/Application/config/packages/liip_imagine.yaml b/tests/Application/config/packages/liip_imagine.yaml deleted file mode 100644 index bb2e7ce..0000000 --- a/tests/Application/config/packages/liip_imagine.yaml +++ /dev/null @@ -1,6 +0,0 @@ -liip_imagine: - resolvers: - default: - web_path: - web_root: "%kernel.project_dir%/public" - cache_prefix: "media/cache" diff --git a/tests/Application/config/packages/mailer.yaml b/tests/Application/config/packages/mailer.yaml deleted file mode 100644 index 56a650d..0000000 --- a/tests/Application/config/packages/mailer.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - mailer: - dsn: '%env(MAILER_DSN)%' diff --git a/tests/Application/config/packages/prod/doctrine.yaml b/tests/Application/config/packages/prod/doctrine.yaml deleted file mode 100644 index 2f16f0f..0000000 --- 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 c288182..0000000 --- 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 6461211..0000000 --- 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/routing.yaml b/tests/Application/config/packages/routing.yaml deleted file mode 100644 index 368bc7f..0000000 --- a/tests/Application/config/packages/routing.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - router: - strict_requirements: ~ diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/packages/security.yaml deleted file mode 100644 index 4ed342f..0000000 --- a/tests/Application/config/packages/security.yaml +++ /dev/null @@ -1,124 +0,0 @@ -security: - enable_authenticator_manager: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - - password_hashers: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - - new_api_admin_user: - pattern: "%sylius.security.new_api_admin_regex%/.*" - provider: sylius_api_admin_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_admin_route%/authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - new_api_shop_user: - pattern: "%sylius.security.new_api_shop_regex%/.*" - provider: sylius_api_shop_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_shop_route%/authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_homepage - invalidate_session: false - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - image_resolver: - pattern: ^/media/cache/resolve - 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%/login", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } - - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/packages/staging/monolog.yaml b/tests/Application/config/packages/staging/monolog.yaml deleted file mode 100644 index 6461211..0000000 --- a/tests/Application/config/packages/staging/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/stof_doctrine_extensions.yaml b/tests/Application/config/packages/stof_doctrine_extensions.yaml deleted file mode 100644 index 7770f74..0000000 --- a/tests/Application/config/packages/stof_doctrine_extensions.yaml +++ /dev/null @@ -1,4 +0,0 @@ -# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html -# See the official DoctrineExtensions documentation for more details: https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/ -stof_doctrine_extensions: - default_locale: '%locale%' diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml deleted file mode 100644 index fc1d3c1..0000000 --- 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 52610d6..0000000 --- a/tests/Application/config/packages/test/mailer.yaml +++ /dev/null @@ -1,5 +0,0 @@ -framework: - 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 7e2b9e3..0000000 --- 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 4071d31..0000000 --- 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 4d34199..0000000 --- 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/sylius_uploader.yaml b/tests/Application/config/packages/test/sylius_uploader.yaml deleted file mode 100644 index ab9d6ca..0000000 --- a/tests/Application/config/packages/test/sylius_uploader.yaml +++ /dev/null @@ -1,3 +0,0 @@ -services: - Sylius\Component\Core\Generator\ImagePathGeneratorInterface: - class: Sylius\Behat\Service\Generator\UploadedImagePathGenerator 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 03752de..0000000 --- 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/test_cached/doctrine.yaml b/tests/Application/config/packages/test_cached/doctrine.yaml deleted file mode 100644 index 4952860..0000000 --- a/tests/Application/config/packages/test_cached/doctrine.yaml +++ /dev/null @@ -1,16 +0,0 @@ -doctrine: - orm: - entity_managers: - default: - result_cache_driver: - type: memcached - host: localhost - port: 11211 - query_cache_driver: - type: memcached - host: localhost - port: 11211 - metadata_cache_driver: - type: memcached - host: localhost - port: 11211 diff --git a/tests/Application/config/packages/test_cached/fos_rest.yaml b/tests/Application/config/packages/test_cached/fos_rest.yaml deleted file mode 100644 index 2b4189d..0000000 --- a/tests/Application/config/packages/test_cached/fos_rest.yaml +++ /dev/null @@ -1,3 +0,0 @@ -fos_rest: - exception: - debug: true diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml deleted file mode 100644 index e9dd6ee..0000000 --- a/tests/Application/config/packages/test_cached/framework.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: ../test/framework.yaml } diff --git a/tests/Application/config/packages/test_cached/mailer.yaml b/tests/Application/config/packages/test_cached/mailer.yaml deleted file mode 100644 index 16f3170..0000000 --- a/tests/Application/config/packages/test_cached/mailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test/mailer.yaml" } diff --git a/tests/Application/config/packages/test_cached/monolog.yaml b/tests/Application/config/packages/test_cached/monolog.yaml deleted file mode 100644 index 7e2b9e3..0000000 --- a/tests/Application/config/packages/test_cached/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_cached/security.yaml b/tests/Application/config/packages/test_cached/security.yaml deleted file mode 100644 index 76e9273..0000000 --- a/tests/Application/config/packages/test_cached/security.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: ../test/security.yaml } diff --git a/tests/Application/config/packages/test_cached/sylius_channel.yaml b/tests/Application/config/packages/test_cached/sylius_channel.yaml deleted file mode 100644 index bab83ef..0000000 --- a/tests/Application/config/packages/test_cached/sylius_channel.yaml +++ /dev/null @@ -1,2 +0,0 @@ -sylius_channel: - debug: true diff --git a/tests/Application/config/packages/test_cached/sylius_theme.yaml b/tests/Application/config/packages/test_cached/sylius_theme.yaml deleted file mode 100644 index 4d34199..0000000 --- a/tests/Application/config/packages/test_cached/sylius_theme.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_theme: - sources: - test: ~ diff --git a/tests/Application/config/packages/test_cached/sylius_uploader.yaml b/tests/Application/config/packages/test_cached/sylius_uploader.yaml deleted file mode 100644 index cfa727e..0000000 --- a/tests/Application/config/packages/test_cached/sylius_uploader.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test/sylius_uploader.yaml" } diff --git a/tests/Application/config/packages/test_cached/twig.yaml b/tests/Application/config/packages/test_cached/twig.yaml deleted file mode 100644 index 8c6e0b4..0000000 --- a/tests/Application/config/packages/test_cached/twig.yaml +++ /dev/null @@ -1,2 +0,0 @@ -twig: - strict_variables: true diff --git a/tests/Application/config/packages/translation.yaml b/tests/Application/config/packages/translation.yaml deleted file mode 100644 index 1f4f966..0000000 --- a/tests/Application/config/packages/translation.yaml +++ /dev/null @@ -1,8 +0,0 @@ -framework: - default_locale: '%locale%' - translator: - paths: - - '%kernel.project_dir%/translations' - fallbacks: - - '%locale%' - - 'en' diff --git a/tests/Application/config/packages/twig.yaml b/tests/Application/config/packages/twig.yaml deleted file mode 100644 index 8545473..0000000 --- a/tests/Application/config/packages/twig.yaml +++ /dev/null @@ -1,12 +0,0 @@ -twig: - paths: ['%kernel.project_dir%/templates'] - debug: '%kernel.debug%' - strict_variables: '%kernel.debug%' - -services: - _defaults: - public: false - autowire: true - autoconfigure: true - - Twig\Extra\Intl\IntlExtension: ~ diff --git a/tests/Application/config/packages/validator.yaml b/tests/Application/config/packages/validator.yaml deleted file mode 100644 index 61807db..0000000 --- a/tests/Application/config/packages/validator.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - validation: - enable_annotations: true diff --git a/tests/Application/config/packages/webpack_encore.yaml b/tests/Application/config/packages/webpack_encore.yaml deleted file mode 100644 index 9bee248..0000000 --- a/tests/Application/config/packages/webpack_encore.yaml +++ /dev/null @@ -1,5 +0,0 @@ -webpack_encore: - output_path: '%kernel.project_dir%/public/build/default' - builds: - shop: '%kernel.project_dir%/public/build/shop' - admin: '%kernel.project_dir%/public/build/admin' diff --git a/tests/Application/config/routes/dev/web_profiler.yaml b/tests/Application/config/routes/dev/web_profiler.yaml deleted file mode 100644 index 3e79dc2..0000000 --- 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/liip_imagine.yaml b/tests/Application/config/routes/liip_imagine.yaml deleted file mode 100644 index 201cbd5..0000000 --- a/tests/Application/config/routes/liip_imagine.yaml +++ /dev/null @@ -1,2 +0,0 @@ -_liip_imagine: - resource: "@LiipImagineBundle/Resources/config/routing.yaml" diff --git a/tests/Application/config/routes/sylius_admin.yaml b/tests/Application/config/routes/sylius_admin.yaml deleted file mode 100644 index 1ba48d6..0000000 --- a/tests/Application/config/routes/sylius_admin.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_admin: - resource: "@SyliusAdminBundle/Resources/config/routing.yml" - prefix: /admin diff --git a/tests/Application/config/routes/sylius_api.yaml b/tests/Application/config/routes/sylius_api.yaml deleted file mode 100644 index ae01ffc..0000000 --- a/tests/Application/config/routes/sylius_api.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_api: - resource: "@SyliusApiBundle/Resources/config/routing.yml" - prefix: "%sylius.security.new_api_route%" diff --git a/tests/Application/config/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml deleted file mode 100644 index 92eeae0..0000000 --- a/tests/Application/config/routes/sylius_shop.yaml +++ /dev/null @@ -1,14 +0,0 @@ -sylius_shop: - resource: "@SyliusShopBundle/Resources/config/routing.yml" - prefix: /{_locale} - requirements: - _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" - -sylius_shop_default_locale: - path: / - methods: [GET] - defaults: - _controller: sylius.controller.shop.locale_switch:switchAction diff --git a/tests/Application/config/routes/test/routing.yaml b/tests/Application/config/routes/test/routing.yaml deleted file mode 100644 index 0ca57d9..0000000 --- a/tests/Application/config/routes/test/routing.yaml +++ /dev/null @@ -1,5 +0,0 @@ -sylius_test_plugin_main: - path: /test/main - controller: FrameworkBundle:Template:template - defaults: - template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/routes/test/sylius_test_plugin.yaml b/tests/Application/config/routes/test/sylius_test_plugin.yaml deleted file mode 100644 index 0ca57d9..0000000 --- a/tests/Application/config/routes/test/sylius_test_plugin.yaml +++ /dev/null @@ -1,5 +0,0 @@ -sylius_test_plugin_main: - path: /test/main - controller: FrameworkBundle:Template:template - defaults: - template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/routes/test_cached/routing.yaml b/tests/Application/config/routes/test_cached/routing.yaml deleted file mode 100644 index 0ca57d9..0000000 --- a/tests/Application/config/routes/test_cached/routing.yaml +++ /dev/null @@ -1,5 +0,0 @@ -sylius_test_plugin_main: - path: /test/main - controller: FrameworkBundle:Template:template - defaults: - template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/routes/test_cached/sylius_test_plugin.yaml b/tests/Application/config/routes/test_cached/sylius_test_plugin.yaml deleted file mode 100644 index 0ca57d9..0000000 --- a/tests/Application/config/routes/test_cached/sylius_test_plugin.yaml +++ /dev/null @@ -1,5 +0,0 @@ -sylius_test_plugin_main: - path: /test/main - controller: FrameworkBundle:Template:template - defaults: - template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/services.yaml b/tests/Application/config/services.yaml deleted file mode 100644 index 52c81f8..0000000 --- a/tests/Application/config/services.yaml +++ /dev/null @@ -1,5 +0,0 @@ -# Put parameters here that don't need to change on each machine where the app is deployed -# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration -parameters: - locale: en_US - sylius.form.type.address.validation_groups: ['Default'] diff --git a/tests/Application/config/services_test.yaml b/tests/Application/config/services_test.yaml deleted file mode 100644 index b24cc3b..0000000 --- a/tests/Application/config/services_test.yaml +++ /dev/null @@ -1,11 +0,0 @@ -imports: - - { resource: "../../Behat/Resources/services.xml" } - - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } - -parameters: - app.taxation.eu_zone_code: 'EU' - -# workaround needed for strange "test.client.history" problem -# see https://github.com/FriendsOfBehat/SymfonyExtension/issues/88 -services: - Symfony\Component\BrowserKit\AbstractBrowser: '@test.client' diff --git a/tests/Application/config/services_test_cached.yaml b/tests/Application/config/services_test_cached.yaml deleted file mode 100644 index 0de380e..0000000 --- a/tests/Application/config/services_test_cached.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "services_test.yaml" } diff --git a/tests/Application/package.json b/tests/Application/package.json deleted file mode 100644 index 32ccdc4..0000000 --- a/tests/Application/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "dependencies": { - "@babel/polyfill": "^7.0.0", - "chart.js": "^3.7.1", - "jquery": "^3.5.0", - "jquery.dirtyforms": "^2.0.0", - "lightbox2": "^2.9.0", - "semantic-ui-css": "^2.2.0", - "slick-carousel": "^1.8.1" - }, - "devDependencies": { - "@babel/core": "^7.0.0", - "@babel/plugin-external-helpers": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.18.9", - "@babel/preset-env": "^7.18.10", - "@babel/register": "^7.0.0", - "@rollup/plugin-babel": "^5.3.1", - "@rollup/plugin-commonjs": "^22.0.2", - "@rollup/plugin-inject": "^4.0.4", - "@rollup/plugin-node-resolve": "^13.3.0", - "@semantic-ui-react/css-patch": "^1.1.2", - "@symfony/webpack-encore": "^3.1.0", - "babel-plugin-fast-async": "^6.1.2", - "babel-plugin-module-resolver": "^4.1.0", - "dedent": "^0.7.0", - "eslint": "^8.23.0", - "eslint-config-airbnb-base": "^15.0.0", - "eslint-import-resolver-babel-module": "^5.3.1", - "eslint-plugin-import": "^2.26.0", - "fast-async": "^6.3.8", - "gulp": "^4.0.2", - "gulp-chug": "^0.5.1", - "gulp-concat": "^2.6.1", - "gulp-debug": "^4.0.0", - "gulp-if": "^3.0.0", - "gulp-livereload": "^4.0.2", - "gulp-order": "^1.2.0", - "gulp-sass": "^5.1.0", - "gulp-sourcemaps": "^3.0.0", - "gulp-uglifycss": "^1.1.0", - "merge-stream": "^2.0.0", - "rollup": "^2.79.0", - "rollup-plugin-terser": "^7.0.2", - "sass": "^1.54.8", - "sass-loader": "^13.0.0", - "upath": "^2.0.1", - "yargs": "^17.5.1" - }, - "engines": { - "node": "^14 || ^16 || ^18" - }, - "engineStrict": true, - "scripts": { - "watch": "encore dev --watch", - "build": "encore dev", - "build:prod": "encore production", - "gulp": "gulp build", - "lint": "yarn lint:js", - "lint:js": "eslint gulpfile.babel.js src/Sylius/Bundle/AdminBundle/gulpfile.babel.js src/Sylius/Bundle/ShopBundle/gulpfile.babel.js src/Sylius/Bundle/UiBundle/Resources/private/js src/Sylius/Bundle/AdminBundle/Resources/private/js src/Sylius/Bundle/ShopBundle/Resources/private/js", - "postinstall": "semantic-ui-css-patch" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Sylius/Sylius.git" - }, - "author": "Paweł Jędrzejewski", - "license": "MIT" -} diff --git a/tests/Application/public/.htaccess b/tests/Application/public/.htaccess deleted file mode 100644 index 99ed00d..0000000 --- a/tests/Application/public/.htaccess +++ /dev/null @@ -1,25 +0,0 @@ -DirectoryIndex app.php - - - RewriteEngine On - - RewriteCond %{HTTP:Authorization} ^(.*) - RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] - - RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ - RewriteRule ^(.*) - [E=BASE:%1] - - RewriteCond %{ENV:REDIRECT_STATUS} ^$ - RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] - - RewriteCond %{REQUEST_FILENAME} -f - RewriteRule .? - [L] - - RewriteRule .? %{ENV:BASE}/index.php [L] - - - - - RedirectMatch 302 ^/$ /index.php/ - - diff --git a/tests/Application/public/favicon.ico b/tests/Application/public/favicon.ico deleted file mode 100644 index 592f7a8e45d5ef6fe2a3c0426b5276e463480ba5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32038 zcmeHQ4NO#5+NN=dA;z$#F^w_CnoZLsP17~T#Xl;F2&jmH2&jNc5hrj3LAj!gs&t%y8h&WqvL*7f{zp z4)@%9&(C|_bMAZI^S;kHI5@oL@H>a!|K0(=4;>Ev&cR_LiG66eFU9i;Jp0q1M(;mz zaM(HD!NJ|#aR0~k4i5jf%E94}xFtn=i142NFVY|%_s1~Id)y#t`KwdG&99urH=>+# z8zP)V^?RLjYQvl_)rZgFrsdveR0cX9m#)4WFIhPpFIh1ben9+e?fNHI+JYBw^RVwv z$lN49NL(3iI4)hmWHxVPa+I4(*y-8vlO^lIx%tRF$$R#iJCmjKB4H#?9pJ~#N8+dD z-XDYJmo)#0(p5}K_1cm14I8_1+x!n@DZPhA^D~#*wjE;U&#c_xlqg%H>Y*8O4jwIBRhZLjaaALh67Ft-CvemR&6_6*bz3L zzAx79bIw-!JTv6?etD%m_#^s`&sC(_8b|9!*-?D*&@{ze`<${{H$5WxL3f?;aJF1?zbuz`L-`v?sX(Vy86}eVs==C`|%K8 zyz&(d39?nMvTpj8)#&2Q_A%eOA-mmB?f{j6e6GnAZp_6NuMu%u&~Co~N8G?`BJNao=TB1%47=yy`hE)7q8H zrAdm_m`~RkwVl*Y0%X-ag)ZiOZat>%MGcY8n6taA)tOMbk~v-J#+sB?r}FOBD_12Vbwn7Th#u`K}l#*m@@6(flyYX(l?TRK<2p2@uFspoA@>!#5)FxSTZRQ>m@yc0hQbBU7H$G%=_-TE_h3#+_`zOoql$~}Bo8C5%7#p=K& zS{8WwGkAQc^j6G5F6|QSeh=tE!!#|ug71S8ZMYjZy{UWXJ4-It?^{%Vzh2*_(p%B1 zb6U5&L|f|$+IMZP?my;aDj#_!YTa5(>ttU+f3mqe)}B}N9`Y>hI`E0LbP~m_l})UD7Ra<-P=-uK{73Ab+0^P;3HYPr2-TgzXh4RyhI9OTvy9ruW}yh6OsYu_Q_ z)_qy!r-V)_*xYN5PUyjlp^Ls?*N^$;xl|kBVlI!6&-2tfQ`mKr_!afe7$NI0S5}$s z%LV9nBUuaGy0-0p#-w#wb9GpH4mos`-FEQ(Npa_Xn{{DJb#dQe4e~zLJ^J;Jfd=o9 zf{s1m+;mfQk8dlQ-FB=&q{@f+6ZE|MkfV40r^c+zw1vLf{-bj+&)lQ+XWsN4ENF}P zm|Iq5@3+pft^?7{znq)LeP_?TxP50(R*ONWAUake=HpXk8>87}Lf2UYxnBpl%xm6Z z=d~6uY~Qm4^Qn^5eWqru-X4MZ@)6d8`uVlE^9wi3Sr5@iN!H4;^*z>*b8?#f5{^q( zjp^jcWg8C{bc93_xi3=rbz@CA*Vgj+=7WB)Er=JLZ@S zL=Aggvaf}?WY>hbz^0?WlDMcL{3F$@?}44ja10?Q8J+B1-R{8Pjp=^b`BYg(gqf zD!iCnRY0b^^J}YX^2yN4P7Ax)>@!!l1YvAEHqUc*U(i0G?V#_*pQqKcY&$L9&qS@; zBlFa|rew~!P!qf?sdT;4VE>}D&_19vv7b}AOiG^Kx)b41B=Uo2Nd)hySHW8ay27D%T&A`4wS02Q=EwKLfX}i~rmD*&-^r`?a z$jRIM#yq8$UMKcJLdgo)``kx)Pi?y7Iv$7rtWnarZ^9ag@|5rOeC75ULX1Mp!b!ai%WtqL~VIj7}bV%Us9JG=i0 zZz+Gdaiqi8CiIf;llTmXKlVb?Myw?^J-`~O?6S)LA)8h+@e$a-nx&o5HuXV$Z-!%9 zg9fZ@t9$c zpB&hX@;id#WVa%1T05jy_%DOqR!jK)y`J|5{I!?+=|uNXNFUl!ppS>MCouD9{)=^gc}kTILn>U$ewBptqR57@zt=AnX)-76tm z^nPMXZNRq++jz81_PYN5BF8g|O-axXUVwJcyy^v!JxL`ViVN4aRcADM4Uus%Cbu!~ zV>~>=`n(zI#bbqM{%yiK{c88ubIBOWR(cPx#|bx1Y+m{8yNqlfe0WaNq*rWP zmsGO;SB#yWuT^4J_rBWLTzYBktX~P^4@RE zj@9DM$WPG5E=znz*{|Re5trVIvdK4Bt2sI6O5>O7fIV@Qwj6P$J_FLWtGd5b_$}V}$a7d(CUxL3lsGp3iO%FbrymcCX+%Xw#jPd9tp^B$Qu% zMI9V1?TlQCvCVsKtm-?m5N-a+K&xq)Lu}MVn!N#c|F=r;HGt+`p7Yh-xMkALeG6-J z-}B-(oB#N3L&5tAek96!^yvutCm((lv*V9l-gL%gx1v6RKTt_&HE|tAzg{ov`tqac zq>E2o)qUU2F3{|WfIkD6qH*1Z9fu6~wV-`ZKyBX-lkQhOG}x1-Koh*+vTAF&US`1$ zVuJS!WNu)^}#b!_YqzU#-o z_Ymf({6fv1*HYe)_O-P9FbjUq42n5nk00ni-Nl;yZk_ieg6lVYd21~le8?{FBR(?X zJ?7o)R-fU5_TAByy2I0IW41;w`@KXR>x6YzyfN)$&h;M3Rr`yHKa8E88z+A0AAhTu zF&zRpto(9&bset}vStBBY$cao_Py#smJ@JDpQ#_@%!m$G(|;7}^4*7_!(+Z0 z*K>d^AIfapnk8=j!mPi&viI;Dv@b-`x%Wu(-E%Xd2VpLC$x&|6vgawXK28RXFG1$k zm!jBY60=mO3I70V(p2bh3aQpQCX3x?LdJ_Up{^JwJyg#mv=jUxv8@n$Z;HYvjbXaS zvjM1^4@Qz%x6LCgYK)z+J~&b0_8{lxwtUzy z^t5B$^%%A|yKvM~)u!C*QBGOc_ACWnx6Xh)ch&EYx!CNbx1V6#3|?su$t>3$nm<)E z2vII@B=gQy_{L$M&d+4ck~L~)#MrNcoo+^C{bbuEQN_S+80-VRq8of4f?oZ!NVCst zvgOQVdV*tvO>;SH(PG#mQh}$LF9)P zbn}7WwA>MnBT$@{1NO9Xe|-D%UApQ0e%|r>&E+@nb91rp(bZA_e$LfW$Y}_31&+>a z0H#iGUz$*3?#$KADZnDVI9cLuHYCbEe_<(L|2llbrbA+h+l$Nw-@al^6tDehLbZ!e zIp?c(>`N?JH-qH^11gk=P``9Nb#(ve;#;*tL;>u+Ch8`i?YN{*)zKHl5HV@~k zcg67Om#I#p)QRRNmw8D|(JSOLg8R{9XGU#Vz+>D7E^^sax6fMnXUqM*AIHEEOv=;* zF0PNPJ%M@366p@i*xCWu(Li8!pH5YqX}Kq`f0yplX4^7h?-&%fh3vD|M^o{>NO|bf zWcfxFrEw~+DOI13V}n?>T*3?BI(!G8%<+E^;%CW;y*OPU9|eX5Vr@` z0{a3hbbgE?iGi&4i_$bDo z=;&m=qUWy|)9XXdA$tISMP_N&K`&r+O@5=mOz(z2W)vqh?zcBC%lJ9Q&?B7N;=`uh z-nd-(x25>z;cw)A^D7vfQ}+sd`RQ!6=g?X7G11LQADf~P_=zF0dWQ=B?8EZj*iRTn zX?DGWvuWl69|&xwar-RYV^73Lp*H-Oz3pY^2VQ>;@cOx|whv=JbM?6NdNYt`PjSYEMAjJlFBmP-J z`r6NxZ;iuVivi4ccT?nElJgb*v7-9O<&}NuqnHt$W3e_|%%u}D3;0vWGtHjlivGX4 z)!)zHjol$@iu{gU*h^r(t=xCmXK+`cJ1FSc4cITRP~31ZI;TD?u&D8?CD<=8p$*si zkNM2qGr@1)x-H9GPRKAf|2UC16)P|)%mYCEX zxI7?hf@^*8OHGyYCO*SnnonT2c))F^se8;ZFNtpWCbrWY%~v`Cj{p-tVyeB|XILYp z%NhG+tvOnz`+4*I#6LjS1wPcez61T4oKxpA-84>ReZ`#-M{-(ytoA+5=z9uWY~WPV zGTmikAJhlX+pXI-TD+Npj$pyp^wZs5ZhhFp#>>7TZVzf~{`ul!ZvHp|UANU!2`2@9P*+a9Cd8>NA^8{wgtbHR# zwS}zdUkf~wknJXA#mC3b!oC*lKQ*uCld*yQ3~$Yvp3TEjUCc5|_6_JlJvF!gzKos6 zS{(aAXW#yHO|j2E7a~j#5d1Oro;ZpqghzPnd*OX78vmx z;{PY4@}W_xjSPUC(B`!TO5cPzvix@JBAj_(@@yyK6Q+AfPsr9j6xHvuFz?A{VNY)y zupRin9f9|-Cw46#e$8~6J9p%>u@5;O`vRY``=5+^f`4H77MXLEez^?%DqNbC4=*kd zw+E-d_BVtz(=co%Z=7z3eb9lJ`&D$WB*6p_i~zg+z>q$}o&ZmF`>T5Xz8tnuDZw=m z{$VWT_CF~y=`&~NdmZCAhyByMwgAz^n?A#d@>ND{r+hfA@XjS;hS0C*{?ZTgqKb|i z_=b9jpWtHU1v# zgI)*htODm>P8bL0>wWIR?qh`gz?w0a=sSG*{3fI$n5tC8=7hwOwR-G0!Fh7=?PTmj z-gnjgc=C-N_m=ttd&z@R%e}QkCUWsJIFDcen3-@(`QL_j*o%(!!M1$-Urr-E3G-ft z(gIfKZD>1f1J-`?^4oVG10Nobj(ausvjZ!|AD{X*qy_eKJ7j&W?AC$Mx1l|@v;k)U dEVL!xyFC9{-^#oGwy(dr=K;LC|IgyU{{uV>Qo;ZL diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php deleted file mode 100644 index 95525fb..0000000 --- a/tests/Application/public/index.php +++ /dev/null @@ -1,29 +0,0 @@ -handle($request); -$response->send(); -$kernel->terminate($request, $response); diff --git a/tests/Application/public/robots.txt b/tests/Application/public/robots.txt deleted file mode 100644 index 214e411..0000000 --- a/tests/Application/public/robots.txt +++ /dev/null @@ -1,4 +0,0 @@ -# www.robotstxt.org/ -# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 - -User-agent: * diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js deleted file mode 100644 index 599e371..0000000 --- a/tests/Application/webpack.config.js +++ /dev/null @@ -1,49 +0,0 @@ -const path = require('path'); -const Encore = require('@symfony/webpack-encore'); - -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.resolve.alias['chart.js/dist/Chart.min'] = path.resolve(__dirname, 'node_modules/chart.js/dist/chart.min.js'); -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.resolve.alias['chart.js/dist/Chart.min'] = path.resolve(__dirname, 'node_modules/chart.js/dist/chart.min.js'); -adminConfig.externals = Object.assign({}, adminConfig.externals, { window: 'window', document: 'document' }); -adminConfig.name = 'admin'; - -module.exports = [shopConfig, adminConfig]; diff --git a/tests/Behat/Resources/suites.yml b/tests/Behat/Resources/suites.yml index ee38cee..8aa3d97 100644 --- a/tests/Behat/Resources/suites.yml +++ b/tests/Behat/Resources/suites.yml @@ -30,7 +30,7 @@ default: - webgriffe_sylius_italian_invoiceable_order.behat.context.ui.shop.checkout.complete filters: - tags: "@filling_invoicing_information && @ui" + tags: "@filling_invoicing_information&&@ui" ui_invoiceable_address_book: contexts: @@ -59,7 +59,7 @@ default: - webgriffe_sylius_italian_invoiceable_order.behat.context.ui.shop.checkout.addressing filters: - tags: "@invoiceable_address_book && @ui" + tags: "@invoiceable_address_book&&@ui" ui_applying_taxes: contexts: @@ -88,4 +88,4 @@ default: - webgriffe_sylius_italian_invoiceable_order.behat.context.ui.shop.checkout.addressing filters: - tags: "@applying_taxes && @ui" + tags: "@applying_taxes&&@ui" diff --git a/tests/Application/config/secrets/test/.gitignore b/tests/Functional/.gitignore similarity index 100% rename from tests/Application/config/secrets/test/.gitignore rename to tests/Functional/.gitignore diff --git a/tests/Application/config/secrets/test_cached/.gitignore b/tests/Integration/.gitignore similarity index 100% rename from tests/Application/config/secrets/test_cached/.gitignore rename to tests/Integration/.gitignore diff --git a/tests/TestApplication/.env b/tests/TestApplication/.env new file mode 100644 index 0000000..dc0d36a --- /dev/null +++ b/tests/TestApplication/.env @@ -0,0 +1,7 @@ +DATABASE_URL=mysql://root@127.0.0.1/webgriffe_sylius_italian_invoiceable_order_plugin_%kernel.environment% + +BEHAT_BASE_URL="https://127.0.0.1:8080/" + +SYLIUS_TEST_APP_BUNDLES_PATH="tests/TestApplication/config/bundles.php" +SYLIUS_TEST_APP_CONFIGS_TO_IMPORT="@WebgriffeSyliusItalianInvoiceableOrderPlugin/tests/TestApplication/config/config.yaml" +SYLIUS_TEST_APP_ROUTES_TO_IMPORT="@WebgriffeSyliusItalianInvoiceableOrderPlugin/tests/TestApplication/config/routes.yaml" diff --git a/tests/TestApplication/.env.test b/tests/TestApplication/.env.test new file mode 100644 index 0000000..71083d5 --- /dev/null +++ b/tests/TestApplication/.env.test @@ -0,0 +1 @@ +DATABASE_URL=mysql://root@127.0.0.1/webgriffe_sylius_italian_invoiceable_order_plugin_%kernel.environment% diff --git a/tests/TestApplication/config/bundles.php b/tests/TestApplication/config/bundles.php new file mode 100644 index 0000000..e0d1d17 --- /dev/null +++ b/tests/TestApplication/config/bundles.php @@ -0,0 +1,5 @@ + ['all' => true], +]; diff --git a/tests/TestApplication/config/config.yaml b/tests/TestApplication/config/config.yaml new file mode 100644 index 0000000..4124382 --- /dev/null +++ b/tests/TestApplication/config/config.yaml @@ -0,0 +1,7 @@ +imports: + - { resource: "@WebgriffeSyliusItalianInvoiceableOrderPlugin/config/config.yaml" } + - { resource: "services_test.php" } + +twig: + paths: + '%kernel.project_dir%/../../../tests/TestApplication/templates': ~ diff --git a/tests/Application/config/serialization/.gitignore b/tests/TestApplication/config/routes.yaml similarity index 100% rename from tests/Application/config/serialization/.gitignore rename to tests/TestApplication/config/routes.yaml diff --git a/tests/TestApplication/config/services_test.php b/tests/TestApplication/config/services_test.php new file mode 100644 index 0000000..ac73c31 --- /dev/null +++ b/tests/TestApplication/config/services_test.php @@ -0,0 +1,14 @@ +env(), 'test')) { +//parameters: +// app.taxation.eu_zone_code: 'EU' + $container->import('../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml'); + $container->import('@WebgriffeSyliusItalianInvoiceableOrderPlugin/tests/Behat/Resources/services.xml'); + } +}; diff --git a/tests/Application/config/validator/Address.xml b/tests/TestApplication/config/validator/Address.xml similarity index 100% rename from tests/Application/config/validator/Address.xml rename to tests/TestApplication/config/validator/Address.xml diff --git a/tests/Application/config/validator/Order.xml b/tests/TestApplication/config/validator/Order.xml similarity index 100% rename from tests/Application/config/validator/Order.xml rename to tests/TestApplication/config/validator/Order.xml diff --git a/tests/Application/src/Entity/.gitignore b/tests/TestApplication/src/Entity/.gitignore similarity index 100% rename from tests/Application/src/Entity/.gitignore rename to tests/TestApplication/src/Entity/.gitignore diff --git a/tests/Application/src/Entity/Addressing/Address.php b/tests/TestApplication/src/Entity/Addressing/Address.php similarity index 100% rename from tests/Application/src/Entity/Addressing/Address.php rename to tests/TestApplication/src/Entity/Addressing/Address.php diff --git a/tests/Application/src/Entity/Order/Order.php b/tests/TestApplication/src/Entity/Order/Order.php similarity index 100% rename from tests/Application/src/Entity/Order/Order.php rename to tests/TestApplication/src/Entity/Order/Order.php diff --git a/tests/Application/templates/.gitignore b/tests/TestApplication/templates/.gitignore similarity index 100% rename from tests/Application/templates/.gitignore rename to tests/TestApplication/templates/.gitignore diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig rename to tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Common/_address.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/_address.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusAdminBundle/Common/_address.html.twig rename to tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/_address.html.twig diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig rename to tests/TestApplication/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Security/_content.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/Security/_content.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusAdminBundle/Security/_content.html.twig rename to tests/TestApplication/templates/bundles/SyliusAdminBundle/Security/_content.html.twig diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/_scripts.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig rename to tests/TestApplication/templates/bundles/SyliusAdminBundle/_scripts.html.twig diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/_styles.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig rename to tests/TestApplication/templates/bundles/SyliusAdminBundle/_styles.html.twig diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig rename to tests/TestApplication/templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig rename to tests/TestApplication/templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Common/_address.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/Common/_address.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusShopBundle/Common/_address.html.twig rename to tests/TestApplication/templates/bundles/SyliusShopBundle/Common/_address.html.twig diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig rename to tests/TestApplication/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig rename to tests/TestApplication/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/_scripts.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig rename to tests/TestApplication/templates/bundles/SyliusShopBundle/_scripts.html.twig diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/_styles.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig rename to tests/TestApplication/templates/bundles/SyliusShopBundle/_styles.html.twig diff --git a/tests/Application/translations/.gitignore b/tests/Unit/.gitignore similarity index 100% rename from tests/Application/translations/.gitignore rename to tests/Unit/.gitignore diff --git a/src/Resources/translations/messages+intl-icu.en.yaml b/translations/messages+intl-icu.en.yaml similarity index 100% rename from src/Resources/translations/messages+intl-icu.en.yaml rename to translations/messages+intl-icu.en.yaml diff --git a/src/Resources/translations/messages+intl-icu.it.yaml b/translations/messages+intl-icu.it.yaml similarity index 100% rename from src/Resources/translations/messages+intl-icu.it.yaml rename to translations/messages+intl-icu.it.yaml diff --git a/src/Resources/translations/validators+intl-icu.en.yaml b/translations/validators+intl-icu.en.yaml similarity index 100% rename from src/Resources/translations/validators+intl-icu.en.yaml rename to translations/validators+intl-icu.en.yaml diff --git a/src/Resources/translations/validators+intl-icu.it.yaml b/translations/validators+intl-icu.it.yaml similarity index 100% rename from src/Resources/translations/validators+intl-icu.it.yaml rename to translations/validators+intl-icu.it.yaml From 5b617c20f19dff844293d19d4304d499ccdd1482 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Fri, 9 Jan 2026 17:55:28 +0100 Subject: [PATCH 02/28] Decorates new classes --- config/services/services.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/config/services/services.yaml b/config/services/services.yaml index bff1845..1221eea 100644 --- a/config/services/services.yaml +++ b/config/services/services.yaml @@ -1,5 +1,5 @@ parameters: - app.taxation.eu_zone_code: ~ + app.taxation.eu_zone_code: 'EU' services: webgriffe_sylius_italian_invoiceable_order.form.extension.italian_invoiceable_address: @@ -9,17 +9,18 @@ services: webgriffe_sylius_italian_invoiceable_order.address_comparator: class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Comparator\ItalianInvoiceableAddressComparatorDecorator - decorates: sylius.address_comparator + decorates: sylius.comparator.address arguments: - '@webgriffe_sylius_italian_invoiceable_order.address_comparator.inner' app.taxation.italian_tax_calculation_strategy: - class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianTaxCalculation + class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianTaxCalculationStrategy arguments: - 'italian_tax_calculation_strategy' - - - - '@sylius.taxation.order_item_units_taxes_applicator' - - '@sylius.taxation.order_shipment_taxes_applicator' + - [ + '@sylius.applicator.taxation.order_item_units', + '@sylius.applicator.taxation.order_shipment' + ] - '%app.taxation.eu_zone_code%' tags: - { name: sylius.taxation.calculation_strategy, type: italian_tax_calculation_strategy, label: 'Italian tax calculation' } From ed221a86fbe301302a76b736a2d42e410a4d1f1e Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Tue, 13 Jan 2026 16:33:28 +0100 Subject: [PATCH 03/28] Add migration directly in the plugin and adapts models/entities by using attributes --- src/Migrations/.gitkeep | 0 src/Migrations/Version20260109151240.php | 21 ++++++++ src/Model/ItalianInvoiceableAddressTrait.php | 48 ++++++------------- src/Model/ItalianTaxCalculationStrategy.php | 8 ++-- tests/TestApplication/config/config.yaml | 23 +++++++++ .../src/Entity/Addressing/Address.php | 8 ++-- .../src/Entity/Order/Order.php | 8 ++-- 7 files changed, 67 insertions(+), 49 deletions(-) create mode 100644 src/Migrations/.gitkeep create mode 100644 src/Migrations/Version20260109151240.php diff --git a/src/Migrations/.gitkeep b/src/Migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/Migrations/Version20260109151240.php b/src/Migrations/Version20260109151240.php new file mode 100644 index 0000000..f2287c3 --- /dev/null +++ b/src/Migrations/Version20260109151240.php @@ -0,0 +1,21 @@ +addSql('ALTER TABLE sylius_address ADD billing_recipient_type VARCHAR(255) DEFAULT NULL, ADD tax_code VARCHAR(255) DEFAULT NULL, ADD vat_number VARCHAR(255) DEFAULT NULL, ADD sdi_code VARCHAR(255) DEFAULT NULL, ADD pec_address VARCHAR(255) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE sylius_address DROP billing_recipient_type, DROP tax_code, DROP vat_number, DROP sdi_code, DROP pec_address'); + } +} diff --git a/src/Model/ItalianInvoiceableAddressTrait.php b/src/Model/ItalianInvoiceableAddressTrait.php index 627e9be..9e6c13c 100644 --- a/src/Model/ItalianInvoiceableAddressTrait.php +++ b/src/Model/ItalianInvoiceableAddressTrait.php @@ -8,40 +8,20 @@ trait ItalianInvoiceableAddressTrait { - /** - * @var string|null - * - * @ORM\Column(name="billing_recipient_type", type="string", nullable=true) - */ - private $billingRecipientType; - - /** - * @var string|null - * - * @ORM\Column(name="tax_code", type="string", nullable=true) - */ - private $taxCode; - - /** - * @var string|null - * - * @ORM\Column(name="vat_number", type="string", nullable=true) - */ - private $vatNumber; - - /** - * @var string|null - * - * @ORM\Column(name="sdi_code", type="string", nullable=true) - */ - private $sdiCode; - - /** - * @var string|null - * - * @ORM\Column(name="pec_address", type="string", nullable=true) - */ - private $pecAddress; + #[ORM\Column(name: 'billing_recipient_type', type: 'string', nullable: true)] + private ?string $billingRecipientType = null; + + #[ORM\Column(name: 'tax_code', type: 'string', nullable: true)] + private ?string $taxCode = null; + + #[ORM\Column(name: 'vat_number', type: 'string', nullable: true)] + private ?string $vatNumber = null; + + #[ORM\Column(name: 'sdi_code', type: 'string', nullable: true)] + private ?string $sdiCode = null; + + #[ORM\Column(name: 'pec_address', type: 'string', nullable: true)] + private ?string $pecAddress = null; public function getBillingRecipientType(): ?string { diff --git a/src/Model/ItalianTaxCalculationStrategy.php b/src/Model/ItalianTaxCalculationStrategy.php index cb4762f..c739b0c 100644 --- a/src/Model/ItalianTaxCalculationStrategy.php +++ b/src/Model/ItalianTaxCalculationStrategy.php @@ -13,14 +13,12 @@ final class ItalianTaxCalculationStrategy implements TaxCalculationStrategyInterface { - /** @var string */ - private $type; + private string $type; /** @var OrderTaxesApplicatorInterface[] */ - private $applicators; + private array $applicators; - /** @var string */ - private $euTaxZoneCode; + private string $euTaxZoneCode; /** * @param OrderTaxesApplicatorInterface[] $applicators diff --git a/tests/TestApplication/config/config.yaml b/tests/TestApplication/config/config.yaml index 4124382..a5119c8 100644 --- a/tests/TestApplication/config/config.yaml +++ b/tests/TestApplication/config/config.yaml @@ -5,3 +5,26 @@ imports: twig: paths: '%kernel.project_dir%/../../../tests/TestApplication/templates': ~ + +doctrine: + orm: + entity_managers: + default: + mappings: + TestApplication: + is_bundle: false + type: attribute + dir: '%kernel.project_dir%/../../../tests/TestApplication/src/Entity' + prefix: Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin + +sylius_addressing: + resources: + address: + classes: + model: Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Entity\Addressing\Address + +sylius_order: + resources: + order: + classes: + model: Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Entity\Order\Order diff --git a/tests/TestApplication/src/Entity/Addressing/Address.php b/tests/TestApplication/src/Entity/Addressing/Address.php index 079f7a3..9bf3df0 100644 --- a/tests/TestApplication/src/Entity/Addressing/Address.php +++ b/tests/TestApplication/src/Entity/Addressing/Address.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Entity\Addressing; +namespace Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Entity\Addressing; use Doctrine\ORM\Mapping as ORM; use Sylius\Component\Core\Model\Address as BaseAddress; @@ -10,10 +10,8 @@ use Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressInterface; use Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressTrait; -/** - * @ORM\Entity - * @ORM\Table(name="sylius_address") - */ +#[ORM\Entity] +#[ORM\Table(name: 'sylius_address')] class Address extends BaseAddress implements ItalianInvoiceableAddressInterface, GroupSequenceProviderInterface { use ItalianInvoiceableAddressTrait; diff --git a/tests/TestApplication/src/Entity/Order/Order.php b/tests/TestApplication/src/Entity/Order/Order.php index dbfde59..7ff7abb 100644 --- a/tests/TestApplication/src/Entity/Order/Order.php +++ b/tests/TestApplication/src/Entity/Order/Order.php @@ -2,17 +2,15 @@ declare(strict_types=1); -namespace App\Entity\Order; +namespace Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Entity\Order; use Doctrine\ORM\Mapping as ORM; use Sylius\Component\Core\Model\Order as BaseOrder; use Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableOrderInterface; use Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableOrderTrait; -/** - * @ORM\Entity - * @ORM\Table(name="sylius_order") - */ +#[ORM\Entity] +#[ORM\Table(name: 'sylius_order')] class Order extends BaseOrder implements ItalianInvoiceableOrderInterface { use ItalianInvoiceableOrderTrait; From 5ac672297e91fbf7238a6bd2950997def7034aac Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Tue, 13 Jan 2026 16:36:27 +0100 Subject: [PATCH 04/28] Moves all templates under new dir structure and/or use twig hooks --- config/twig_hooks/admin/order/update.yaml | 16 +++++++ config/twig_hooks/shop/address.yaml | 10 +++++ config/twig_hooks/shop/form/address.yaml | 9 ++++ .../address/billingRecipientType.html.twig | 3 ++ .../address/invoiceableBillingData.html.twig | 12 +++++ .../shared/helper/address.html.twig | 13 ++++++ .../address/billingAddressInfo.html.twig | 17 +++++++ ...kSelectInvoiceableDataAttributes.html.twig | 5 --- .../Common/_invoiceableAddressInfo.html.twig | 19 -------- .../address/billingAddressInfo.html.twig | 3 ++ .../address/billingRecipientType.html.twig | 9 ++++ .../address/invoiceableBillingData.html.twig | 12 +++++ .../Common/Form/_address.html.twig | 31 ------------- .../Common/_address.html.twig | 13 ------ .../SyliusAdminBundle/Layout/_logo.html.twig | 5 --- .../Security/_content.html.twig | 6 --- .../SyliusAdminBundle/_scripts.html.twig | 1 - .../SyliusAdminBundle/_styles.html.twig | 1 - .../shared/helper/address.html.twig | 12 +++++ .../Address/_addressBookSelect.html.twig | 27 ------------ .../Common/Form/_address.html.twig | 44 ------------------- .../Common/_address.html.twig | 15 ------- .../Homepage/_banner.html.twig | 9 ---- .../Layout/Header/_logo.html.twig | 5 --- .../SyliusShopBundle/_scripts.html.twig | 1 - .../SyliusShopBundle/_styles.html.twig | 1 - 26 files changed, 116 insertions(+), 183 deletions(-) create mode 100644 config/twig_hooks/admin/order/update.yaml create mode 100644 config/twig_hooks/shop/address.yaml create mode 100644 config/twig_hooks/shop/form/address.yaml create mode 100644 templates/admin/shared/form/address/billingRecipientType.html.twig create mode 100644 templates/admin/shared/form/address/invoiceableBillingData.html.twig create mode 100644 templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig create mode 100644 templates/shared/address/billingAddressInfo.html.twig delete mode 100644 templates/shop/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig delete mode 100644 templates/shop/Common/_invoiceableAddressInfo.html.twig create mode 100644 templates/shop/shared/address/billingAddressInfo.html.twig create mode 100644 templates/shop/shared/form/address/billingRecipientType.html.twig create mode 100644 templates/shop/shared/form/address/invoiceableBillingData.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/_address.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusAdminBundle/Security/_content.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusAdminBundle/_scripts.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusAdminBundle/_styles.html.twig create mode 100644 tests/TestApplication/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusShopBundle/Common/_address.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusShopBundle/_scripts.html.twig delete mode 100644 tests/TestApplication/templates/bundles/SyliusShopBundle/_styles.html.twig diff --git a/config/twig_hooks/admin/order/update.yaml b/config/twig_hooks/admin/order/update.yaml new file mode 100644 index 0000000..eef9861 --- /dev/null +++ b/config/twig_hooks/admin/order/update.yaml @@ -0,0 +1,16 @@ +sylius_twig_hooks: + hooks: + 'sylius_admin.order.update.content.form.billing_address': + billingRecipientType: + template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/billingRecipientType.html.twig' + priority: 1000 + invoiceableBillingData: + template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/invoiceableBillingData.html.twig' + priority: 650 + 'sylius_admin.order.update.content.form.shipping_address': + billingRecipientType: + template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/billingRecipientType.html.twig' + priority: 1000 + invoiceableBillingData: + template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/invoiceableBillingData.html.twig' + priority: 650 diff --git a/config/twig_hooks/shop/address.yaml b/config/twig_hooks/shop/address.yaml new file mode 100644 index 0000000..27ff383 --- /dev/null +++ b/config/twig_hooks/shop/address.yaml @@ -0,0 +1,10 @@ +sylius_twig_hooks: + hooks: + 'sylius_shop.shared.address': + company: + enabled: false + name: + enabled: false + billingAddressInfo: + template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shop/shared/address/billingAddressInfo.html.twig' + priority: 1000 diff --git a/config/twig_hooks/shop/form/address.yaml b/config/twig_hooks/shop/form/address.yaml new file mode 100644 index 0000000..3b45e65 --- /dev/null +++ b/config/twig_hooks/shop/form/address.yaml @@ -0,0 +1,9 @@ +sylius_twig_hooks: + hooks: + 'sylius_shop.shared.form.address': + billingRecipientType: + template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shop/shared/form/address/billingRecipientType.html.twig' + priority: 1000 + invoiceableBillingData: + template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shop/shared/form/address/invoiceableBillingData.html.twig' + priority: 650 diff --git a/templates/admin/shared/form/address/billingRecipientType.html.twig b/templates/admin/shared/form/address/billingRecipientType.html.twig new file mode 100644 index 0000000..c965623 --- /dev/null +++ b/templates/admin/shared/form/address/billingRecipientType.html.twig @@ -0,0 +1,3 @@ +
+ {{ form_row(hookable_metadata.context.form.billingRecipientType) }} +
diff --git a/templates/admin/shared/form/address/invoiceableBillingData.html.twig b/templates/admin/shared/form/address/invoiceableBillingData.html.twig new file mode 100644 index 0000000..ef0caae --- /dev/null +++ b/templates/admin/shared/form/address/invoiceableBillingData.html.twig @@ -0,0 +1,12 @@ +
+ {{ form_row(hookable_metadata.context.form.taxCode) }} +
+
+ {{ form_row(hookable_metadata.context.form.vatNumber) }} +
+
+ {{ form_row(hookable_metadata.context.form.sdiCode) }} +
+
+ {{ form_row(hookable_metadata.context.form.pecAddress) }} +
diff --git a/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig b/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig new file mode 100644 index 0000000..dad6ce4 --- /dev/null +++ b/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig @@ -0,0 +1,13 @@ +{% macro address(address) %} +
+ dsadas + {% include '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shared/address/billingAddressInfo.html.twig' with { address } only %} + {{ address.phoneNumber }}
+ {{ address.street }}
+ {{ address.city }}
+ {% if address|sylius_province_name is not empty %} + {{ address|sylius_province_name }}
+ {% endif %} + {{ address.countryCode|sylius_country_name|upper }} {{ address.postcode }} +
+{% endmacro %} diff --git a/templates/shared/address/billingAddressInfo.html.twig b/templates/shared/address/billingAddressInfo.html.twig new file mode 100644 index 0000000..fa43813 --- /dev/null +++ b/templates/shared/address/billingAddressInfo.html.twig @@ -0,0 +1,17 @@ +{% if address.billingRecipientType == constant('Webgriffe\\SyliusItalianInvoiceableOrderPlugin\\Model\\ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_COMPANY') %} + {% if address.company is not null %} + {{ address.company }} + {% endif %} + {% if address.vatNumber is defined and address.vatNumber is not null %} + {{ 'webgriffe_sylius_italian_invoiceable_order.ui.address.vat_number_short'|trans }}: {{ address.vatNumber }} + {% endif %} + {{ address.fullName }} +{% else %} + {{ address.fullName }} + {% if address.taxCode is defined and address.taxCode is not null %} + {{ 'webgriffe_sylius_italian_invoiceable_order.ui.address.tax_code_short'|trans }}: {{ address.taxCode }} + {% endif %} + {% if address.company is not null %} + {{ address.company }} + {% endif %} +{% endif %} diff --git a/templates/shop/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig b/templates/shop/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig deleted file mode 100644 index b062bf6..0000000 --- a/templates/shop/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -data-billing-recipient-type="{{ address.billingRecipientType }}" -data-tax-code="{{ address.taxCode }}" -data-vat-number="{{ address.vatNumber }}" -data-sdi-code="{{ address.sdiCode }}" -data-pec-address="{{ address.pecAddress }}" diff --git a/templates/shop/Common/_invoiceableAddressInfo.html.twig b/templates/shop/Common/_invoiceableAddressInfo.html.twig deleted file mode 100644 index bb5ccd4..0000000 --- a/templates/shop/Common/_invoiceableAddressInfo.html.twig +++ /dev/null @@ -1,19 +0,0 @@ -{% if address.billingRecipientType == constant('Webgriffe\\SyliusItalianInvoiceableOrderPlugin\\Model\\ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_COMPANY') %} - {% if address.company %} - {{ address.company }}
- {% endif %} - {% if address.vatNumber %} - {{ 'webgriffe_sylius_italian_invoiceable_order.ui.address.vat_number_short'|trans }}: - {{ address.vatNumber }}
- {% endif %} - {{ address.firstName }} {{ address.lastName }}
-{% else %} - {{ address.firstName }} {{ address.lastName }}
- {% if address.taxCode %} - {{ 'webgriffe_sylius_italian_invoiceable_order.ui.address.tax_code_short'|trans }}: - {{ address.taxCode }}
- {% endif %} - {% if address.company %} - {{ address.company }}
- {% endif %} -{% endif %} diff --git a/templates/shop/shared/address/billingAddressInfo.html.twig b/templates/shop/shared/address/billingAddressInfo.html.twig new file mode 100644 index 0000000..73207e3 --- /dev/null +++ b/templates/shop/shared/address/billingAddressInfo.html.twig @@ -0,0 +1,3 @@ +{% set address = hookable_metadata.context.address %} + +{% include '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shared/address/billingAddressInfo.html.twig' with { address } only %} diff --git a/templates/shop/shared/form/address/billingRecipientType.html.twig b/templates/shop/shared/form/address/billingRecipientType.html.twig new file mode 100644 index 0000000..5b85457 --- /dev/null +++ b/templates/shop/shared/form/address/billingRecipientType.html.twig @@ -0,0 +1,9 @@ +{% if hookable_metadata.context.type is defined %} + {% set type = hookable_metadata.context.type ~ '-' %} +{% else %} + {% set type = null %} +{% endif %} + +{% if type != 'shipping-' %} + {{ form_row(hookable_metadata.context.form.billingRecipientType, sylius_test_form_attribute(type ~ 'billing-recipient-type')) }} +{% endif %} diff --git a/templates/shop/shared/form/address/invoiceableBillingData.html.twig b/templates/shop/shared/form/address/invoiceableBillingData.html.twig new file mode 100644 index 0000000..bb12a40 --- /dev/null +++ b/templates/shop/shared/form/address/invoiceableBillingData.html.twig @@ -0,0 +1,12 @@ +{% if hookable_metadata.context.type is defined %} + {% set type = hookable_metadata.context.type ~ '-' %} +{% else %} + {% set type = null %} +{% endif %} + +{% if type != 'shipping-' %} + {{ form_row(hookable_metadata.context.form.taxCode, sylius_test_form_attribute(type ~ 'tax-code')) }} + {{ form_row(hookable_metadata.context.form.vatNumber, sylius_test_form_attribute(type ~ 'vat-number')) }} + {{ form_row(hookable_metadata.context.form.sdiCode, sylius_test_form_attribute(type ~ 'sdi-code')) }} + {{ form_row(hookable_metadata.context.form.pecAddress, sylius_test_form_attribute(type ~ 'pec-address')) }} +{% endif %} diff --git a/tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig deleted file mode 100644 index 4bb5318..0000000 --- a/tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig +++ /dev/null @@ -1,31 +0,0 @@ -{% set shouldShowInvoiceableFields = form.parent.vars.data.billingAddress.id is defined and form.vars.data.id is defined and form.parent.vars.data.billingAddress.id == form.vars.data.id %} - -{% if shouldShowInvoiceableFields %} - {{ form_row(form.billingRecipientType) }} -{% endif %} - -
- {{ form_row(form.firstName) }} - {{ form_row(form.lastName) }} -
- -{% if shouldShowInvoiceableFields %} - {{ form_row(form.taxCode) }} - {{ form_row(form.vatNumber) }} - {{ form_row(form.sdiCode) }} - {{ form_row(form.pecAddress) }} -{% endif %} - -{{ form_row(form.company) }} -{{ form_row(form.street) }} -{{ form_row(form.countryCode) }} -
- {% if form.provinceCode is defined %} - {{ form_row(form.provinceCode, {'attr': {'class': 'ui dropdown'}}) }} - {% endif %} -
-
- {{ form_row(form.city) }} - {{ form_row(form.postcode) }} -
-{{ form_row(form.phoneNumber) }} diff --git a/tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/_address.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/_address.html.twig deleted file mode 100644 index 144278d..0000000 --- a/tests/TestApplication/templates/bundles/SyliusAdminBundle/Common/_address.html.twig +++ /dev/null @@ -1,13 +0,0 @@ -{% import "@SyliusUi/Macro/flags.html.twig" as flags %} - -
- {% include '@WebgriffeSyliusItalianInvoiceableOrderPlugin/Common/_invoiceableAddressInfo.html.twig' %} - {{ address.phoneNumber }}
- {{ address.street }}
- {{ address.city }}
- {% if address|sylius_province_name is not empty %} - {{ address|sylius_province_name }}
- {% endif %} - {{ flags.fromCountryCode(address.countryCode) }} - {{ address.countryCode|sylius_country_name|upper }} {{ address.postcode }} -
diff --git a/tests/TestApplication/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig deleted file mode 100644 index 1d9fa7d..0000000 --- a/tests/TestApplication/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig +++ /dev/null @@ -1,5 +0,0 @@ - -
- -
-
diff --git a/tests/TestApplication/templates/bundles/SyliusAdminBundle/Security/_content.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/Security/_content.html.twig deleted file mode 100644 index ce17621..0000000 --- a/tests/TestApplication/templates/bundles/SyliusAdminBundle/Security/_content.html.twig +++ /dev/null @@ -1,6 +0,0 @@ -{% include '@SyliusUi/Security/_login.html.twig' - with { - 'action': path('sylius_admin_login_check'), - 'paths': {'logo': asset('build/admin/images/logo.png', 'admin')} -} -%} diff --git a/tests/TestApplication/templates/bundles/SyliusAdminBundle/_scripts.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/_scripts.html.twig deleted file mode 100644 index f5f9835..0000000 --- a/tests/TestApplication/templates/bundles/SyliusAdminBundle/_scripts.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_script_tags('admin-entry', null, 'admin') }} diff --git a/tests/TestApplication/templates/bundles/SyliusAdminBundle/_styles.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/_styles.html.twig deleted file mode 100644 index a96144c..0000000 --- a/tests/TestApplication/templates/bundles/SyliusAdminBundle/_styles.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_link_tags('admin-entry', null, 'admin') }} diff --git a/tests/TestApplication/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig b/tests/TestApplication/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig new file mode 100644 index 0000000..cd75ee9 --- /dev/null +++ b/tests/TestApplication/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig @@ -0,0 +1,12 @@ +{% macro address(address) %} +
+ {% include '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shared/address/billingAddressInfo.html.twig' with { address } only %} + {{ address.phoneNumber }}
+ {{ address.street }}
+ {{ address.city }}
+ {% if address|sylius_province_name is not empty %} + {{ address|sylius_province_name }}
+ {% endif %} + {{ address.countryCode|sylius_country_name|upper }} {{ address.postcode }} +
+{% endmacro %} diff --git a/tests/TestApplication/templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig deleted file mode 100644 index 90cae99..0000000 --- a/tests/TestApplication/templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig +++ /dev/null @@ -1,27 +0,0 @@ -{% if app.user is not empty and app.user.customer is not empty and app.user.customer.addresses|length > 0 %} - -{% endif %} diff --git a/tests/TestApplication/templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig deleted file mode 100644 index 1b2cd9b..0000000 --- a/tests/TestApplication/templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig +++ /dev/null @@ -1,44 +0,0 @@ -{% if type is defined %} - {% set type = type ~ '-' %} -{% else %} - {% set type = null %} -{% endif %} - -{% if type != 'shipping-' %} - {{ form_row(form.billingRecipientType, sylius_test_form_attribute(type ~ 'billing-recipient-type')) }} -{% endif %} - -
- {{ form_row(form.firstName, sylius_test_form_attribute(type ~ 'first-name')) }} - {{ form_row(form.lastName, sylius_test_form_attribute(type ~ 'last-name')) }} -
- -{% if type != 'shipping-' %} - {{ form_row(form.taxCode, sylius_test_form_attribute(type ~ 'tax-code')) }} - {{ form_row(form.vatNumber, sylius_test_form_attribute(type ~ 'vat-number')) }} - {{ form_row(form.sdiCode, sylius_test_form_attribute(type ~ 'sdi-code')) }} - {{ form_row(form.pecAddress, sylius_test_form_attribute(type ~ 'pec-address')) }} -{% endif %} - -{{ form_row(form.company, sylius_test_form_attribute(type ~ 'company')) }} -{{ form_row(form.street, sylius_test_form_attribute(type ~ 'street')) }} - -{% include '@SyliusShop/Common/Form/_countryCode.html.twig' with {'form': form.countryCode} %} - -
- {% if form.provinceCode is defined %} - {{ form_row(form.provinceCode, sylius_test_form_attribute('province-code')|sylius_merge_recursive( {'attr': {'class': 'ui dropdown'}})) }} - {% elseif form.provinceName is defined %} - {{ form_row(form.provinceName, sylius_test_form_attribute('province-name')) }} - {% endif %} -
- -{% if form.provinceCode is defined %} - {{ form_errors(form) }} -{% endif %} - -
- {{ form_row(form.city, sylius_test_form_attribute(type ~ 'city')) }} - {{ form_row(form.postcode, sylius_test_form_attribute(type ~ 'postcode')) }} -
-{{ form_row(form.phoneNumber) }} diff --git a/tests/TestApplication/templates/bundles/SyliusShopBundle/Common/_address.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/Common/_address.html.twig deleted file mode 100644 index fe9261f..0000000 --- a/tests/TestApplication/templates/bundles/SyliusShopBundle/Common/_address.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% import "@SyliusUi/Macro/flags.html.twig" as flags %} - -
- {% include '@WebgriffeSyliusItalianInvoiceableOrderPlugin/Common/_invoiceableAddressInfo.html.twig' %} - {% if address.phoneNumber is not null %} - {{ address.phoneNumber }}
- {% endif %} - {{ address.street }}
- {{ address.city }}, {{ address.postcode }}
- {% if address|sylius_province_name is not empty %} - {{ address|sylius_province_name }}
- {% endif %} - {{ flags.fromCountryCode(address.countryCode) }} - {{ address.countryCode|sylius_country_name|upper }} -
diff --git a/tests/TestApplication/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig deleted file mode 100644 index 8486493..0000000 --- a/tests/TestApplication/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -
-
- {{ 'sylius.homepage.banner_content'|trans }} -
-
-
{{ 'sylius.homepage.banner_content'|trans }}
- {{ 'sylius.homepage.banner_button'|trans }} -
-
diff --git a/tests/TestApplication/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig deleted file mode 100644 index 84b8df5..0000000 --- a/tests/TestApplication/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/tests/TestApplication/templates/bundles/SyliusShopBundle/_scripts.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/_scripts.html.twig deleted file mode 100644 index d1655bb..0000000 --- a/tests/TestApplication/templates/bundles/SyliusShopBundle/_scripts.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_script_tags('shop-entry', null, 'shop') }} diff --git a/tests/TestApplication/templates/bundles/SyliusShopBundle/_styles.html.twig b/tests/TestApplication/templates/bundles/SyliusShopBundle/_styles.html.twig deleted file mode 100644 index fd2c7cb..0000000 --- a/tests/TestApplication/templates/bundles/SyliusShopBundle/_styles.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_link_tags('shop-entry', null, 'shop') }} From 930b6c99b64e6a567b93ac2f4f50bcff136604c8 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Tue, 13 Jan 2026 16:38:03 +0100 Subject: [PATCH 05/28] Use new modifier to add new fields on checkout address form --- config/services/services.yaml | 5 +++ src/Modifier/AddressFormValuesModifier.php | 37 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/Modifier/AddressFormValuesModifier.php diff --git a/config/services/services.yaml b/config/services/services.yaml index 1221eea..7ea3265 100644 --- a/config/services/services.yaml +++ b/config/services/services.yaml @@ -24,3 +24,8 @@ services: - '%app.taxation.eu_zone_code%' tags: - { name: sylius.taxation.calculation_strategy, type: italian_tax_calculation_strategy, label: 'Italian tax calculation' } + + webgriffe_sylius_italian_invoiceable_order.modifier.address_form_values: + class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Modifier\AddressFormValuesModifier + tags: + - { name: sylius_shop.modifier.address_form_values } diff --git a/src/Modifier/AddressFormValuesModifier.php b/src/Modifier/AddressFormValuesModifier.php new file mode 100644 index 0000000..35fe338 --- /dev/null +++ b/src/Modifier/AddressFormValuesModifier.php @@ -0,0 +1,37 @@ + $addressData + * + * @return array + */ + public function modify(array $addressData, AddressInterface $address): array + { + Assert::isInstanceOf( + $address, + ItalianInvoiceableAddressInterface::class, + sprintf( + 'Address must be an instance of %s to modify its form values.', + ItalianInvoiceableAddressInterface::class, + ), + ); + $addressData['billingRecipientType'] = $address->getBillingRecipientType(); + $addressData['taxCode'] = $address->getTaxCode(); + $addressData['vatNumber'] = $address->getVatNumber(); + $addressData['sdiCode'] = $address->getSdiCode(); + $addressData['pecAddress'] = $address->getPecAddress(); + + return $addressData; + } +} From 6ca5b125e09198f426133bc152866a30a0c63eff Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Tue, 13 Jan 2026 16:38:23 +0100 Subject: [PATCH 06/28] Updates README --- README.md | 187 ++++++++++-------------------------------------------- 1 file changed, 34 insertions(+), 153 deletions(-) diff --git a/README.md b/README.md index ff4111d..0f49583 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,13 @@ Webgriffe\SyliusItalianInvoiceableOrderPlugin\WebgriffeSyliusItalianInvoiceableOrderPlugin::class => ['all' => true], ``` -3. Define a value for the parameter `app.taxation.eu_zone_code`, which must be the code of a zone representing the EU. This is used to determine if an order is invoiced to a company within the EU or not. +3. By default, the parameter `app.taxation.eu_zone_code` is set to "EU", as it must be the code of a zone representing the EU. This is used to determine if an order is invoiced to a company within the EU or not. Please change this parameter according to your Sylius's zone configuration if needed: + + ```yaml + # config/services.yaml + parameters: + app.taxation.eu_zone_code: 'EU' # Change it if needed + ``` 4. Your `Address` entity must implement the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressInterface` and the `Symfony\Component\Validator\GroupSequenceProviderInterface`. You can use the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressTrait` as implementation for both interfaces. @@ -34,8 +40,8 @@ ```bash mkdir -p config/validator/ - cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/Application/config/validator/Address.xml config/validator/ - cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/Application/config/validator/Order.xml config/validator/ + cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validator/Address.xml config/validator/ + cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validator/Order.xml config/validator/ ``` Or by merging the configuration into your existing `Address` and `Order` validator configuration. @@ -53,172 +59,47 @@ For more information see [here](https://symfony.com/doc/current/validation/sequence_provider.html). -9. Run a diff of your Doctrine's migrations and then run it: +9. Run migration ```bash vendor/bin/console cache:clear - vendor/bin/console doctrine:migrations:diff vendor/bin/console doctrine:migrations:migrate ``` -10. Add invoiceable address fields to your shop address form template. To do so you have to override the template: + +10. Add invoiceable fields to the address show template for admin. To do so you have to override this template: ```bash - cp vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/views/Common/Form/_address.html.twig templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig + vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/templates/shared/helper/address.html.twig ``` - Then in the `templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig` you must add the following: - + by copying directly our implementation provided in the plugin: + + ```bash + cp tests/TestApplication/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig + ``` + + or by copying the original template and adding the invoiceable fields by yourself. In this case your template should look like the following: + ```twig - {# templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig #} - {% if type != 'shipping-' %} - {{ form_row(form.billingRecipientType, sylius_test_form_attribute(type ~ 'billing-recipient-type')) }} - {{ form_row(form.taxCode, sylius_test_form_attribute(type ~ 'tax-code')) }} - {{ form_row(form.vatNumber, sylius_test_form_attribute(type ~ 'vat-number')) }} - {{ form_row(form.sdiCode, sylius_test_form_attribute(type ~ 'sdi-code')) }} - {{ form_row(form.pecAddress, sylius_test_form_attribute(type ~ 'pec-address')) }} - {% endif %} + {% macro address(address) %} +
+ {% include '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shared/address/billingAddressInfo.html.twig' with { address } only %} + {{ address.phoneNumber }}
+ {{ address.street }}
+ {{ address.city }}
+ {% if address|sylius_province_name is not empty %} + {{ address|sylius_province_name }}
+ {% endif %} + {{ address.countryCode|sylius_country_name|upper }} {{ address.postcode }} +
+ {% endmacro %} ``` - - You can put the fields in the order you want but we recommend to surround them with the `{% if type != 'shipping-' %}` check. In this way you'll not show those fields in the shipping address section of the checkout where these fields are not relevant. - -11. Add invoiceable address fields to your admin address form template. To do so you have to override the template: - - ```bash - cp vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/Resources/views/Common/Form/_address.html.twig templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig - ``` - - Then in the `templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig` you must add the invoiceable fields. You should add those fields only if the form is bound to the billing address of an order. To do so, your template should like the following: - - ```twig - {# templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig #} - {% set shouldShowInvoiceableFields = form.parent.vars.data.billingAddress.id is defined and form.vars.data.id is defined and form.parent.vars.data.billingAddress.id == form.vars.data.id %} - - {% if shouldShowInvoiceableFields %} - {{ form_row(form.billingRecipientType) }} - {% endif %} - -
- {{ form_row(form.firstName) }} - {{ form_row(form.lastName) }} -
- - {% if shouldShowInvoiceableFields %} - {{ form_row(form.taxCode) }} - {{ form_row(form.vatNumber) }} - {{ form_row(form.sdiCode) }} - {{ form_row(form.pecAddress) }} - {% endif %} - - {{ form_row(form.company) }} - {{ form_row(form.street) }} - {{ form_row(form.countryCode) }} -
- {% if form.provinceCode is defined %} - {{ form_row(form.provinceCode, {'attr': {'class': 'ui dropdown'}}) }} - {% endif %} -
-
- {{ form_row(form.city) }} - {{ form_row(form.postcode) }} -
- {{ form_row(form.phoneNumber) }} - ``` - -12. Add invoiceable fields to the address show template for admin and shop. To do so you have to override those templates: - - ```bash - cp vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/views/Common/_address.html.twig templates/bundles/SyliusShopBundle/Common/_address.html.twig - cp vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/Resources/views/Common/_address.html.twig templates/bundles/SyliusAdminBundle/Common/_address.html.twig - ``` - - And replace the printing of company, first name and last name with the invoiceable address information template provided by this plugin. Then, those templates should look like the following: - - ```twig - {# templates/bundles/SyliusShopBundle/Common/_address.html.twig #} - {% import "@SyliusUi/Macro/flags.html.twig" as flags %} - -
- {% include '@WebgriffeSyliusItalianInvoiceableOrderPlugin/Common/_invoiceableAddressInfo.html.twig' %} - {% if address.phoneNumber is not null %} - {{ address.phoneNumber }}
- {% endif %} - {{ address.street }}
- {{ address.city }}, {{ address.postcode }}
- {% if address|sylius_province_name is not empty %} - {{ address|sylius_province_name }}
- {% endif %} - {{ flags.fromCountryCode(address.countryCode) }} - {{ address.countryCode|sylius_country_name|upper }} -
- ``` - - ```twig - {# templates/bundles/SyliusAdminBundle/Common/_address.html.twig #} - {% import "@SyliusUi/Macro/flags.html.twig" as flags %} - -
- {% include '@WebgriffeSyliusItalianInvoiceableOrderPlugin/Common/_invoiceableAddressInfo.html.twig' %} - {{ address.phoneNumber }}
- {{ address.street }}
- {{ address.city }}
- {% if address|sylius_province_name is not empty %} - {{ address|sylius_province_name }}
- {% endif %} - {{ flags.fromCountryCode(address.countryCode) }} - {{ address.countryCode|sylius_country_name|upper }} {{ address.postcode }} -
- ``` - -13. Add invoiceable fields to the address book select data attributes. To do so you have to override the address book select template: - - ```bash - cp vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/views/Checkout/Address/_addressBookSelect.html.twig templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig - ``` - - And include the invoiceable fields data attributes template provided by this plugin: - - ```twig - {% include '@WebgriffeSyliusItalianInvoiceableOrderPlugin/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig' %} - ``` - - You have to add it in the proper location, just after the other data attributes of the address book select tag. So the whole address book template should look like the following: - - ```twig - {# templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig #} - {% if app.user is not empty and app.user.customer is not empty and app.user.customer.addresses|length > 0 %} - - {% endif %} - ``` ## Features Once installed this plugin will allow the users of the shop to enter all the invoicing information needed by an Italian company to properly invoice the order. -In addition this plugin checks the billing data of the order and uses them to decide whether the customer has to pay taxes or not. +In addition, this plugin checks the billing data of the order and uses them to decide whether the customer has to pay taxes or not. This plugin will add the following fields to your address form: From 8f04cbd73f805f299e9871068a2a6d88902ca4d8 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Tue, 13 Jan 2026 17:07:05 +0100 Subject: [PATCH 07/28] Temporarily use mmenozzi/ViesBundle branch that is compatible with symfony 7 --- composer.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2e54eba..bcc940d 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "require": { "php": "^8.2", "dragonbe/vies": "^2.3.2", - "sandwich/vies-bundle": "^2.1", + "sandwich/vies-bundle": "dev-patch-1", "sylius/sylius": "^2.0", "webmozart/assert": "^1.9" }, @@ -73,6 +73,12 @@ }, "public-dir": "vendor/sylius/test-application/public" }, + "repositories": { + "sandwich/vies-bundle": { + "type": "git", + "url": "https://github.com/mmenozzi/ViesBundle.git" + } + }, "autoload": { "psr-4": { "Webgriffe\\SyliusItalianInvoiceableOrderPlugin\\": "src/" From 7ca735a6a0592bd783c3aae23e6d5a8daa5a0a07 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Tue, 13 Jan 2026 17:31:53 +0100 Subject: [PATCH 08/28] Use sylius 2.2 in build --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4918f40..cf21311 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: matrix: php: ["8.4"] symfony: ["^7.3"] - sylius: ["~2.1.0"] + sylius: ["~2.2.0"] node: ["22.x"] mysql: ["8.4"] From 6b73e231c0e4af0206e4a5189310c9ac30526885 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Wed, 14 Jan 2026 17:42:01 +0100 Subject: [PATCH 09/28] Temporarily patch Sylius behat AddressPage class as it has a bug --- composer.json | 9 ++++++- patches.lock.json | 17 +++++++++++++ patches/sylius-behat-cast-id-to-string.patch | 25 ++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 patches.lock.json create mode 100644 patches/sylius-behat-cast-id-to-string.patch diff --git a/composer.json b/composer.json index bcc940d..8d3e4e1 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ "behat/behat": "^3.16", "behat/mink": "^1.13", "behat/mink-selenium2-driver": "^1.7", + "cweagans/composer-patches": "^1.7", "dbrekelmans/bdi": "^1.4", "dmore/behat-chrome-extension": "^1.4", "dmore/chrome-mink-driver": "^2.9", @@ -57,6 +58,7 @@ "config": { "sort-packages": true, "allow-plugins": { + "cweagans/composer-patches": true, "dealerdirect/phpcodesniffer-composer-installer": false, "php-http/discovery": false, "phpstan/extension-installer": true, @@ -71,7 +73,12 @@ "symfony": { "require": "^6.4" }, - "public-dir": "vendor/sylius/test-application/public" + "public-dir": "vendor/sylius/test-application/public", + "patches": { + "sylius/sylius": { + "Cast ID to string in Behat AddressPage class": "patches/sylius-behat-cast-id-to-string.patch" + } + } }, "repositories": { "sandwich/vies-bundle": { diff --git a/patches.lock.json b/patches.lock.json new file mode 100644 index 0000000..f934ddb --- /dev/null +++ b/patches.lock.json @@ -0,0 +1,17 @@ +{ + "_hash": "59f8db25d98592f90d51976f2eb05774702429d6c1c373d71fbdd23f38cef29e", + "patches": { + "sylius/sylius": [ + { + "package": "sylius/sylius", + "description": "Cast ID to string in Behat AddressPage class", + "url": "patches/sylius-behat-cast-id-to-string.patch", + "sha256": "dec5762d48817184e3b019e79c864e66976151666c281a7ee2a39d181493e6f4", + "depth": 1, + "extra": { + "provenance": "root" + } + } + ] + } +} diff --git a/patches/sylius-behat-cast-id-to-string.patch b/patches/sylius-behat-cast-id-to-string.patch new file mode 100644 index 0000000..268a50c --- /dev/null +++ b/patches/sylius-behat-cast-id-to-string.patch @@ -0,0 +1,25 @@ +Index: vendor/sylius/sylius/src/Sylius/Behat/Page/Shop/Checkout/AddressPage.php +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/vendor/sylius/sylius/src/Sylius/Behat/Page/Shop/Checkout/AddressPage.php b/vendor/sylius/sylius/src/Sylius/Behat/Page/Shop/Checkout/AddressPage.php +--- a/vendor/sylius/sylius/src/Sylius/Behat/Page/Shop/Checkout/AddressPage.php ++++ b/vendor/sylius/sylius/src/Sylius/Behat/Page/Shop/Checkout/AddressPage.php (date 1768408224673) +@@ -249,14 +249,14 @@ + + public function selectShippingAddressFromAddressBook(AddressInterface $address): void + { +- $this->getElement('shipping_address_book')->selectOption($address->getId()); ++ $this->getElement('shipping_address_book')->selectOption((string) $address->getId()); + + $this->waitForElementUpdate('form'); + } + + public function selectBillingAddressFromAddressBook(AddressInterface $address): void + { +- $this->getElement('billing_address_book')->selectOption($address->getId()); ++ $this->getElement('billing_address_book')->selectOption((string) $address->getId()); + + $this->waitForElementUpdate('form'); + } From 758226d71013ba7020ec2e0b17316f7525bc9612 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 11:21:13 +0100 Subject: [PATCH 10/28] Style and static fixes --- tests/Behat/Context/Setup/ChannelContext.php | 2 +- .../Setup/InvoiceableAddressContext.php | 11 +++- tests/Behat/Context/Setup/ZoneContext.php | 2 +- .../Context/Transform/AddressContext.php | 17 +++++- .../Checkout/CheckoutAddressingContext.php | 56 +++++++++++++------ .../Shop/Checkout/CheckoutCompleteContext.php | 2 +- .../Shop/Checkout/AddressPageInterface.php | 3 +- .../Service/DefaultItalyChannelFactory.php | 2 +- .../TestApplication/config/services_test.php | 2 - 9 files changed, 68 insertions(+), 29 deletions(-) diff --git a/tests/Behat/Context/Setup/ChannelContext.php b/tests/Behat/Context/Setup/ChannelContext.php index e114c78..30fc017 100644 --- a/tests/Behat/Context/Setup/ChannelContext.php +++ b/tests/Behat/Context/Setup/ChannelContext.php @@ -28,7 +28,7 @@ public function __construct( private FactoryInterface $countryFactory, private ChannelRepositoryInterface $channelRepository, private RepositoryInterface $countryRepository, - private array $availableTaxCalculationStrategies + private array $availableTaxCalculationStrategies, ) { } diff --git a/tests/Behat/Context/Setup/InvoiceableAddressContext.php b/tests/Behat/Context/Setup/InvoiceableAddressContext.php index 76450c4..0022782 100644 --- a/tests/Behat/Context/Setup/InvoiceableAddressContext.php +++ b/tests/Behat/Context/Setup/InvoiceableAddressContext.php @@ -21,7 +21,7 @@ final class InvoiceableAddressContext implements Context public function __construct( private SharedStorageInterface $sharedStorage, - private ObjectManager $customerManager + private ObjectManager $customerManager, ) { $this->fakerGenerator = Factory::create(); } @@ -45,10 +45,17 @@ public function iHaveAnAddressForTheCompany(ShopUserInterface $user, AddressInte */ public function thisAddressHasAlsoTheFollowingInvoiceableInformation(AddressInterface $address): void { + Assert::isInstanceOf( + $address, + ItalianInvoiceableAddressInterface::class, + sprintf( + 'Address must be an instance of %s to set its invoiceable information.', + ItalianInvoiceableAddressInterface::class, + ), + ); // Randomly generated but valid VAT number with http://www.sottomentitespoglie.it/GeneratoreAziende.aspx $vatNumberAndTaxCode = '02664480353'; - /** @var ItalianInvoiceableAddressInterface $address */ $address->setTaxCode($vatNumberAndTaxCode); $address->setVatNumber($vatNumberAndTaxCode); $address->setSdiCode(strtoupper($this->fakerGenerator->bothify('*******'))); diff --git a/tests/Behat/Context/Setup/ZoneContext.php b/tests/Behat/Context/Setup/ZoneContext.php index 2265943..3cdb3ce 100644 --- a/tests/Behat/Context/Setup/ZoneContext.php +++ b/tests/Behat/Context/Setup/ZoneContext.php @@ -75,7 +75,7 @@ private function getEuropeanCountries(): array 'RO', 'SE', 'SI', - 'SK' + 'SK', ]; } diff --git a/tests/Behat/Context/Transform/AddressContext.php b/tests/Behat/Context/Transform/AddressContext.php index 99626ef..7e03c58 100644 --- a/tests/Behat/Context/Transform/AddressContext.php +++ b/tests/Behat/Context/Transform/AddressContext.php @@ -19,7 +19,7 @@ final class AddressContext implements Context public function __construct( private readonly ExampleFactoryInterface $exampleAddressFactory, - private readonly CountryNameConverterInterface $countryNameConverter + private readonly CountryNameConverterInterface $countryNameConverter, ) { $this->fakerGenerator = Factory::create(); } @@ -32,7 +32,7 @@ public function createNewIndividualAddressWith( string $city, string $street, string $postcode, - string $countryName + string $countryName, ): AddressInterface { [$firstName, $lastName] = explode(' ', $customerName); @@ -50,6 +50,7 @@ public function createNewIndividualAddressWith( ]); $address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_INDIVIDUAL); + return $address; } @@ -62,7 +63,7 @@ public function createNewCompanyAddressWith( string $street, string $postcode, string $city, - string $countryName + string $countryName, ): AddressInterface { [$firstName, $lastName] = explode(' ', $customerName); @@ -80,6 +81,7 @@ public function createNewCompanyAddressWith( ]); $address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_COMPANY); + return $address; } @@ -96,8 +98,10 @@ public function createNewValidItalianIndividualBillingAddress() $address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_INDIVIDUAL); // Taken random from: https://www.ilcodicefiscale.online/genera/ $address->setTaxCode('MSCLBR02H18A662F'); + return $address; } + /** * @Transform /^valid italian company billing address$/ * @@ -116,8 +120,10 @@ public function createNewValidItalianCompanyBillingAddress() $address->setVatNumber($vatNumberAndTaxCode); $address->setTaxCode($vatNumberAndTaxCode); $address->setSdiCode(strtoupper($this->fakerGenerator->bothify('*******'))); + return $address; } + /** * @Transform /^valid german individual billing address$/ * @@ -129,8 +135,10 @@ public function createNewValidGermanIndividualBillingAddress() $address = $this->exampleAddressFactory->create(['country_code' => 'DE', 'customer' => null]); Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class); $address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_INDIVIDUAL); + return $address; } + /** * @Transform /^valid german company billing address$/ * @@ -145,6 +153,7 @@ public function createNewValidGermanCompanyBillingAddress() $address->setCompany($this->fakerGenerator->company); // This is the real german company Hetzner (https://www.hetzner.com/) VAT number $address->setVatNumber('DE812871812'); + return $address; } @@ -159,6 +168,7 @@ public function createNewValidUSIndividualBillingAddress() $address = $this->exampleAddressFactory->create(['country_code' => 'US', 'customer' => null]); Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class); $address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_INDIVIDUAL); + return $address; } @@ -174,6 +184,7 @@ public function createNewValidUSCompanyBillingAddress() Assert::isInstanceOf($address, ItalianInvoiceableAddressInterface::class); $address->setBillingRecipientType(ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_COMPANY); $address->setCompany($this->fakerGenerator->company); + return $address; } } diff --git a/tests/Behat/Context/Ui/Shop/Checkout/CheckoutAddressingContext.php b/tests/Behat/Context/Ui/Shop/Checkout/CheckoutAddressingContext.php index 091335f..db5503a 100644 --- a/tests/Behat/Context/Ui/Shop/Checkout/CheckoutAddressingContext.php +++ b/tests/Behat/Context/Ui/Shop/Checkout/CheckoutAddressingContext.php @@ -4,13 +4,13 @@ namespace Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Behat\Context\Ui\Shop\Checkout; +use Behat\Behat\Context\Context; use Behat\Mink\Exception\ElementNotFoundException; use Faker\Factory; -use Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Behat\Page\Shop\Checkout\AddressPageInterface; -use Behat\Behat\Context\Context; use Faker\Generator; use Sylius\Behat\Service\SharedStorageInterface; use Sylius\Component\Core\Model\AddressInterface; +use Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Behat\Page\Shop\Checkout\AddressPageInterface; use Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressInterface; use Webmozart\Assert\Assert; @@ -20,7 +20,7 @@ final class CheckoutAddressingContext implements Context public function __construct( private readonly AddressPageInterface $addressPage, - private readonly SharedStorageInterface $sharedStorage + private readonly SharedStorageInterface $sharedStorage, ) { $this->fakerGenerator = Factory::create(); } @@ -34,7 +34,7 @@ public function iSpecifyTheBillingAddressForTheIndividual(AddressInterface $addr $key = sprintf( 'billing_address_%s_%s', strtolower((string) $address->getFirstName()), - strtolower((string) $address->getLastName()) + strtolower((string) $address->getLastName()), ); $this->sharedStorage->set($key, $address); @@ -149,7 +149,7 @@ public function iShouldBeNotifiedThatTheBillingVATNumberIsNotValid(): void { Assert::true( $this->addressPage->checkValidationMessageFor('billing_vat_number', 'Please enter a valid italian VAT number.') || - $this->addressPage->checkValidationMessageFor('billing_vat_number', 'Please enter a valid european VAT number.') + $this->addressPage->checkValidationMessageFor('billing_vat_number', 'Please enter a valid european VAT number.'), ); } @@ -169,8 +169,8 @@ public function iShouldBeNotifiedThatTheBillingSDICodeIsNotValid(): void Assert::true( $this->addressPage->checkValidationMessageFor( 'billing_sdi_code', - 'Please enter a valid SDI code.' - ) + 'Please enter a valid SDI code.', + ), ); } @@ -188,7 +188,7 @@ public function iSpecifyAnInvalidPECAddress(): void public function iShouldBeNotifiedThatTheBillingPECAddressIsNotValid(): void { Assert::true( - $this->addressPage->checkValidationMessageFor('billing_pec_address', 'Please enter a valid PEC address.') + $this->addressPage->checkValidationMessageFor('billing_pec_address', 'Please enter a valid PEC address.'), ); } @@ -198,7 +198,7 @@ public function iShouldBeNotifiedThatTheBillingPECAddressIsNotValid(): void public function iShouldBeNotifiedThatTheBillingTaxCodeIsRequired(): void { Assert::true( - $this->addressPage->checkValidationMessageFor('billing_tax_code', 'Tax code should not be blank.') + $this->addressPage->checkValidationMessageFor('billing_tax_code', 'Tax code should not be blank.'), ); } @@ -208,7 +208,7 @@ public function iShouldBeNotifiedThatTheBillingTaxCodeIsRequired(): void public function iShouldBeNotifiedThatTheBillingVatNumberIsRequired(): void { Assert::true( - $this->addressPage->checkValidationMessageFor('billing_vat_number', 'VAT number should not be blank.') + $this->addressPage->checkValidationMessageFor('billing_vat_number', 'VAT number should not be blank.'), ); } @@ -232,13 +232,13 @@ public function iShouldNotBeNotifiedThatOneBetweenTheBillingSdiCodeAndPecAddress function () use ($validationMessage) { $this->addressPage->checkValidationMessageFor('billing_sdi_code', $validationMessage); }, - ElementNotFoundException::class + ElementNotFoundException::class, ); Assert::throws( function () use ($validationMessage) { $this->addressPage->checkValidationMessageFor('billing_pec_address', $validationMessage); }, - ElementNotFoundException::class + ElementNotFoundException::class, ); } @@ -248,7 +248,7 @@ function () use ($validationMessage) { public function iShouldBeNotifiedThatTheBillingCompanyNameIsRequired(): void { Assert::true( - $this->addressPage->checkValidationMessageFor('billing_company', 'Company name should not be blank.') + $this->addressPage->checkValidationMessageFor('billing_company', 'Company name should not be blank.'), ); } @@ -290,7 +290,14 @@ public function iDoNotSpecifyTheBillingRecipientTypeInTheBillingAddress(): void */ public function iSpecifyTheSameItalianInvoiceableInformationOfTheAddressThatIHaveInMyAddressBook(AddressInterface $address): void { - /** @var ItalianInvoiceableAddressInterface $address */ + Assert::isInstanceOf( + $address, + ItalianInvoiceableAddressInterface::class, + sprintf( + 'Address must be an instance of %s to set its invoiceable information.', + ItalianInvoiceableAddressInterface::class, + ), + ); $this->addressPage->specifyBillingTaxCode((string) $address->getTaxCode()); $this->addressPage->specifyBillingVatNumber((string) $address->getVatNumber()); $this->addressPage->specifyBillingSdiCode((string) $address->getSdiCode()); @@ -302,7 +309,14 @@ public function iSpecifyTheSameItalianInvoiceableInformationOfTheAddressThatIHav */ public function iSpecifyADifferentPecAddress(AddressInterface $address): void { - /** @var ItalianInvoiceableAddressInterface $address */ + Assert::isInstanceOf( + $address, + ItalianInvoiceableAddressInterface::class, + sprintf( + 'Address must be an instance of %s to set its invoiceable information.', + ItalianInvoiceableAddressInterface::class, + ), + ); do { $newSdiCode = strtoupper($this->fakerGenerator->bothify('*******')); } while ($newSdiCode === $address->getSdiCode()); @@ -314,7 +328,14 @@ public function iSpecifyADifferentPecAddress(AddressInterface $address): void */ public function addressShouldBeFilledAsBillingAddress(AddressInterface $address): void { - /** @var ItalianInvoiceableAddressInterface $address */ + Assert::isInstanceOf( + $address, + ItalianInvoiceableAddressInterface::class, + sprintf( + 'Address must be an instance of %s to set its invoiceable information.', + ItalianInvoiceableAddressInterface::class, + ), + ); Assert::eq($this->addressPage->getPreFilledBillingRecipientType(), $address->getBillingRecipientType()); Assert::eq($this->addressPage->getPreFilledBillingTaxCode(), $address->getTaxCode()); Assert::eq($this->addressPage->getPreFilledBillingVatNumber(), $address->getVatNumber()); @@ -332,6 +353,7 @@ public function iSpecifyAValidItalianIndividualBillingAddress($address): void $this->addressPage->specifyBillingAddress($address); $this->addressPage->specifyBillingTaxCode((string) $address->getTaxCode()); } + /** * @When /^I specify a (valid italian company billing address)$/ * @@ -344,6 +366,7 @@ public function iSpecifyAValidItalianCompanyBillingAddress($address): void $this->addressPage->specifyBillingTaxCode((string) $address->getTaxCode()); $this->addressPage->specifyBillingSdiCode((string) $address->getSdiCode()); } + /** * @Given /^I specify a (valid german individual billing address)$/ * @@ -353,6 +376,7 @@ public function iSpecifyAValidGermanIndividualBillingAddress($address): void { $this->addressPage->specifyBillingAddress($address); } + /** * @Given /^I specify a (valid german company billing address)$/ * diff --git a/tests/Behat/Context/Ui/Shop/Checkout/CheckoutCompleteContext.php b/tests/Behat/Context/Ui/Shop/Checkout/CheckoutCompleteContext.php index 7d56a8e..9e84ccd 100644 --- a/tests/Behat/Context/Ui/Shop/Checkout/CheckoutCompleteContext.php +++ b/tests/Behat/Context/Ui/Shop/Checkout/CheckoutCompleteContext.php @@ -4,8 +4,8 @@ namespace Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Behat\Context\Ui\Shop\Checkout; -use Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Behat\Page\Shop\Checkout\CompletePageInterface; use Behat\Behat\Context\Context; +use Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Behat\Page\Shop\Checkout\CompletePageInterface; use Webmozart\Assert\Assert; final class CheckoutCompleteContext implements Context diff --git a/tests/Behat/Page/Shop/Checkout/AddressPageInterface.php b/tests/Behat/Page/Shop/Checkout/AddressPageInterface.php index 7a2396a..79dd56b 100644 --- a/tests/Behat/Page/Shop/Checkout/AddressPageInterface.php +++ b/tests/Behat/Page/Shop/Checkout/AddressPageInterface.php @@ -12,7 +12,7 @@ public function specifyBillingTaxCode(string $ssn): void; public function specifyBillingVatNumber(string $vatNumber): void; - public function specifyBillingSdiCode(string $sdiCode): void ; + public function specifyBillingSdiCode(string $sdiCode): void; public function specifyBillingPecAddress(string $pecAddress): void; @@ -27,5 +27,4 @@ public function getPreFilledBillingVatNumber(): string; public function getPreFilledBillingSdiCode(): string; public function getPreFilledBillingPecAddress(): string; - } diff --git a/tests/Behat/Service/DefaultItalyChannelFactory.php b/tests/Behat/Service/DefaultItalyChannelFactory.php index 9530ab3..dd50579 100644 --- a/tests/Behat/Service/DefaultItalyChannelFactory.php +++ b/tests/Behat/Service/DefaultItalyChannelFactory.php @@ -50,7 +50,7 @@ public function __construct( private FactoryInterface $currencyFactory, private FactoryInterface $localeFactory, private ZoneFactoryInterface $zoneFactory, - private string $defaultLocaleCode + private string $defaultLocaleCode, ) { } diff --git a/tests/TestApplication/config/services_test.php b/tests/TestApplication/config/services_test.php index ac73c31..43f52f5 100644 --- a/tests/TestApplication/config/services_test.php +++ b/tests/TestApplication/config/services_test.php @@ -6,8 +6,6 @@ return function (ContainerConfigurator $container) { if (str_starts_with($container->env(), 'test')) { -//parameters: -// app.taxation.eu_zone_code: 'EU' $container->import('../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml'); $container->import('@WebgriffeSyliusItalianInvoiceableOrderPlugin/tests/Behat/Resources/services.xml'); } From 86da0bda5ba2fc95f03885e5bebfe8cdbe3360fb Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 11:28:54 +0100 Subject: [PATCH 11/28] Symlink node modules --- README.md | 22 ++++++++++++++++++---- node_modules | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0f49583..30f708a 100644 --- a/README.md +++ b/README.md @@ -129,26 +129,32 @@ To contribute you need to: 3. Copy `tests/TestApplication/.env` in `tests/TestApplication/.env.local` and set configuration specific for your development environment. -4. Run docker (create a `compose.override.yml` if you need to customize services): +4. Link node_modules: + + ```bash + ln -s vendor/sylius/test-application/node_modules node_modules + ``` + +5. Run docker (create a `compose.override.yml` if you need to customize services): ```bash docker-compose up -d ``` -4. Then, from the plugin's root directory, run the following commands: +6. Then, from the plugin's root directory, run the following commands: ```bash composer test-app-init ``` -5. Run your local server: +7. Run your local server: ```bash symfony server:ca:install symfony server:start -d ``` -6. Now at http://localhost:8080/ you have a full Sylius testing application which runs the plugin +8. Now at http://localhost:8080/ you have a full Sylius testing application which runs the plugin ### Testing @@ -163,6 +169,14 @@ First setup your test database: APP_ENV=test vendor/bin/console sylius:fixtures:load -n ``` +And build assets: + +```bash + (cd vendor/sylius/test-application && yarn install) + (cd vendor/sylius/test-application && yarn build) + vendor/bin/console assets:install +``` + The current CI suite runs the following tests: - PHPUnit diff --git a/node_modules b/node_modules index 9270531..f802bac 120000 --- a/node_modules +++ b/node_modules @@ -1 +1 @@ -tests/Application/node_modules \ No newline at end of file +vendor/sylius/test-application/node_modules \ No newline at end of file From 219136d7838c764c9c151cf0f3f76cae090351b5 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 11:29:37 +0100 Subject: [PATCH 12/28] Remove behat likely unnecessary configs --- behat.yml.dist | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/behat.yml.dist b/behat.yml.dist index 90cd22f..d95adf9 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -11,7 +11,6 @@ default: extensions: DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~ - Robertfausk\Behat\PantherExtension: ~ FriendsOfBehat\MinkDebugExtension: directory: etc/build @@ -34,18 +33,6 @@ default: chrome: api_url: http://127.0.0.1:9222 validate_certificate: false - panther: - panther: - manager_options: - connection_timeout_in_ms: 5000 - request_timeout_in_ms: 120000 - chromedriver_arguments: - - --log-path=etc/build/chromedriver.log - - --verbose - capabilities: - acceptSslCerts: true - acceptInsecureCerts: true - unexpectedAlertBehaviour: accept show_auto: false FriendsOfBehat\SymfonyExtension: From d767bca71975fcd85678a6d3d7a38b160e1ec0a3 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 11:30:34 +0100 Subject: [PATCH 13/28] Use test FCQN for entities to validate --- tests/TestApplication/config/config.yaml | 6 ++++++ .../config/{validator => validation}/Address.xml | 2 +- .../config/{validator => validation}/Order.xml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) rename tests/TestApplication/config/{validator => validation}/Address.xml (99%) rename tests/TestApplication/config/{validator => validation}/Order.xml (93%) diff --git a/tests/TestApplication/config/config.yaml b/tests/TestApplication/config/config.yaml index a5119c8..b0ba11c 100644 --- a/tests/TestApplication/config/config.yaml +++ b/tests/TestApplication/config/config.yaml @@ -6,6 +6,12 @@ twig: paths: '%kernel.project_dir%/../../../tests/TestApplication/templates': ~ +framework: + validation: + mapping: + paths: + - '%kernel.project_dir%/../../../tests/TestApplication/config/validation/' + doctrine: orm: entity_managers: diff --git a/tests/TestApplication/config/validator/Address.xml b/tests/TestApplication/config/validation/Address.xml similarity index 99% rename from tests/TestApplication/config/validator/Address.xml rename to tests/TestApplication/config/validation/Address.xml index 6048b0e..a3a48f2 100644 --- a/tests/TestApplication/config/validator/Address.xml +++ b/tests/TestApplication/config/validation/Address.xml @@ -1,6 +1,6 @@ - + diff --git a/tests/TestApplication/config/validator/Order.xml b/tests/TestApplication/config/validation/Order.xml similarity index 93% rename from tests/TestApplication/config/validator/Order.xml rename to tests/TestApplication/config/validation/Order.xml index a5fa5bf..1d3d6e6 100644 --- a/tests/TestApplication/config/validator/Order.xml +++ b/tests/TestApplication/config/validation/Order.xml @@ -1,6 +1,6 @@ - + From 6a98af867ead35a8cfa41dbdd2f5d1cb8d72a534 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 11:31:47 +0100 Subject: [PATCH 14/28] Add Default as default validation group for Address entity --- config/config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/config.yaml b/config/config.yaml index 239a74a..d2a2a46 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -1,2 +1,5 @@ imports: - { resource: 'twig_hooks/**/*.yaml' } + +parameters: + sylius.form.type.address.validation_groups: [ 'Default' ] From eb3daaaaa888d3bdfe282f5a46e9931cca869d8a Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 11:32:44 +0100 Subject: [PATCH 15/28] Add missing behat test server script --- e2e-test-server.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 e2e-test-server.sh diff --git a/e2e-test-server.sh b/e2e-test-server.sh new file mode 100755 index 0000000..6cc7a6e --- /dev/null +++ b/e2e-test-server.sh @@ -0,0 +1,5 @@ +# Make sure to set GOOGLE_CHROME env variable pointing to your Google Chrome binary. For example on macOS: +# GOOGLE_CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ./e2e-test-server.sh + +trap 'kill %1; kill %2' SIGINT +APP_ENV=test symfony server:start --port=8080 --dir=vendor/sylius/test-application/public & "${GOOGLE_CHROME}" --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 --disable-gpu --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' --crash-dumps-dir=/tmp https://127.0.0.1 & tee From aad087903fa5cf56797fa80413c94f17c4646d96 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 11:33:05 +0100 Subject: [PATCH 16/28] Remove not needed symfony.lock file --- symfony.lock | 452 --------------------------------------------------- 1 file changed, 452 deletions(-) delete mode 100644 symfony.lock diff --git a/symfony.lock b/symfony.lock deleted file mode 100644 index 67a5619..0000000 --- a/symfony.lock +++ /dev/null @@ -1,452 +0,0 @@ -{ - "api-platform/core": { - "version": "2.7", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "2.5", - "ref": "b86557ce5677fa855b1b2608f4a4bc4a8fed8be7" - }, - "files": [ - "config/packages/api_platform.yaml", - "config/routes/api_platform.yaml", - "src/Entity/.gitignore" - ] - }, - "babdev/pagerfanta-bundle": { - "version": "v3.8.0" - }, - "doctrine/annotations": { - "version": "2.0", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "1.10", - "ref": "64d8583af5ea57b7afa4aba4b159907f3a148b05" - } - }, - "doctrine/doctrine-bundle": { - "version": "2.13", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "2.10", - "ref": "c170ded8fc587d6bd670550c43dafcf093762245" - }, - "files": [ - "config/packages/doctrine.yaml", - "src/Entity/.gitignore", - "src/Repository/.gitignore" - ] - }, - "doctrine/doctrine-migrations-bundle": { - "version": "3.3", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "3.1", - "ref": "1d01ec03c6ecbd67c3375c5478c9a423ae5d6a33" - }, - "files": [ - "config/packages/doctrine_migrations.yaml", - "migrations/.gitignore" - ] - }, - "friends-of-behat/symfony-extension": { - "version": "2.6", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "2.0", - "ref": "1e012e04f573524ca83795cd19df9ea690adb604" - } - }, - "friendsofsymfony/rest-bundle": { - "version": "3.7", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "3.0", - "ref": "3762cc4e4f2d6faabeca5a151b41c8c791bd96e5" - } - }, - "jms/serializer-bundle": { - "version": "4.2", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "4.0", - "ref": "cc04e10cf7171525b50c18b36004edf64cb478be" - } - }, - "knplabs/knp-gaufrette-bundle": { - "version": "v0.8.0" - }, - "knplabs/knp-menu-bundle": { - "version": "v3.4.2" - }, - "league/flysystem-bundle": { - "version": "2.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "1.0", - "ref": "913dc3d7a5a1af0d2b044c5ac3a16e2f851d7380" - }, - "files": [ - "config/packages/flysystem.yaml", - "var/storage/.gitignore" - ] - }, - "lexik/jwt-authentication-bundle": { - "version": "2.17", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "2.5", - "ref": "e9481b233a11ef7e15fe055a2b21fd3ac1aa2bb7" - }, - "files": [ - "config/packages/lexik_jwt_authentication.yaml" - ] - }, - "liip/imagine-bundle": { - "version": "2.13", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "1.8", - "ref": "d1227d002b70d1a1f941d91845fcd7ac7fbfc929" - } - }, - "nyholm/psr7": { - "version": "1.8", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "1.0", - "ref": "4a8c0345442dcca1d8a2c65633dcf0285dd5a5a2" - }, - "files": [ - "config/packages/nyholm_psr7.yaml" - ] - }, - "payum/payum-bundle": { - "version": "2.6", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "2.4", - "ref": "518ac22defa04a8a1d82479ed362e2921487adf0" - } - }, - "phpstan/phpstan": { - "version": "1.12", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "1.0", - "ref": "5e490cc197fb6bb1ae22e5abbc531ddc633b6767" - } - }, - "phpunit/phpunit": { - "version": "9.6", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "9.6", - "ref": "7364a21d87e658eb363c5020c072ecfdc12e2326" - }, - "files": [ - ".env.test", - "phpunit.xml.dist", - "tests/bootstrap.php" - ] - }, - "sandwich/vies-bundle": { - "version": "2.2" - }, - "sonata-project/block-bundle": { - "version": "5.1", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "4.11", - "ref": "b4edd2a1e6ac1827202f336cac2771cb529de542" - } - }, - "sonata-project/form-extensions": { - "version": "2.4", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "1.4", - "ref": "9c8a1e8ce2b1f215015ed16652c4ed18eb5867fd" - } - }, - "squizlabs/php_codesniffer": { - "version": "3.10", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "3.6", - "ref": "1019e5c08d4821cb9b77f4891f8e9c31ff20ac6f" - } - }, - "stof/doctrine-extensions-bundle": { - "version": "1.12", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "1.2", - "ref": "e805aba9eff5372e2d149a9ff56566769e22819d" - } - }, - "sylius-labs/doctrine-migrations-extra-bundle": { - "version": "v0.2.2" - }, - "sylius/calendar": { - "version": "v0.5.0" - }, - "sylius/fixtures-bundle": { - "version": "v1.9.0" - }, - "sylius/grid-bundle": { - "version": "v1.13.0" - }, - "sylius/mailer-bundle": { - "version": "v2.1.0" - }, - "sylius/resource-bundle": { - "version": "1.12", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "1.12", - "ref": "cde8dd6145be3135af63787aa5c5858c3f289c7a" - } - }, - "sylius/theme-bundle": { - "version": "v2.4.0" - }, - "symfony/console": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "5.3", - "ref": "1781ff40d8a17d87cf53f8d4cf0c8346ed2bb461" - }, - "files": [ - "bin/console" - ] - }, - "symfony/debug-bundle": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "5.3", - "ref": "5aa8aa48234c8eb6dbdd7b3cd5d791485d2cec4b" - }, - "files": [ - "config/packages/debug.yaml" - ] - }, - "symfony/flex": { - "version": "2.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "1.0", - "ref": "146251ae39e06a95be0fe3d13c807bcf3938b172" - }, - "files": [ - ".env" - ] - }, - "symfony/framework-bundle": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "6.4", - "ref": "32126346f25e1cee607cc4aa6783d46034920554" - }, - "files": [ - "config/packages/cache.yaml", - "config/packages/framework.yaml", - "config/preload.php", - "config/routes/framework.yaml", - "config/services.yaml", - "public/index.php", - "src/Controller/.gitignore", - "src/Kernel.php" - ] - }, - "symfony/mailer": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "4.3", - "ref": "df66ee1f226c46f01e85c29c2f7acce0596ba35a" - }, - "files": [ - "config/packages/mailer.yaml" - ] - }, - "symfony/messenger": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "6.0", - "ref": "ba1ac4e919baba5644d31b57a3284d6ba12d52ee" - }, - "files": [ - "config/packages/messenger.yaml" - ] - }, - "symfony/monolog-bundle": { - "version": "3.10", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "3.7", - "ref": "aff23899c4440dd995907613c1dd709b6f59503f" - }, - "files": [ - "config/packages/monolog.yaml" - ] - }, - "symfony/panther": { - "version": "2.1", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "1.0", - "ref": "673836afb0eac2b0ec36c44f2ff0379e5a4b2177" - } - }, - "symfony/routing": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "6.2", - "ref": "e0a11b4ccb8c9e70b574ff5ad3dfdcd41dec5aa6" - }, - "files": [ - "config/packages/routing.yaml", - "config/routes.yaml" - ] - }, - "symfony/security-bundle": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "6.4", - "ref": "2ae08430db28c8eb4476605894296c82a642028f" - }, - "files": [ - "config/packages/security.yaml", - "config/routes/security.yaml" - ] - }, - "symfony/translation": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "6.3", - "ref": "e28e27f53663cc34f0be2837aba18e3a1bef8e7b" - }, - "files": [ - "config/packages/translation.yaml", - "translations/.gitignore" - ] - }, - "symfony/twig-bundle": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "6.4", - "ref": "cab5fd2a13a45c266d45a7d9337e28dee6272877" - }, - "files": [ - "config/packages/twig.yaml", - "templates/base.html.twig" - ] - }, - "symfony/validator": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "5.3", - "ref": "c32cfd98f714894c4f128bb99aa2530c1227603c" - }, - "files": [ - "config/packages/validator.yaml" - ] - }, - "symfony/web-profiler-bundle": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "6.1", - "ref": "e42b3f0177df239add25373083a564e5ead4e13a" - }, - "files": [ - "config/packages/web_profiler.yaml", - "config/routes/web_profiler.yaml" - ] - }, - "symfony/webpack-encore-bundle": { - "version": "1.17", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "1.10", - "ref": "eff2e505d4557c967b6710fe06bd947ba555cae5" - }, - "files": [ - "assets/app.js", - "assets/bootstrap.js", - "assets/controllers.json", - "assets/controllers/hello_controller.js", - "assets/styles/app.css", - "config/packages/webpack_encore.yaml", - "package.json", - "webpack.config.js" - ] - }, - "symfony/workflow": { - "version": "6.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "3.3", - "ref": "3b2f8ca32a07fcb00f899649053943fa3d8bbfb6" - }, - "files": [ - "config/packages/workflow.yaml" - ] - }, - "willdurand/hateoas-bundle": { - "version": "2.5", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "main", - "version": "2.0", - "ref": "34df072c6edaa61ae19afb2f3a239f272fecab87" - } - }, - "winzou/state-machine-bundle": { - "version": "v0.6.2" - } -} From 8e9ee011c66386f7690e7b2328c59a160f5aa6fa Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 11:33:33 +0100 Subject: [PATCH 17/28] Add missing Vies Bundle --- tests/TestApplication/config/bundles.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/TestApplication/config/bundles.php b/tests/TestApplication/config/bundles.php index e0d1d17..edfef5f 100644 --- a/tests/TestApplication/config/bundles.php +++ b/tests/TestApplication/config/bundles.php @@ -1,5 +1,6 @@ ['all' => true], Webgriffe\SyliusItalianInvoiceableOrderPlugin\WebgriffeSyliusItalianInvoiceableOrderPlugin::class => ['all' => true], ]; From 648a4ae5817b43a437ea18e030b352fb0e0815e4 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 11:34:03 +0100 Subject: [PATCH 18/28] Fix behat tests --- ...n_invoicing_information_validation.feature | 2 +- ...ng_information_as_european_company.feature | 2 +- ...ing_invoicing_information_as_guest.feature | 2 +- ...ing_information_as_italian_company.feature | 2 +- ..._information_as_italian_individual.feature | 2 +- ...c_invoicing_information_validation.feature | 2 +- ...n_invoicing_information_validation.feature | 2 +- ...ng_information_in_shipping_address.feature | 4 +- ...out_without_billing_recipient_type.feature | 2 +- ...able_information_from_address_book.feature | 2 +- ...able_address_saved_in_address_book.feature | 2 +- ...ng_correct_taxes_based_on_customer.feature | 69 ++++++++++--------- .../Behat/Page/Shop/Checkout/AddressPage.php | 24 +++---- tests/Behat/Resources/suites.yml | 9 +++ 14 files changed, 71 insertions(+), 55 deletions(-) diff --git a/features/checkout/filling_invoicing_information/european_invoicing_information_validation.feature b/features/checkout/filling_invoicing_information/european_invoicing_information_validation.feature index 749984a..a25ffe9 100644 --- a/features/checkout/filling_invoicing_information/european_invoicing_information_validation.feature +++ b/features/checkout/filling_invoicing_information/european_invoicing_information_validation.feature @@ -11,7 +11,7 @@ Feature: Italian invoicing information validation And this channel operates in the "Germany" country And the store ships everywhere for free And the store has a product "PHP T-Shirt" priced at "$19.99" - And I have product "PHP T-Shirt" in the cart + And I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step @ui diff --git a/features/checkout/filling_invoicing_information/filling_invoicing_information_as_european_company.feature b/features/checkout/filling_invoicing_information/filling_invoicing_information_as_european_company.feature index 23a06a2..8a0a108 100644 --- a/features/checkout/filling_invoicing_information/filling_invoicing_information_as_european_company.feature +++ b/features/checkout/filling_invoicing_information/filling_invoicing_information_as_european_company.feature @@ -13,7 +13,7 @@ Feature: Filling invoicing information as an european company And this channel operates in the "Greece" country And the store ships everywhere for free And the store has a product "PHP T-Shirt" priced at "$19.99" - And I have product "PHP T-Shirt" in the cart + And I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step @ui diff --git a/features/checkout/filling_invoicing_information/filling_invoicing_information_as_guest.feature b/features/checkout/filling_invoicing_information/filling_invoicing_information_as_guest.feature index e8add51..f4470e4 100644 --- a/features/checkout/filling_invoicing_information/filling_invoicing_information_as_guest.feature +++ b/features/checkout/filling_invoicing_information/filling_invoicing_information_as_guest.feature @@ -8,7 +8,7 @@ Feature: Filling invoicing information for an order Given the store operates on a single channel in "United States" And the store ships everywhere for free And the store has a product "PHP T-Shirt" priced at "$19.99" - And I have product "PHP T-Shirt" in the cart + And I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step @ui diff --git a/features/checkout/filling_invoicing_information/filling_invoicing_information_as_italian_company.feature b/features/checkout/filling_invoicing_information/filling_invoicing_information_as_italian_company.feature index 1c34960..2d307d1 100644 --- a/features/checkout/filling_invoicing_information/filling_invoicing_information_as_italian_company.feature +++ b/features/checkout/filling_invoicing_information/filling_invoicing_information_as_italian_company.feature @@ -8,7 +8,7 @@ Feature: Filling invoicing information as an italian company Given the store operates on a single channel in "Italy" And the store ships everywhere for free And the store has a product "PHP T-Shirt" priced at "$19.99" - And I have product "PHP T-Shirt" in the cart + And I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step @ui diff --git a/features/checkout/filling_invoicing_information/filling_invoicing_information_as_italian_individual.feature b/features/checkout/filling_invoicing_information/filling_invoicing_information_as_italian_individual.feature index 509943d..68c2bd5 100644 --- a/features/checkout/filling_invoicing_information/filling_invoicing_information_as_italian_individual.feature +++ b/features/checkout/filling_invoicing_information/filling_invoicing_information_as_italian_individual.feature @@ -8,7 +8,7 @@ Feature: Filling invoicing information as an italian individual Given the store operates on a single channel in "Italy" And the store ships everywhere for free And the store has a product "PHP T-Shirt" priced at "$19.99" - And I have product "PHP T-Shirt" in the cart + And I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step @ui diff --git a/features/checkout/filling_invoicing_information/generic_invoicing_information_validation.feature b/features/checkout/filling_invoicing_information/generic_invoicing_information_validation.feature index 2311357..11dfdd0 100644 --- a/features/checkout/filling_invoicing_information/generic_invoicing_information_validation.feature +++ b/features/checkout/filling_invoicing_information/generic_invoicing_information_validation.feature @@ -8,7 +8,7 @@ Feature: Italian invoicing information validation Given the store operates on a single channel in "United States" And the store ships everywhere for free And the store has a product "PHP T-Shirt" priced at "$19.99" - And I have product "PHP T-Shirt" in the cart + And I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step @ui diff --git a/features/checkout/filling_invoicing_information/italian_invoicing_information_validation.feature b/features/checkout/filling_invoicing_information/italian_invoicing_information_validation.feature index c442a49..8b58679 100644 --- a/features/checkout/filling_invoicing_information/italian_invoicing_information_validation.feature +++ b/features/checkout/filling_invoicing_information/italian_invoicing_information_validation.feature @@ -8,7 +8,7 @@ Feature: Italian invoicing information validation Given the store operates on a single channel in "Italy" And the store ships everywhere for free And the store has a product "PHP T-Shirt" priced at "$19.99" - And I have product "PHP T-Shirt" in the cart + And I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step @ui diff --git a/features/checkout/filling_invoicing_information/not_seeing_invoicing_information_in_shipping_address.feature b/features/checkout/filling_invoicing_information/not_seeing_invoicing_information_in_shipping_address.feature index 4357a06..6ec40e1 100644 --- a/features/checkout/filling_invoicing_information/not_seeing_invoicing_information_in_shipping_address.feature +++ b/features/checkout/filling_invoicing_information/not_seeing_invoicing_information_in_shipping_address.feature @@ -8,10 +8,10 @@ Feature: Not seeing invoicing information in shipping address Given the store operates on a single channel in "United States" And the store ships everywhere for free And the store has a product "PHP T-Shirt" priced at "$19.99" - And I have product "PHP T-Shirt" in the cart + And I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step - @ui + @ui @javascript Scenario: Not seeing invoicing information in shipping address When I specify the email as "jon.snow@example.com" And I specify the billing address for the individual "Jon Snow" - "Sunset Boulevard", "90210", "Los Angeles" - "United States" diff --git a/features/checkout/filling_invoicing_information/preventing_complete_checkout_without_billing_recipient_type.feature b/features/checkout/filling_invoicing_information/preventing_complete_checkout_without_billing_recipient_type.feature index 8fbc7bf..55b4331 100644 --- a/features/checkout/filling_invoicing_information/preventing_complete_checkout_without_billing_recipient_type.feature +++ b/features/checkout/filling_invoicing_information/preventing_complete_checkout_without_billing_recipient_type.feature @@ -9,7 +9,7 @@ Feature: Preventing complete checkout without billing recipient type And the store ships everywhere for free And the store allows paying with "Bank Transfer" And the store has a product "PHP T-Shirt" priced at "$19.99" - And I have product "PHP T-Shirt" in the cart + And I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step @ui diff --git a/features/checkout/invoiceable_address_book/choosing_billing_address_with_invoiceable_information_from_address_book.feature b/features/checkout/invoiceable_address_book/choosing_billing_address_with_invoiceable_information_from_address_book.feature index 77d6d06..e5d541f 100644 --- a/features/checkout/invoiceable_address_book/choosing_billing_address_with_invoiceable_information_from_address_book.feature +++ b/features/checkout/invoiceable_address_book/choosing_billing_address_with_invoiceable_information_from_address_book.feature @@ -14,7 +14,7 @@ Feature: Choosing an address from address book @ui @javascript Scenario: Choosing billing address with invoicing information from address book - Given I have product "PHP T-Shirt" in the cart + Given I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step When I choose "Viale Italia" street for billing address Then all invoicing information of the address I have in my address book should be filled in billing address diff --git a/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature b/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature index 81f3481..c499c21 100644 --- a/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature +++ b/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature @@ -10,7 +10,7 @@ Feature: Having new invoiceable addresses saved in the address book after checko And the store ships everywhere for free And the store allows paying with "Cash on Delivery" And I am a logged in customer - And I have product "Lannister Coat" in the cart + And I added product "Lannister Coat" to the cart @ui Scenario: Invoiceable address already existent in my book don't get saved again diff --git a/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature b/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature index 26a4077..4b3f719 100644 --- a/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature +++ b/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature @@ -10,73 +10,80 @@ Feature: Apply correct taxes based on order address And there is a tax zone "EU" containing all European Union countries And there is a tax zone "Extra EU" containing all countries outside the European Union And there is a shipping zone "Global" containing all countries of the world - And the store ships everywhere for free + And the store ships everywhere for Free + And the store allows paying Offline And the store has "IVA 22%" tax rate of 22% for "IVA Ordinaria" within the "EU" zone And the store has a product "PHP T-Shirt" priced at "$100.00" And it belongs to "IVA Ordinaria" tax category @ui Scenario: Paying taxes while ordering as an italian individual - Given I add product "PHP T-Shirt" to the cart + Given I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step And I specify the email as "italian-individual@email.com" And I specify a valid italian individual billing address - When I complete the addressing step - Then I should be on the checkout shipping step - And my cart total should be "$122.00" - And my cart taxes should be "$22.00" + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$122.00" + And my tax total should be "$22.00" @ui Scenario: Paying taxes while ordering as an italian company - Given I add product "PHP T-Shirt" to the cart + Given I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step And I specify the email as "italian-company@email.com" And I specify a valid italian company billing address - When I complete the addressing step - Then I should be on the checkout shipping step - Then my cart total should be "$122.00" - And my cart taxes should be "$22.00" + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$122.00" + And my tax total should be "$22.00" @ui Scenario: Paying taxes while ordering as an EU individual - Given I add product "PHP T-Shirt" to the cart + Given I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step And I specify the email as "german-individual@email.com" And I specify a valid german individual billing address - When I complete the addressing step - Then I should be on the checkout shipping step - And my cart total should be "$122.00" - And my cart taxes should be "$22.00" + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$122.00" + And my tax total should be "$22.00" @ui Scenario: Not paying taxes while ordering as an EU company - Given I add product "PHP T-Shirt" to the cart + Given I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step And I specify the email as "german-company@email.com" And I specify a valid german company billing address - When I complete the addressing step - Then I should be on the checkout shipping step - And my cart total should be "$100.00" - And there should be no taxes charged + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$100.00" + And my tax total should be "$0.00" @ui Scenario: Not paying taxes while ordering as an extra EU individual - Given I add product "PHP T-Shirt" to the cart + Given I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step And I specify the email as "usa-individual@email.com" And I specify a valid US individual billing address - When I complete the addressing step - Then I should be on the checkout shipping step - And my cart total should be "$100.00" - And there should be no taxes charged + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$100.00" + And my tax total should be "$0.00" @ui Scenario: Not paying taxes while ordering as an extra EU company - Given I add product "PHP T-Shirt" to the cart + Given I added product "PHP T-Shirt" to the cart And I am at the checkout addressing step And I specify the email as "usa-company@email.com" And I specify a valid US company billing address - When I complete the addressing step - Then I should be on the checkout shipping step - And my cart total should be "$100.00" - And there should be no taxes charged + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$100.00" + And my tax total should be "$0.00" diff --git a/tests/Behat/Page/Shop/Checkout/AddressPage.php b/tests/Behat/Page/Shop/Checkout/AddressPage.php index d2199c8..c04bfb8 100644 --- a/tests/Behat/Page/Shop/Checkout/AddressPage.php +++ b/tests/Behat/Page/Shop/Checkout/AddressPage.php @@ -51,19 +51,19 @@ protected function getDefinedElements(): array { return array_merge( [ - 'billing_billing_recipient_type' => '[data-test-billing-billing-recipient-type] input', - 'billing_tax_code' => '[data-test-billing-tax-code]', - 'billing_company' => '[data-test-billing-company]', - 'billing_vat_number' => '[data-test-billing-vat-number]', - 'billing_sdi_code' => '[data-test-billing-sdi-code]', - 'billing_pec_address' => '[data-test-billing-pec-address]', - 'shipping_billing_recipient_type' => '[data-test-shipping-billing-recipient-type] input', - 'shipping_tax_code' => '[data-test-shipping-tax-code]', - 'shipping_vat_number' => '[data-test-shipping-vat-number]', - 'shipping_sdi_code' => '[data-test-shipping-sdi-code]', - 'shipping_pec_address' => '[data-test-shipping-pec-address]', + 'billing_billing_recipient_type' => '[data-test-billing-address] [data-test-billing-recipient-type] input', + 'billing_tax_code' => '[data-test-billing-address] [data-test-tax-code]', + 'billing_company' => '[data-test-billing-address] [data-test-company]', + 'billing_vat_number' => '[data-test-billing-address] [data-test-vat-number]', + 'billing_sdi_code' => '[data-test-billing-address] [data-test-sdi-code]', + 'billing_pec_address' => '[data-test-billing-address] [data-test-pec-address]', + 'shipping_billing_recipient_type' => '[data-test-shipping-address] [data-test-billing-recipient-type] input', + 'shipping_tax_code' => '[data-test-shipping-address] [data-test-tax-code]', + 'shipping_vat_number' => '[data-test-shipping-address] [data-test-vat-number]', + 'shipping_sdi_code' => '[data-test-shipping-address] [data-test-sdi-code]', + 'shipping_pec_address' => '[data-test-shipping-address] [data-test-pec-address]', ], - parent::getDefinedElements() + parent::getDefinedElements(), ); } diff --git a/tests/Behat/Resources/suites.yml b/tests/Behat/Resources/suites.yml index 8aa3d97..f463d88 100644 --- a/tests/Behat/Resources/suites.yml +++ b/tests/Behat/Resources/suites.yml @@ -19,6 +19,7 @@ default: - sylius.behat.context.setup.shipping - sylius.behat.context.setup.geographical - sylius.behat.context.setup.payment + - sylius.behat.context.setup.cart - webgriffe_sylius_italian_invoiceable_order.behat.context.setup.channel - sylius.behat.context.ui.shop.cart @@ -47,6 +48,7 @@ default: - sylius.behat.context.setup.shipping - sylius.behat.context.setup.payment - sylius.behat.context.setup.shop_security + - sylius.behat.context.setup.cart - webgriffe_sylius_italian_invoiceable_order.behat.context.setup.channel - webgriffe_sylius_italian_invoiceable_order.behat.context.setup.invoiceable_address @@ -72,19 +74,26 @@ default: - sylius.behat.context.transform.product - sylius.behat.context.transform.channel - sylius.behat.context.transform.theme + - sylius.behat.context.transform.shipping_method + - sylius.behat.context.transform.payment - webgriffe_sylius_italian_invoiceable_order.behat.context.transform.address - sylius.behat.context.setup.channel - sylius.behat.context.setup.shipping + - sylius.behat.context.setup.payment - sylius.behat.context.setup.taxation - sylius.behat.context.setup.product - sylius.behat.context.setup.theme + - sylius.behat.context.setup.cart + - sylius.behat.context.setup.order - webgriffe_sylius_italian_invoiceable_order.behat.context.setup.zone - webgriffe_sylius_italian_invoiceable_order.behat.context.setup.channel - 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.shipping + - sylius.behat.context.ui.shop.checkout.complete - webgriffe_sylius_italian_invoiceable_order.behat.context.ui.shop.checkout.addressing filters: From fa2a51b56731667cba522d0853aaf7d809ac3d6a Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 17:33:20 +0100 Subject: [PATCH 19/28] Remove typo --- .../bundles/SyliusAdminBundle/shared/helper/address.html.twig | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig b/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig index dad6ce4..cd75ee9 100644 --- a/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig +++ b/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig @@ -1,6 +1,5 @@ {% macro address(address) %}
- dsadas {% include '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shared/address/billingAddressInfo.html.twig' with { address } only %} {{ address.phoneNumber }}
{{ address.street }}
From a930d5259f03e414e0221ddf3b09614825013fbb Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 17:33:49 +0100 Subject: [PATCH 20/28] Fix static analysis --- ...ng_information_in_shipping_address.feature | 2 +- ...ng_correct_taxes_based_on_customer.feature | 2 +- ...nInvoiceableAddressComparatorDecorator.php | 26 ++++++++--------- ...ItalianInvoiceableAddressTypeExtension.php | 5 ++++ src/Migrations/Version20260109151240.php | 5 ++++ .../ItalianInvoiceableAddressInterface.php | 7 +++-- .../ItalianInvoiceableOrderInterface.php | 3 ++ src/Model/ItalianTaxCalculationStrategy.php | 3 ++ src/Modifier/AddressFormValuesModifier.php | 1 + .../Constraints/ItalianTaxCodeValidator.php | 4 +++ .../Constraints/ItalianVatNumberValidator.php | 4 +++ tests/Behat/Context/Setup/ChannelContext.php | 22 ++------------- tests/Behat/Context/Setup/ZoneContext.php | 7 ++--- .../Checkout/CheckoutAddressingContext.php | 8 ------ tests/Behat/Resources/services.xml | 1 - .../Service/DefaultItalyChannelFactory.php | 28 ++++++++----------- 16 files changed, 62 insertions(+), 66 deletions(-) diff --git a/features/checkout/filling_invoicing_information/not_seeing_invoicing_information_in_shipping_address.feature b/features/checkout/filling_invoicing_information/not_seeing_invoicing_information_in_shipping_address.feature index 6ec40e1..6336b30 100644 --- a/features/checkout/filling_invoicing_information/not_seeing_invoicing_information_in_shipping_address.feature +++ b/features/checkout/filling_invoicing_information/not_seeing_invoicing_information_in_shipping_address.feature @@ -16,5 +16,5 @@ Feature: Not seeing invoicing information in shipping address When I specify the email as "jon.snow@example.com" And I specify the billing address for the individual "Jon Snow" - "Sunset Boulevard", "90210", "Los Angeles" - "United States" And I specify a valid billing individual tax code - And I want to ship to a different shipping address + And I do not specify any shipping address information Then I should not see any invoicing related field in the shipping address form diff --git a/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature b/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature index 4b3f719..6ba0a52 100644 --- a/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature +++ b/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature @@ -6,7 +6,7 @@ Feature: Apply correct taxes based on order address Background: Given the store operates on a single channel worldwide - And its tax calculation strategy is "Italian tax calculation" + And the store uses the "Italian tax calculation strategy" tax calculation strategy And there is a tax zone "EU" containing all European Union countries And there is a tax zone "Extra EU" containing all countries outside the European Union And there is a shipping zone "Global" containing all countries of the world diff --git a/src/Comparator/ItalianInvoiceableAddressComparatorDecorator.php b/src/Comparator/ItalianInvoiceableAddressComparatorDecorator.php index 32a7c83..303c4a6 100644 --- a/src/Comparator/ItalianInvoiceableAddressComparatorDecorator.php +++ b/src/Comparator/ItalianInvoiceableAddressComparatorDecorator.php @@ -10,14 +10,11 @@ final class ItalianInvoiceableAddressComparatorDecorator implements AddressComparatorInterface { - /** @var AddressComparatorInterface */ - private $defaultAddressComparator; - - public function __construct(AddressComparatorInterface $defaultAddressComparator) + public function __construct(private AddressComparatorInterface $defaultAddressComparator) { - $this->defaultAddressComparator = $defaultAddressComparator; } + #[\Override] public function equal(AddressInterface $firstAddress, AddressInterface $secondAddress): bool { $equal = $this->defaultAddressComparator->equal($firstAddress, $secondAddress); @@ -40,14 +37,17 @@ public function equal(AddressInterface $firstAddress, AddressInterface $secondAd private function normalizeInvoiceableAddress(ItalianInvoiceableAddressInterface $address): array { - return array_map(function ($value): string { + return array_map( + function ($value): string { return strtolower(trim((string) $value)); - }, [ - $address->getBillingRecipientType(), - $address->getTaxCode(), - $address->getVatNumber(), - $address->getSdiCode(), - $address->getPecAddress(), - ]); + }, + [ + $address->getBillingRecipientType(), + $address->getTaxCode(), + $address->getVatNumber(), + $address->getSdiCode(), + $address->getPecAddress(), + ], + ); } } diff --git a/src/Form/Extension/ItalianInvoiceableAddressTypeExtension.php b/src/Form/Extension/ItalianInvoiceableAddressTypeExtension.php index 94aafd3..c092026 100644 --- a/src/Form/Extension/ItalianInvoiceableAddressTypeExtension.php +++ b/src/Form/Extension/ItalianInvoiceableAddressTypeExtension.php @@ -11,8 +11,12 @@ use Symfony\Component\Form\FormBuilderInterface; use Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressInterface; +/** + * @psalm-suppress MissingTemplateParam + */ final class ItalianInvoiceableAddressTypeExtension extends AbstractTypeExtension { + #[\Override] public function buildForm(FormBuilderInterface $builder, array $options): void { $builder @@ -71,6 +75,7 @@ public static function getAvailableAddressTypes(): array ]; } + #[\Override] public static function getExtendedTypes(): array { return [AddressType::class]; diff --git a/src/Migrations/Version20260109151240.php b/src/Migrations/Version20260109151240.php index f2287c3..047f653 100644 --- a/src/Migrations/Version20260109151240.php +++ b/src/Migrations/Version20260109151240.php @@ -7,13 +7,18 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; +/** + * @psalm-api + */ final class Version20260109151240 extends AbstractMigration { + #[\Override] public function up(Schema $schema): void { $this->addSql('ALTER TABLE sylius_address ADD billing_recipient_type VARCHAR(255) DEFAULT NULL, ADD tax_code VARCHAR(255) DEFAULT NULL, ADD vat_number VARCHAR(255) DEFAULT NULL, ADD sdi_code VARCHAR(255) DEFAULT NULL, ADD pec_address VARCHAR(255) DEFAULT NULL'); } + #[\Override] public function down(Schema $schema): void { $this->addSql('ALTER TABLE sylius_address DROP billing_recipient_type, DROP tax_code, DROP vat_number, DROP sdi_code, DROP pec_address'); diff --git a/src/Model/ItalianInvoiceableAddressInterface.php b/src/Model/ItalianInvoiceableAddressInterface.php index 357cb7b..914b291 100644 --- a/src/Model/ItalianInvoiceableAddressInterface.php +++ b/src/Model/ItalianInvoiceableAddressInterface.php @@ -4,11 +4,14 @@ namespace Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model; +/** + * @psalm-api + */ interface ItalianInvoiceableAddressInterface { - public const BILLING_RECIPIENT_TYPE_INDIVIDUAL = 'individual'; + public const string BILLING_RECIPIENT_TYPE_INDIVIDUAL = 'individual'; - public const BILLING_RECIPIENT_TYPE_COMPANY = 'company'; + public const string BILLING_RECIPIENT_TYPE_COMPANY = 'company'; public function getBillingRecipientType(): ?string; diff --git a/src/Model/ItalianInvoiceableOrderInterface.php b/src/Model/ItalianInvoiceableOrderInterface.php index a03eca8..23be643 100644 --- a/src/Model/ItalianInvoiceableOrderInterface.php +++ b/src/Model/ItalianInvoiceableOrderInterface.php @@ -4,6 +4,9 @@ namespace Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model; +/** + * @psalm-api + */ interface ItalianInvoiceableOrderInterface { public function getBillingRecipientType(): ?string; diff --git a/src/Model/ItalianTaxCalculationStrategy.php b/src/Model/ItalianTaxCalculationStrategy.php index c739b0c..e71e33e 100644 --- a/src/Model/ItalianTaxCalculationStrategy.php +++ b/src/Model/ItalianTaxCalculationStrategy.php @@ -32,6 +32,7 @@ public function __construct(string $type, array $applicators, string $euTaxZoneC $this->euTaxZoneCode = $euTaxZoneCode; } + #[\Override] public function applyTaxes(OrderInterface $order, ZoneInterface $zone): void { if ($this->shouldSkipTaxesApplication($order, $zone)) { @@ -43,11 +44,13 @@ public function applyTaxes(OrderInterface $order, ZoneInterface $zone): void } } + #[\Override] public function getType(): string { return $this->type; } + #[\Override] public function supports(OrderInterface $order, ZoneInterface $zone): bool { /** @var ChannelInterface|\Sylius\Component\Channel\Model\ChannelInterface $channel */ diff --git a/src/Modifier/AddressFormValuesModifier.php b/src/Modifier/AddressFormValuesModifier.php index 35fe338..3760917 100644 --- a/src/Modifier/AddressFormValuesModifier.php +++ b/src/Modifier/AddressFormValuesModifier.php @@ -16,6 +16,7 @@ * * @return array */ + #[\Override] public function modify(array $addressData, AddressInterface $address): array { Assert::isInstanceOf( diff --git a/src/Validator/Constraints/ItalianTaxCodeValidator.php b/src/Validator/Constraints/ItalianTaxCodeValidator.php index d7543fc..827d9ac 100644 --- a/src/Validator/Constraints/ItalianTaxCodeValidator.php +++ b/src/Validator/Constraints/ItalianTaxCodeValidator.php @@ -9,8 +9,12 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedValueException; +/** + * @psalm-api + */ final class ItalianTaxCodeValidator extends ConstraintValidator { + #[\Override] public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof ItalianTaxCode) { diff --git a/src/Validator/Constraints/ItalianVatNumberValidator.php b/src/Validator/Constraints/ItalianVatNumberValidator.php index 1abe2f9..f1d92c4 100644 --- a/src/Validator/Constraints/ItalianVatNumberValidator.php +++ b/src/Validator/Constraints/ItalianVatNumberValidator.php @@ -9,8 +9,12 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedValueException; +/** + * @psalm-api + */ final class ItalianVatNumberValidator extends ConstraintValidator { + #[\Override] public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof ItalianVatNumber) { diff --git a/tests/Behat/Context/Setup/ChannelContext.php b/tests/Behat/Context/Setup/ChannelContext.php index 30fc017..10b717b 100644 --- a/tests/Behat/Context/Setup/ChannelContext.php +++ b/tests/Behat/Context/Setup/ChannelContext.php @@ -7,28 +7,22 @@ use Behat\Behat\Context\Context; use Sylius\Behat\Service\SharedStorageInterface; use Sylius\Component\Addressing\Model\CountryInterface; +use Sylius\Component\Addressing\Repository\CountryRepositoryInterface; use Sylius\Component\Channel\Repository\ChannelRepositoryInterface; use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Test\Services\DefaultChannelFactoryInterface; use Sylius\Component\Resource\Factory\FactoryInterface; -use Sylius\Component\Resource\Repository\RepositoryInterface; use Symfony\Component\Intl\Countries; -use Webmozart\Assert\Assert; final class ChannelContext implements Context { - /** - * @param FactoryInterface $countryFactory - * @param RepositoryInterface $countryRepository - */ public function __construct( private DefaultChannelFactoryInterface $defaultChannelFactory, private DefaultChannelFactoryInterface $defaultItalyChannelFactory, private SharedStorageInterface $sharedStorage, private FactoryInterface $countryFactory, private ChannelRepositoryInterface $channelRepository, - private RepositoryInterface $countryRepository, - private array $availableTaxCalculationStrategies, + private CountryRepositoryInterface $countryRepository, ) { } @@ -52,6 +46,7 @@ public function theStoreOperatesOnASingleChannelWorldwide(): void /** @var ChannelInterface $channel */ $channel = $defaultData['channel']; foreach (Countries::getCountryCodes() as $countryCode) { + /** @var CountryInterface $country */ $country = $this->countryFactory->createNew(); $country->setCode($countryCode); $country->setEnabled(true); @@ -64,15 +59,4 @@ public function theStoreOperatesOnASingleChannelWorldwide(): void $this->sharedStorage->setClipboard($defaultData); $this->sharedStorage->set('channel', $channel); } - - /** - * @Given /^(its) tax calculation strategy is "([^"]*)"$/ - */ - public function itsTaxCalculationStrategyIs(ChannelInterface $channel, string $taxCalculationStrategy): void - { - $strategies = array_flip($this->availableTaxCalculationStrategies); - Assert::keyExists($strategies, $taxCalculationStrategy); - $channel->setTaxCalculationStrategy($strategies[$taxCalculationStrategy]); - $this->channelRepository->add($channel); - } } diff --git a/tests/Behat/Context/Setup/ZoneContext.php b/tests/Behat/Context/Setup/ZoneContext.php index 3cdb3ce..908b92b 100644 --- a/tests/Behat/Context/Setup/ZoneContext.php +++ b/tests/Behat/Context/Setup/ZoneContext.php @@ -7,18 +7,15 @@ use Behat\Behat\Context\Context; use Sylius\Component\Addressing\Factory\ZoneFactoryInterface; use Sylius\Component\Addressing\Model\ZoneInterface; +use Sylius\Component\Addressing\Repository\ZoneRepositoryInterface; use Sylius\Component\Core\Formatter\StringInflector; -use Sylius\Component\Resource\Repository\RepositoryInterface; use Symfony\Component\Intl\Countries; final class ZoneContext implements Context { - /** - * @param RepositoryInterface $zoneRepository - */ public function __construct( private ZoneFactoryInterface $zoneFactory, - private RepositoryInterface $zoneRepository, + private ZoneRepositoryInterface $zoneRepository, ) { } diff --git a/tests/Behat/Context/Ui/Shop/Checkout/CheckoutAddressingContext.php b/tests/Behat/Context/Ui/Shop/Checkout/CheckoutAddressingContext.php index db5503a..ea67f4d 100644 --- a/tests/Behat/Context/Ui/Shop/Checkout/CheckoutAddressingContext.php +++ b/tests/Behat/Context/Ui/Shop/Checkout/CheckoutAddressingContext.php @@ -85,14 +85,6 @@ public function iSpecifyAValidBillingPecAddress(): void $this->addressPage->specifyBillingPecAddress($this->fakerGenerator->email); } - /** - * @When /^I want to ship to a different shipping address$/ - */ - public function iWantToShipToADifferentShippingAddress(): void - { - $this->addressPage->chooseDifferentShippingAddress(); - } - /** * @Then /^I should not see any invoicing related field in the shipping address form$/ */ diff --git a/tests/Behat/Resources/services.xml b/tests/Behat/Resources/services.xml index cec7f39..e433b38 100644 --- a/tests/Behat/Resources/services.xml +++ b/tests/Behat/Resources/services.xml @@ -15,7 +15,6 @@ - %sylius.tax_calculation_strategies% diff --git a/tests/Behat/Service/DefaultItalyChannelFactory.php b/tests/Behat/Service/DefaultItalyChannelFactory.php index dd50579..61ea646 100644 --- a/tests/Behat/Service/DefaultItalyChannelFactory.php +++ b/tests/Behat/Service/DefaultItalyChannelFactory.php @@ -7,10 +7,14 @@ use Sylius\Component\Addressing\Factory\ZoneFactoryInterface; use Sylius\Component\Addressing\Model\CountryInterface; use Sylius\Component\Addressing\Model\ZoneInterface; +use Sylius\Component\Addressing\Repository\CountryRepositoryInterface; +use Sylius\Component\Addressing\Repository\ZoneRepositoryInterface; use Sylius\Component\Channel\Factory\ChannelFactoryInterface; +use Sylius\Component\Channel\Repository\ChannelRepositoryInterface; use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Test\Services\DefaultChannelFactoryInterface; use Sylius\Component\Currency\Model\CurrencyInterface; +use Sylius\Component\Currency\Repository\CurrencyRepositoryInterface; use Sylius\Component\Locale\Model\LocaleInterface; use Sylius\Component\Resource\Factory\FactoryInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; @@ -29,22 +33,12 @@ class DefaultItalyChannelFactory implements DefaultChannelFactoryInterface public const DEFAULT_CHANNEL_NAME = 'Italy'; - /** - * @param RepositoryInterface $channelRepository - * @param RepositoryInterface $countryRepository - * @param RepositoryInterface $currencyRepository - * @param RepositoryInterface $localeRepository - * @param RepositoryInterface $zoneRepository - * @param FactoryInterface $countryFactory - * @param FactoryInterface $currencyFactory - * @param FactoryInterface $localeFactory - */ public function __construct( - private RepositoryInterface $channelRepository, - private RepositoryInterface $countryRepository, - private RepositoryInterface $currencyRepository, + private ChannelRepositoryInterface $channelRepository, + private CountryRepositoryInterface $countryRepository, + private CurrencyRepositoryInterface $currencyRepository, private RepositoryInterface $localeRepository, - private RepositoryInterface $zoneRepository, + private ZoneRepositoryInterface $zoneRepository, private ChannelFactoryInterface $channelFactory, private FactoryInterface $countryFactory, private FactoryInterface $currencyFactory, @@ -96,6 +90,7 @@ private function createChannel(string $code, string $name): ChannelInterface private function createCountry(): CountryInterface { + /** @var CountryInterface $country */ $country = $this->countryFactory->createNew(); $country->setCode(self::DEFAULT_COUNTRY_CODE); @@ -106,8 +101,8 @@ private function provideCurrency(?string $currencyCode = null): CurrencyInterfac { $currencyCode = $currencyCode ?? self::DEFAULT_CURRENCY_CODE; + /** @var CurrencyInterface|null $currency */ $currency = $this->currencyRepository->findOneBy(['code' => $currencyCode]); - if (null === $currency) { /** @var CurrencyInterface $currency */ $currency = $this->currencyFactory->createNew(); @@ -121,9 +116,10 @@ private function provideCurrency(?string $currencyCode = null): CurrencyInterfac private function provideLocale(?string $localeCode = null): LocaleInterface { + /** @var LocaleInterface|null $locale */ $locale = $this->localeRepository->findOneBy(['code' => $this->defaultLocaleCode]); - if (null === $locale) { + /** @var LocaleInterface $locale */ $locale = $this->localeFactory->createNew(); $locale->setCode($localeCode ?? $this->defaultLocaleCode); From 791c776cd14cdce8c8f29b3edefc29b74a20dad8 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 17:49:48 +0100 Subject: [PATCH 21/28] Retrieve address type from the form 'cause in Sylius 2 we don't have that info in these templates --- .../address/billingRecipientType.html.twig | 14 ++++++------- .../address/invoiceableBillingData.html.twig | 20 +++++++++---------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/templates/shop/shared/form/address/billingRecipientType.html.twig b/templates/shop/shared/form/address/billingRecipientType.html.twig index 5b85457..c70f87e 100644 --- a/templates/shop/shared/form/address/billingRecipientType.html.twig +++ b/templates/shop/shared/form/address/billingRecipientType.html.twig @@ -1,9 +1,7 @@ -{% if hookable_metadata.context.type is defined %} - {% set type = hookable_metadata.context.type ~ '-' %} -{% else %} - {% set type = null %} -{% endif %} - -{% if type != 'shipping-' %} - {{ form_row(hookable_metadata.context.form.billingRecipientType, sylius_test_form_attribute(type ~ 'billing-recipient-type')) }} +{# +PSA: we could check if the "type" is billing or shipping, but this info is not passed through by checkout/address/content/form/addresses/address/form.html.twig template, +so we have to rely on the form name +#} +{% if hookable_metadata.context.form.vars.name is defined and hookable_metadata.context.form.vars.name != 'shippingAddress' %} + {{ form_row(hookable_metadata.context.form.billingRecipientType, sylius_test_form_attribute('billing-recipient-type')) }} {% endif %} diff --git a/templates/shop/shared/form/address/invoiceableBillingData.html.twig b/templates/shop/shared/form/address/invoiceableBillingData.html.twig index bb12a40..20ec54d 100644 --- a/templates/shop/shared/form/address/invoiceableBillingData.html.twig +++ b/templates/shop/shared/form/address/invoiceableBillingData.html.twig @@ -1,12 +1,10 @@ -{% if hookable_metadata.context.type is defined %} - {% set type = hookable_metadata.context.type ~ '-' %} -{% else %} - {% set type = null %} -{% endif %} - -{% if type != 'shipping-' %} - {{ form_row(hookable_metadata.context.form.taxCode, sylius_test_form_attribute(type ~ 'tax-code')) }} - {{ form_row(hookable_metadata.context.form.vatNumber, sylius_test_form_attribute(type ~ 'vat-number')) }} - {{ form_row(hookable_metadata.context.form.sdiCode, sylius_test_form_attribute(type ~ 'sdi-code')) }} - {{ form_row(hookable_metadata.context.form.pecAddress, sylius_test_form_attribute(type ~ 'pec-address')) }} +{# +PSA: we could check if the "type" is billing or shipping, but this info is not passed through by checkout/address/content/form/addresses/address/form.html.twig template, +so we have to rely on the form name +#} +{% if hookable_metadata.context.form.vars.name is defined and hookable_metadata.context.form.vars.name != 'shippingAddress' %} + {{ form_row(hookable_metadata.context.form.taxCode, sylius_test_form_attribute('tax-code')) }} + {{ form_row(hookable_metadata.context.form.vatNumber, sylius_test_form_attribute('vat-number')) }} + {{ form_row(hookable_metadata.context.form.sdiCode, sylius_test_form_attribute('sdi-code')) }} + {{ form_row(hookable_metadata.context.form.pecAddress, sylius_test_form_attribute('pec-address')) }} {% endif %} From c11beaae79f6a7d2f977b237ec3a42b07fae4099 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 17:50:30 +0100 Subject: [PATCH 22/28] In behat using @javascript it seems like the selectOption method is not working --- ...filling_invoicing_information_as_guest.feature | 2 +- tests/Behat/Page/Shop/Checkout/AddressPage.php | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/features/checkout/filling_invoicing_information/filling_invoicing_information_as_guest.feature b/features/checkout/filling_invoicing_information/filling_invoicing_information_as_guest.feature index f4470e4..1310df4 100644 --- a/features/checkout/filling_invoicing_information/filling_invoicing_information_as_guest.feature +++ b/features/checkout/filling_invoicing_information/filling_invoicing_information_as_guest.feature @@ -27,7 +27,7 @@ Feature: Filling invoicing information for an order And I complete the addressing step Then I should be on the checkout shipping step - @ui + @ui @javascript Scenario: Filling invoicing information with different shipping address When I specify the email as "jon.snow@example.com" And I specify the billing address for the individual "Jon Snow" - "Sunset Boulevard", "90210", "Los Angeles" - "United States" diff --git a/tests/Behat/Page/Shop/Checkout/AddressPage.php b/tests/Behat/Page/Shop/Checkout/AddressPage.php index c04bfb8..8dd2505 100644 --- a/tests/Behat/Page/Shop/Checkout/AddressPage.php +++ b/tests/Behat/Page/Shop/Checkout/AddressPage.php @@ -5,6 +5,7 @@ namespace Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin\Behat\Page\Shop\Checkout; use Sylius\Behat\Page\Shop\Checkout\AddressPage as BaseAddressPage; +use Sylius\Behat\Service\DriverHelper; use Sylius\Component\Core\Model\AddressInterface; use Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressInterface; use Webmozart\Assert\Assert; @@ -17,9 +18,18 @@ class AddressPage extends BaseAddressPage implements AddressPageInterface public function specifyBillingAddress(AddressInterface $billingAddress): void { Assert::isInstanceOf($billingAddress, ItalianInvoiceableAddressInterface::class); - if (null !== $billingAddress->getBillingRecipientType()) { - $this->getElement(sprintf('%s_billing_recipient_type', BaseAddressPage::TYPE_BILLING))->selectOption($billingAddress->getBillingRecipientType()); + $billingRecipientType = $billingAddress->getBillingRecipientType(); + + // we should use the ->selectOption method on the recipient type element but at the moment it is not working when using @javascript.. + // so we click on the individual option directly + if ($billingRecipientType === ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_INDIVIDUAL && DriverHelper::isJavascript($this->getDriver())) { + DriverHelper::waitForPageToLoad($this->getSession()); + $nodeElement = $this->getElement(sprintf('%s_billing_recipient_type_individual', BaseAddressPage::TYPE_BILLING)); + $nodeElement->click(); + } elseif (null !== $billingRecipientType) { + $this->getElement(sprintf('%s_billing_recipient_type', BaseAddressPage::TYPE_BILLING))->selectOption($billingRecipientType); } + parent::specifyBillingAddress($billingAddress); if (null !== $billingAddress->getCompany()) { $this->waitForElement(5, sprintf('%s_company', BaseAddressPage::TYPE_BILLING)); @@ -52,6 +62,7 @@ protected function getDefinedElements(): array return array_merge( [ 'billing_billing_recipient_type' => '[data-test-billing-address] [data-test-billing-recipient-type] input', + 'billing_billing_recipient_type_individual' => '[data-test-billing-address] [data-test-billing-recipient-type] input[value="' . ItalianInvoiceableAddressInterface::BILLING_RECIPIENT_TYPE_INDIVIDUAL . '"]', 'billing_tax_code' => '[data-test-billing-address] [data-test-tax-code]', 'billing_company' => '[data-test-billing-address] [data-test-company]', 'billing_vat_number' => '[data-test-billing-address] [data-test-vat-number]', From 6ed4ff2b3fd652a345b7c5f84a227848e6087a3e Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 18:09:45 +0100 Subject: [PATCH 23/28] Use correct FCQN for validation callback too --- ...having_new_invoiceable_address_saved_in_address_book.feature | 2 ++ tests/Behat/Resources/suites.yml | 1 + tests/TestApplication/config/validation/Order.xml | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature b/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature index c499c21..67d6c9b 100644 --- a/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature +++ b/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature @@ -22,6 +22,7 @@ Feature: Having new invoiceable addresses saved in the address book after checko And I complete the addressing step And I proceed with "Free" shipping method and "Cash on Delivery" payment And I confirm my order + And I should see the thank you page Then I should have a single address in my address book @ui @@ -35,4 +36,5 @@ Feature: Having new invoiceable addresses saved in the address book after checko And I complete the addressing step And I proceed with "Free" shipping method and "Cash on Delivery" payment And I confirm my order + And I should see the thank you page Then I should have 2 addresses in my address book diff --git a/tests/Behat/Resources/suites.yml b/tests/Behat/Resources/suites.yml index f463d88..db503ab 100644 --- a/tests/Behat/Resources/suites.yml +++ b/tests/Behat/Resources/suites.yml @@ -58,6 +58,7 @@ default: - sylius.behat.context.ui.shop.checkout.complete - sylius.behat.context.ui.shop.address_book - sylius.behat.context.ui.shop.checkout + - sylius.behat.context.ui.shop.checkout.thank_you - webgriffe_sylius_italian_invoiceable_order.behat.context.ui.shop.checkout.addressing filters: diff --git a/tests/TestApplication/config/validation/Order.xml b/tests/TestApplication/config/validation/Order.xml index 1d3d6e6..de41889 100644 --- a/tests/TestApplication/config/validation/Order.xml +++ b/tests/TestApplication/config/validation/Order.xml @@ -9,7 +9,7 @@ From ffb939c6e1b9a93531258a4f6c50d0e6501c9d66 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Thu, 15 Jan 2026 18:11:06 +0100 Subject: [PATCH 24/28] Enforce Sylius ^2.2 as Address Form Values Modifiers were introduced from 2.2 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8d3e4e1..07c3cae 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "php": "^8.2", "dragonbe/vies": "^2.3.2", "sandwich/vies-bundle": "dev-patch-1", - "sylius/sylius": "^2.0", + "sylius/sylius": "^2.2", "webmozart/assert": "^1.9" }, "require-dev": { From 01a5f83bb1f25434e0ba01031cb9e98717efc72b Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Fri, 16 Jan 2026 11:02:41 +0100 Subject: [PATCH 25/28] Adds patch to remove payum core deprecations https://github.com/Payum/Core/pull/8 --- composer.json | 3 ++ patches/payum-core-remove-deprecations.patch | 57 ++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 patches/payum-core-remove-deprecations.patch diff --git a/composer.json b/composer.json index 07c3cae..1d32e40 100644 --- a/composer.json +++ b/composer.json @@ -77,6 +77,9 @@ "patches": { "sylius/sylius": { "Cast ID to string in Behat AddressPage class": "patches/sylius-behat-cast-id-to-string.patch" + }, + "payum/core": { + "Remove deprecations (https://github.com/Payum/Core/pull/8)": "patches/payum-core-remove-deprecations.patch" } } }, diff --git a/patches/payum-core-remove-deprecations.patch b/patches/payum-core-remove-deprecations.patch new file mode 100644 index 0000000..47afcff --- /dev/null +++ b/patches/payum-core-remove-deprecations.patch @@ -0,0 +1,57 @@ +From a9f3ce4601b5e9061351d2cd95c6ee3d03b278d9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mag=C3=AD=20Carbonell?= + <92313746+mcarbonell-paymefy@users.noreply.github.com> +Date: Thu, 15 Jan 2026 19:42:40 +0100 +Subject: [PATCH] Refactor RequestTokenVerifier to address League/Uri + deprecations + +This commit updates RequestTokenVerifier.php to ensure compatibility with newer versions of the league/uri library while maintaining backward compatibility. + +Following the pattern established in previous core updates (commit 4efe88d), the following changes were made: +- Replaced deprecated static factory calls with the new new() method where available. +- Added method_exists checks for both HttpUri and Path classes to prevent breaking changes in environments using older versions of the library. +- Aligned imports and class aliases with existing core standards (using HttpUri as an alias for League\Uri\Http). + +These changes eliminate deprecation notices in modern PHP environments and unify the URI handling logic across the project. +--- + Security/Util/RequestTokenVerifier.php | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/Security/Util/RequestTokenVerifier.php b/Security/Util/RequestTokenVerifier.php +index 03f64204..dde5898a 100644 +--- a/Security/Util/RequestTokenVerifier.php ++++ b/Security/Util/RequestTokenVerifier.php +@@ -3,7 +3,7 @@ + namespace Payum\Core\Security\Util; + + use League\Uri\Components\Path; +-use League\Uri\Http; ++use League\Uri\Http as HttpUri; + + class RequestTokenVerifier + { +@@ -14,11 +14,20 @@ class RequestTokenVerifier + */ + public static function isValid($requestUri, $tokenUri) + { +- $uri = Http::createFromString($requestUri); +- $altUri = Http::createFromString($tokenUri); ++ $uri = method_exists(HttpUri::class, 'new') ? HttpUri::new($requestUri) : HttpUri::createFromString( ++ $requestUri ++ ); ++ $altUri = method_exists(HttpUri::class, 'new') ? HttpUri::new($tokenUri) : HttpUri::createFromString( ++ $tokenUri ++ ); ++ + +- $uriPath = Path::createFromUri($uri); +- $altUriPath = Path::createFromUri($altUri); ++ $uriPath = method_exists(Path::class, 'new') ? Path::new($uri) : Path::createFromUri( ++ $uri ++ ); ++ $altUriPath = method_exists(Path::class, 'new') ? Path::new($altUri) : Path::createFromUri( ++ $altUri ++ ); + + return rawurldecode((string) $uriPath) === rawurldecode((string) $altUriPath); + } From 20cfaed85e00102515e80f2ec47e38e467eb2d30 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Fri, 16 Jan 2026 15:40:44 +0100 Subject: [PATCH 26/28] Updates README --- README.md | 52 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 30f708a..9bc9412 100644 --- a/README.md +++ b/README.md @@ -11,19 +11,39 @@ ## Installation +0. This plugin requires the [MyOnlineStore/ViesBundle](https://github.com/MyOnlineStore/ViesBundle) but this is not actually compatible with Symfony 7, there is an open PR: https://github.com/MyOnlineStore/ViesBundle/pull/18 + + Thus, you have to run the following command to require a fork of the bundle which is compatible with Symfony 7: + + ```bash + composer config repositories.sandwich/vies-bundle git https://github.com/mmenozzi/ViesBundle.git + ``` + + and you have to run this command too to allow "dev" versions of the bundle (we need the "dev-patch-1" version): + + ```bash + composer config minimum-stability dev + ``` + 1. Require the plugin: ```bash composer require webgriffe/sylius-italian-invoiceable-order-plugin ``` -2. Add bundles to `config/bundles.php` file: +2. If they have not been added automatically, you have to add these bundles to `config/bundles.php` file: ```php Sandwich\ViesBundle\SandwichViesBundle::class => ['all' => true], Webgriffe\SyliusItalianInvoiceableOrderPlugin\WebgriffeSyliusItalianInvoiceableOrderPlugin::class => ['all' => true], ``` +3. Configure your ActiveCampaign API connection parameters by creating the `config/packages/webgriffe_sylius_italian_invoiceable_order_plugin.yaml` file with the following content: + ```yaml + imports: + - { resource: "@WebgriffeSyliusItalianInvoiceableOrderPlugin/config/config.yaml" } + ``` + 3. By default, the parameter `app.taxation.eu_zone_code` is set to "EU", as it must be the code of a zone representing the EU. This is used to determine if an order is invoiced to a company within the EU or not. Please change this parameter according to your Sylius's zone configuration if needed: ```yaml @@ -40,18 +60,32 @@ ```bash mkdir -p config/validator/ - cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validator/Address.xml config/validator/ - cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validator/Order.xml config/validator/ + cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validation/Address.xml config/validator/ + cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validation/Order.xml config/validator/ ``` - Or by merging the configuration into your existing `Address` and `Order` validator configuration. + **WAIT! We are not done with this step yet.** You must edit these files to change the namespace `Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin` to your own project namespace: there are 3 references that you have to change among these files. + + If you have the "App" as the base namespace of your app, this command should be enough: + + Linux: + ```bash + sed -i 's/Tests\\Webgriffe\\SyliusItalianInvoiceableOrderPlugin/App/g' config/validator/Address.xml config/validator/Order.xml + ``` + + MacOS: + ```bash + sed -i '' 's/Tests\\Webgriffe\\SyliusItalianInvoiceableOrderPlugin/App/g' config/validator/Address.xml config/validator/Order.xml + ``` + + If you alread have some validator file for these entities you have to merge the configuration manually. 7. Configure Sylius to use the `Italian tax calculation` tax calculation strategy. 8. To properly enable group sequence validation of your Address entity you must set the `Default` validation group instead of the `sylius` validation group: ```yaml - # config/services.yaml + # config/parameters.yaml parameters: # ... sylius.form.type.address.validation_groups: ['Default'] @@ -62,11 +96,10 @@ 9. Run migration ```bash - vendor/bin/console cache:clear - vendor/bin/console doctrine:migrations:migrate + bin/console cache:clear + bin/console doctrine:migrations:migrate ``` - 10. Add invoiceable fields to the address show template for admin. To do so you have to override this template: ```bash @@ -76,7 +109,8 @@ by copying directly our implementation provided in the plugin: ```bash - cp tests/TestApplication/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig + mkdir -p templates/bundles/SyliusAdminBundle/shared/helper/ + cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig ``` or by copying the original template and adding the invoiceable fields by yourself. In this case your template should look like the following: From 1e9488343eef432735fc05781bc6278f246269ed Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Fri, 16 Jan 2026 15:43:24 +0100 Subject: [PATCH 27/28] Remove panther as we dont' use it --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 1d32e40..3b31a33 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,6 @@ "polishsymfonycommunity/symfony-mocker-container": "^1.0", "psalm/plugin-symfony": "^5.2", "rector/rector": "^1.0", - "robertfausk/behat-panther-extension": "^1.1", "sylius-labs/coding-standard": "^4.4", "sylius-labs/suite-tags-extension": "~0.2", "sylius/sylius-rector": "^2.0", From fddd39189df55b7e04d99a64b67bf7745971a41d Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Fri, 16 Jan 2026 15:45:17 +0100 Subject: [PATCH 28/28] Add bin/console alias --- bin/console | 1 + bin/create_console_symlink.php | 53 ++++++++++++++++++++++++++++++++++ composer.json | 11 ++++++- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 120000 bin/console create mode 100644 bin/create_console_symlink.php diff --git a/bin/console b/bin/console new file mode 120000 index 0000000..46e506e --- /dev/null +++ b/bin/console @@ -0,0 +1 @@ +../vendor/bin/console \ No newline at end of file diff --git a/bin/create_console_symlink.php b/bin/create_console_symlink.php new file mode 100644 index 0000000..9dbf03c --- /dev/null +++ b/bin/create_console_symlink.php @@ -0,0 +1,53 @@ + {$targetRelativeFromBin}"); +} + +@chmod($linkPath, 0755); +info("Created symlink: bin/console -> {$targetRelativeFromBin}"); diff --git a/composer.json b/composer.json index 3b31a33..f6a668b 100644 --- a/composer.json +++ b/composer.json @@ -127,6 +127,15 @@ ], "auto-scripts": { "security-checker security:check": "script" - } + }, + "post-install-cmd": [ + "@create-console-symlink" + ], + "post-update-cmd": [ + "@create-console-symlink" + ], + "create-console-symlink": [ + "@php bin/create_console_symlink.php" + ] } }