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..cf21311 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.2.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..9bc9412 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,56 @@

- - + +

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

## 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. 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. 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 + # 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. @@ -33,18 +60,32 @@ ```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/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'] @@ -52,171 +93,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 - bin/console doctrine:migrations:diff + bin/console cache:clear 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 + 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: + ```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: @@ -236,33 +153,62 @@ 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 - -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). +1. Clone this repository into you development environment and go to the plugin's root directory, -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. -### Running plugin tests +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 + ``` + +6. Then, from the plugin's root directory, run the following commands: + + ```bash + composer test-app-init + ``` + +7. Run your local server: + + ```bash + symfony server:ca:install + symfony server:start -d + ``` + +8. Now at http://localhost:8080/ you have a full Sylius testing application which runs the plugin + +### 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 +``` + +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: @@ -299,7 +245,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..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 @@ -20,7 +19,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: @@ -34,24 +33,13 @@ 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: - 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/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/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..f6a668b 100644 --- a/composer.json +++ b/composer.json @@ -4,92 +4,138 @@ "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", + "sandwich/vies-bundle": "dev-patch-1", + "sylius/sylius": "^2.2", "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", + "cweagans/composer-patches": "^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", - "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" + "psalm/plugin-symfony": "^5.2", + "rector/rector": "^1.0", + "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": { + "cweagans/composer-patches": true, "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", + "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" + } + } + }, + "repositories": { + "sandwich/vies-bundle": { + "type": "git", + "url": "https://github.com/mmenozzi/ViesBundle.git" } }, "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" ], - "post-update-cmd": [ - "php bin/create_node_symlink.php" + "frontend-clear": [ + "cd vendor/sylius/test-application && yarn install && yarn build", + "vendor/bin/console assets:install" ], - "post-create-project-cmd": [ - "php bin/create_node_symlink.php" + "test-app-init": [ + "@database-reset", + "@frontend-clear" + ], + "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" - } + }, + "post-install-cmd": [ + "@create-console-symlink" + ], + "post-update-cmd": [ + "@create-console-symlink" + ], + "create-console-symlink": [ + "@php bin/create_console_symlink.php" + ] } } diff --git a/config/config.yaml b/config/config.yaml new file mode 100644 index 0000000..d2a2a46 --- /dev/null +++ b/config/config.yaml @@ -0,0 +1,5 @@ +imports: + - { resource: 'twig_hooks/**/*.yaml' } + +parameters: + sylius.form.type.address.validation_groups: [ 'Default' ] 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..7ea3265 --- /dev/null +++ b/config/services/services.yaml @@ -0,0 +1,31 @@ +parameters: + app.taxation.eu_zone_code: 'EU' + +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.comparator.address + arguments: + - '@webgriffe_sylius_italian_invoiceable_order.address_comparator.inner' + + app.taxation.italian_tax_calculation_strategy: + class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianTaxCalculationStrategy + arguments: + - 'italian_tax_calculation_strategy' + - [ + '@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' } + + 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/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/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/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/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 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/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..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 @@ -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 @@ -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/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..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 @@ -8,13 +8,13 @@ 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" 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/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..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 @@ -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 @@ -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/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..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,77 +6,84 @@ 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 - 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/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 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/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); + } 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'); + } 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/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/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/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/tests/Application/config/secrets/test/.gitignore b/src/Migrations/.gitkeep similarity index 100% rename from tests/Application/config/secrets/test/.gitignore rename to src/Migrations/.gitkeep diff --git a/src/Migrations/Version20260109151240.php b/src/Migrations/Version20260109151240.php new file mode 100644 index 0000000..047f653 --- /dev/null +++ b/src/Migrations/Version20260109151240.php @@ -0,0 +1,26 @@ +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/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/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 cb4762f..e71e33e 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 @@ -34,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)) { @@ -45,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 new file mode 100644 index 0000000..3760917 --- /dev/null +++ b/src/Modifier/AddressFormValuesModifier.php @@ -0,0 +1,38 @@ + $addressData + * + * @return array + */ + #[\Override] + 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; + } +} 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/Resources/views/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig b/src/Resources/views/Checkout/Address/_addressBookSelectInvoiceableDataAttributes.html.twig deleted file mode 100644 index b062bf6..0000000 --- a/src/Resources/views/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/src/Resources/views/Common/_invoiceableAddressInfo.html.twig b/src/Resources/views/Common/_invoiceableAddressInfo.html.twig deleted file mode 100644 index bb5ccd4..0000000 --- a/src/Resources/views/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/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/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/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" - } -} 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..cd75ee9 --- /dev/null +++ b/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/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/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..c70f87e --- /dev/null +++ b/templates/shop/shared/form/address/billingRecipientType.html.twig @@ -0,0 +1,7 @@ +{# +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 new file mode 100644 index 0000000..20ec54d --- /dev/null +++ b/templates/shop/shared/form/address/invoiceableBillingData.html.twig @@ -0,0 +1,10 @@ +{# +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 %} 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 592f7a8..0000000 Binary files a/tests/Application/public/favicon.ico and /dev/null differ 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/templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Common/Form/_address.html.twig deleted file mode 100644 index 4bb5318..0000000 --- a/tests/Application/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/Application/templates/bundles/SyliusAdminBundle/Common/_address.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Common/_address.html.twig deleted file mode 100644 index 144278d..0000000 --- a/tests/Application/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/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig deleted file mode 100644 index 1d9fa7d..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig +++ /dev/null @@ -1,5 +0,0 @@ - -
- -
-
diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Security/_content.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Security/_content.html.twig deleted file mode 100644 index ce17621..0000000 --- a/tests/Application/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/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig deleted file mode 100644 index f5f9835..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_script_tags('admin-entry', null, 'admin') }} diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig deleted file mode 100644 index a96144c..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_link_tags('admin-entry', null, 'admin') }} diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Checkout/Address/_addressBookSelect.html.twig deleted file mode 100644 index 90cae99..0000000 --- a/tests/Application/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/Application/templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Common/Form/_address.html.twig deleted file mode 100644 index 1b2cd9b..0000000 --- a/tests/Application/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/Application/templates/bundles/SyliusShopBundle/Common/_address.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Common/_address.html.twig deleted file mode 100644 index fe9261f..0000000 --- a/tests/Application/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/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig deleted file mode 100644 index 8486493..0000000 --- a/tests/Application/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/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig deleted file mode 100644 index 84b8df5..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -
- - Sylius logo - -
diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig deleted file mode 100644 index d1655bb..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_script_tags('shop-entry', null, 'shop') }} diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig deleted file mode 100644 index fd2c7cb..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_link_tags('shop-entry', null, 'shop') }} 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/Context/Setup/ChannelContext.php b/tests/Behat/Context/Setup/ChannelContext.php index e114c78..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/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..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, ) { } @@ -75,7 +72,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..ea67f4d 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); @@ -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$/ */ @@ -149,7 +141,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 +161,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 +180,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 +190,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 +200,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 +224,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 +240,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 +282,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 +301,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 +320,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 +345,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 +358,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 +368,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/AddressPage.php b/tests/Behat/Page/Shop/Checkout/AddressPage.php index d2199c8..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)); @@ -51,19 +61,20 @@ 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_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]', + '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/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/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/Resources/suites.yml b/tests/Behat/Resources/suites.yml index ee38cee..db503ab 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 @@ -30,7 +31,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: @@ -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 @@ -56,10 +58,11 @@ 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: - tags: "@invoiceable_address_book && @ui" + tags: "@invoiceable_address_book&&@ui" ui_applying_taxes: contexts: @@ -72,20 +75,27 @@ 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: - tags: "@applying_taxes && @ui" + tags: "@applying_taxes&&@ui" diff --git a/tests/Behat/Service/DefaultItalyChannelFactory.php b/tests/Behat/Service/DefaultItalyChannelFactory.php index 9530ab3..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,28 +33,18 @@ 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, private FactoryInterface $localeFactory, private ZoneFactoryInterface $zoneFactory, - private string $defaultLocaleCode + private string $defaultLocaleCode, ) { } @@ -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); diff --git a/tests/Application/config/secrets/test_cached/.gitignore b/tests/Functional/.gitignore similarity index 100% rename from tests/Application/config/secrets/test_cached/.gitignore rename to tests/Functional/.gitignore diff --git a/tests/Application/config/serialization/.gitignore b/tests/Integration/.gitignore similarity index 100% rename from tests/Application/config/serialization/.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..edfef5f --- /dev/null +++ b/tests/TestApplication/config/bundles.php @@ -0,0 +1,6 @@ + ['all' => true], + Webgriffe\SyliusItalianInvoiceableOrderPlugin\WebgriffeSyliusItalianInvoiceableOrderPlugin::class => ['all' => true], +]; diff --git a/tests/TestApplication/config/config.yaml b/tests/TestApplication/config/config.yaml new file mode 100644 index 0000000..b0ba11c --- /dev/null +++ b/tests/TestApplication/config/config.yaml @@ -0,0 +1,36 @@ +imports: + - { resource: "@WebgriffeSyliusItalianInvoiceableOrderPlugin/config/config.yaml" } + - { resource: "services_test.php" } + +twig: + paths: + '%kernel.project_dir%/../../../tests/TestApplication/templates': ~ + +framework: + validation: + mapping: + paths: + - '%kernel.project_dir%/../../../tests/TestApplication/config/validation/' + +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/Application/src/Entity/.gitignore b/tests/TestApplication/config/routes.yaml similarity index 100% rename from tests/Application/src/Entity/.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..43f52f5 --- /dev/null +++ b/tests/TestApplication/config/services_test.php @@ -0,0 +1,12 @@ +env(), 'test')) { + $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/validation/Address.xml similarity index 99% rename from tests/Application/config/validator/Address.xml rename to tests/TestApplication/config/validation/Address.xml index 6048b0e..a3a48f2 100644 --- a/tests/Application/config/validator/Address.xml +++ b/tests/TestApplication/config/validation/Address.xml @@ -1,6 +1,6 @@ - + diff --git a/tests/Application/config/validator/Order.xml b/tests/TestApplication/config/validation/Order.xml similarity index 84% rename from tests/Application/config/validator/Order.xml rename to tests/TestApplication/config/validation/Order.xml index a5fa5bf..de41889 100644 --- a/tests/Application/config/validator/Order.xml +++ b/tests/TestApplication/config/validation/Order.xml @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ diff --git a/tests/Application/templates/.gitignore b/tests/TestApplication/src/Entity/.gitignore similarity index 100% rename from tests/Application/templates/.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 79% rename from tests/Application/src/Entity/Addressing/Address.php rename to tests/TestApplication/src/Entity/Addressing/Address.php index 079f7a3..9bf3df0 100644 --- a/tests/Application/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/Application/src/Entity/Order/Order.php b/tests/TestApplication/src/Entity/Order/Order.php similarity index 76% rename from tests/Application/src/Entity/Order/Order.php rename to tests/TestApplication/src/Entity/Order/Order.php index dbfde59..7ff7abb 100644 --- a/tests/Application/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; diff --git a/tests/Application/translations/.gitignore b/tests/TestApplication/templates/.gitignore similarity index 100% rename from tests/Application/translations/.gitignore rename to tests/TestApplication/templates/.gitignore 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/Unit/.gitignore b/tests/Unit/.gitignore new file mode 100644 index 0000000..e69de29 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