From 8bc9e24436028c63c65de3b474969fcd5a9f309d Mon Sep 17 00:00:00 2001 From: Hubert Filar Date: Mon, 3 Feb 2025 15:04:31 +0100 Subject: [PATCH 1/3] [Maintenance] Add Docker support --- .docker/fpm.conf | 21 ++++++++++++ .docker/nginx.conf | 48 ++++++++++++++++++++++++++ .docker/nginx/nginx.conf | 48 ++++++++++++++++++++++++++ .docker/php/php-cli.ini | 15 ++++++++ .docker/php/php-fpm.ini | 24 +++++++++++++ .docker/supervisord.conf | 14 ++++++++ Dockerfile | 74 ++++++++++++++++++++++++++++++++++++++++ Makefile | 36 +++++++++++++++++++ docker-compose.yml | 63 ++++++++++++++++++++++++++++++++++ 9 files changed, 343 insertions(+) create mode 100644 .docker/fpm.conf create mode 100644 .docker/nginx.conf create mode 100644 .docker/nginx/nginx.conf create mode 100644 .docker/php/php-cli.ini create mode 100644 .docker/php/php-fpm.ini create mode 100644 .docker/supervisord.conf create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 docker-compose.yml diff --git a/.docker/fpm.conf b/.docker/fpm.conf new file mode 100644 index 00000000..4f0c372e --- /dev/null +++ b/.docker/fpm.conf @@ -0,0 +1,21 @@ +[www] +user = www-data +group = www-data + +listen = /var/run/php-www.sock +listen.owner = www-data +listen.group = www-data +listen.mode = 0660 + +clear_env = no + +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 + +pm.status_path = /status +catch_workers_output = yes + +security.limit_extensions = .php diff --git a/.docker/nginx.conf b/.docker/nginx.conf new file mode 100644 index 00000000..7fa27004 --- /dev/null +++ b/.docker/nginx.conf @@ -0,0 +1,48 @@ +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/php-www.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/nginx/nginx.conf b/.docker/nginx/nginx.conf new file mode 100644 index 00000000..6bfbd29d --- /dev/null +++ b/.docker/nginx/nginx.conf @@ -0,0 +1,48 @@ +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-cli.ini b/.docker/php/php-cli.ini new file mode 100644 index 00000000..807ec2f2 --- /dev/null +++ b/.docker/php/php-cli.ini @@ -0,0 +1,15 @@ +[PHP] +memory_limit=1024M + +[date] +date.timezone=${PHP_DATE_TIMEZONE} + +[opcache] +opcache.enable=0 +opcache.memory_consumption=256 +opcache.max_accelerated_files=20000 +opcache.validate_timestamps=0 +;opcache.preload=/app/config/preload.php +opcache.preload_user=www-data +opcache.jit=1255 +opcache.jit_buffer_size=256M diff --git a/.docker/php/php-fpm.ini b/.docker/php/php-fpm.ini new file mode 100644 index 00000000..0733ff5a --- /dev/null +++ b/.docker/php/php-fpm.ini @@ -0,0 +1,24 @@ +[PHP] +memory_limit=-1 + +[date] +date.timezone=${PHP_DATE_TIMEZONE} + +[opcache] +zend_extension=opcache.so +opcache.enable=0 +opcache.memory_consumption=256 +opcache.max_accelerated_files=20000 +opcache.validate_timestamps=0 +;opcache.preload=/app/config/preload.php +opcache.preload_user=www-data +opcache.jit=1255 +opcache.jit_buffer_size=256M + +[xdebug] +zend_extension=xdebug +xdebug.mode=${XDEBUG_MODE} +xdebug.client_host=host.docker.internal +xdebug.start_with_request=trigger +xdebug.client_port=9003 +xdebug.discover_client_host=1 diff --git a/.docker/supervisord.conf b/.docker/supervisord.conf new file mode 100644 index 00000000..913adb67 --- /dev/null +++ b/.docker/supervisord.conf @@ -0,0 +1,14 @@ +[supervisord] +nodaemon = true +user = root +pidfile = /run/supervisord.pid + +[program:nginx] +command = /usr/sbin/nginx +user = root +autostart = true + +[program:php-fpm] +command = /usr/sbin/php-fpm -F +user = root +autostart = true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..042eb3dc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,74 @@ +FROM ubuntu:20.04 +ARG DEBIAN_FRONTEND=noninteractive +ARG PHP_VERSION=8.2 +ENV LC_ALL=C.UTF-8 + +# Install basic tools +RUN apt-get update && apt-get install -y \ + software-properties-common \ + curl \ + make \ + supervisor \ + unzip \ + python2 \ + g++ + +# Append NODE, NGINX and PHP repositories +RUN add-apt-repository ppa:ondrej/php \ + && add-apt-repository ppa:ondrej/nginx \ + && curl -sL https://deb.nodesource.com/setup_14.x | bash - + +# Install required PHP extensions +RUN apt-get update && apt-get install -y \ + nodejs \ + nginx \ + php${PHP_VERSION} \ + php${PHP_VERSION}-apcu \ + php${PHP_VERSION}-calendar \ + php${PHP_VERSION}-common \ + php${PHP_VERSION}-cli \ + php${PHP_VERSION}-ctype \ + php${PHP_VERSION}-curl \ + php${PHP_VERSION}-dom \ + php${PHP_VERSION}-exif \ + php${PHP_VERSION}-fpm \ + php${PHP_VERSION}-gd \ + php${PHP_VERSION}-intl \ + php${PHP_VERSION}-mbstring \ + php${PHP_VERSION}-mysql \ + php${PHP_VERSION}-opcache \ + php${PHP_VERSION}-pdo \ + php${PHP_VERSION}-pgsql \ + php${PHP_VERSION}-sqlite \ + php${PHP_VERSION}-xdebug \ + php${PHP_VERSION}-xml \ + php${PHP_VERSION}-xsl \ + php${PHP_VERSION}-yaml \ + php${PHP_VERSION}-zip + +# Install Composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename composer + +# Cleanup +RUN apt-get remove --purge -y software-properties-common curl && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* /usr/share/man/* + +# Create directory for php-fpm socket +# Link php-fpm binary file without version +# -p Creates missing intermediate path name directories +RUN ln -s /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm && mkdir -p /run/php + +# Install yarn +RUN npm install -g yarn && npm cache clean --force + +# Initialize config files +COPY .docker/supervisord.conf /etc/supervisor/conf.d/supervisor.conf +COPY .docker/nginx.conf /etc/nginx/nginx.conf +COPY .docker/fpm.conf /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf +COPY .docker/php/php-fpm.ini /etc/php/${PHP_VERSION}/fpm/php.ini +COPY .docker/php/php-cli.ini /etc/php/${PHP_VERSION}/cli/php.ini + +WORKDIR /app + +EXPOSE 80 + +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..d8d14abe --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +phpunit: + vendor/bin/phpunit + +phpspec: + vendor/bin/phpspec run --ansi --no-interaction -f dot + +phpstan: + vendor/bin/phpstan analyse + +psalm: + vendor/bin/psalm + +behat-js: + APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress + +install: + composer install --no-interaction --no-scripts + +backend: + tests/Application/bin/console sylius:install --no-interaction + tests/Application/bin/console sylius:fixtures:load default --no-interaction + +frontend: + (cd tests/Application && yarn install --pure-lockfile) + (cd tests/Application && bin/console assets:install public) + +behat: + APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress + +init: install backend frontend + +ci: init phpstan psalm phpunit phpspec behat + +integration: init phpunit behat + +static: install phpspec phpstan psalm diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..9dad0dd1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,63 @@ +services: + app: + container_name: app + build: + context: . + 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" + MAILER_DSN: "smtp://mailhog:1025" + # to enable step debugging, build with e.g. XDEBUG_MODE=debug, or set the below to "debug" + XDEBUG_MODE: ${XDEBUG_MODE:-off} + # to use xdebug, create a server named PHPSTORM in Settings > PHP > Servers + PHP_IDE_CONFIG: "serverName=PHPSTORM" + volumes: + - ./:/app:delegated + - ./.docker/php.ini:/etc/php8/php.ini:delegated + - ./.docker/nginx.conf:/etc/nginx/nginx.conf:delegated + ports: + - "80:80" + depends_on: + - mysql + networks: + - sylius + + mysql: + container_name: 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 + + mailhog: + container_name: mailhog + # do not use in production! + image: mailhog/mailhog:latest + environment: + - MH_STORAGE=maildir + # volumes: + # - ./docker/mailhog/maildir:/maildir:rw,delegated + ports: + - "${MAILHOG_PORT:-8025}:8025" + networks: + - sylius + +networks: + sylius: + driver: bridge From 156c38bfabbd9ec52835b62a3847548e2a008174 Mon Sep 17 00:00:00 2001 From: Hubert Filar Date: Mon, 3 Feb 2025 15:13:47 +0100 Subject: [PATCH 2/3] [Maintenance] Support Sylius 1.14 --- .github/workflows/build.yml | 16 ++- .github/workflows/coding_standard.yml | 2 +- composer.json | 2 +- doc/05-testing.md | 7 +- .../BitBagSyliusWishlistExtension.php | 1 + tests/Application/.babelrc | 15 --- tests/Application/Kernel.php | 8 -- tests/Application/composer.json | 2 +- tests/Application/config/bundles.php | 3 + .../Application/config/packages/_sylius.yaml | 6 + .../{sylius/1.13 => }/packages/security.yaml | 0 .../config/sylius/1.12/bundles.php | 6 - .../sylius/1.12/packages/jms_serializer.yaml | 4 - .../config/sylius/1.12/packages/security.yaml | 124 ------------------ .../config/sylius/1.13/bundles.php | 7 - .../config/sylius/1.13/packages/_sylius.yaml | 7 - tests/Application/package.json | 44 ++----- .../test_admin_can_get_wishlists.json | 4 + ...test_user_can_add_product_to_wishlist.json | 1 + ...r_can_add_product_variant_to_wishlist.json | 1 + .../test_user_can_create_wishlist.json | 1 + .../test_user_can_get_wishlist_items.json | 1 + 22 files changed, 41 insertions(+), 221 deletions(-) delete mode 100755 tests/Application/.babelrc rename tests/Application/config/{sylius/1.13 => }/packages/security.yaml (100%) delete mode 100644 tests/Application/config/sylius/1.12/bundles.php delete mode 100644 tests/Application/config/sylius/1.12/packages/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.12/packages/security.yaml delete mode 100644 tests/Application/config/sylius/1.13/bundles.php delete mode 100644 tests/Application/config/sylius/1.13/packages/_sylius.yaml rename tests/Functional/Responses/Expected/Api/WishlistTest/{1.12 => 1.14}/test_admin_can_get_wishlists.json (88%) rename tests/Functional/Responses/Expected/Api/WishlistTest/{1.12 => 1.14}/test_user_can_add_product_to_wishlist.json (92%) rename tests/Functional/Responses/Expected/Api/WishlistTest/{1.12 => 1.14}/test_user_can_add_product_variant_to_wishlist.json (92%) rename tests/Functional/Responses/Expected/Api/WishlistTest/{1.12 => 1.14}/test_user_can_create_wishlist.json (84%) rename tests/Functional/Responses/Expected/Api/WishlistTest/{1.12 => 1.14}/test_user_can_get_wishlist_items.json (93%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index edf61502..1ed49186 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,18 +17,24 @@ jobs: runs-on: ubuntu-latest name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, - MySQL ${{ matrix.mysql }}, State Machine Adapter ${{ matrix.state_machine_adapter }}" + MySQL ${{ matrix.mysql }}, State Machine Adapter ${{ matrix.state_machine_adapter }}, Node ${{ matrix.node }}" strategy: fail-fast: false matrix: php: [ "8.1", "8.2", "8.3" ] symfony: ["^5.4", "^6.4"] - sylius: [ "^1.12", "^1.13" ] + sylius: [ "~1.13.0", "~1.14.0" ] node: [ "18.x", "20.x" ] mysql: ["8.0"] state_machine_adapter: ["winzou_state_machine", "symfony_workflow"] + exclude: + - + php: "8.3" + symfony: "^5.4" + sylius: "~1.13.0" + env: APP_ENV: test DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" @@ -146,7 +152,7 @@ jobs: name: Prepare test application assets run: | (cd tests/Application && bin/console assets:install public -vvv) - (cd tests/Application && yarn prod) + (cd tests/Application && yarn build) - name: Prepare test application cache @@ -178,7 +184,7 @@ jobs: - name: Upload Behat logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: Behat logs @@ -187,7 +193,7 @@ jobs: - name: Upload test log logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: Var logs diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index 8f49a540..ac6ee615 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -20,7 +20,7 @@ jobs: matrix: php: [ "8.1", "8.2", "8.3" ] symfony: [ "^5.4", "^6.4" ] - sylius: [ "^1.12", "^1.13" ] + sylius: [ "^1.13", "^1.14" ] node: [ "18.x", "20.x" ] steps: diff --git a/composer.json b/composer.json index 50a3a683..c74346bc 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "require": { "php": "^8.1", - "sylius/sylius": "^1.12 || ^1.13", + "sylius/sylius": "^1.13 || ^1.14", "symfony/webpack-encore-bundle": "^1.15", "dompdf/dompdf": "^2.0" }, diff --git a/doc/05-testing.md b/doc/05-testing.md index cb22c7ad..5c8f6403 100644 --- a/doc/05-testing.md +++ b/doc/05-testing.md @@ -9,11 +9,6 @@ $ composer install $ cd tests/Application ``` -Copy `package.json.~1.xx.dist` file to `package.json` for specific version of Sylius (example for 1.12.0): -```bash -$ cp package.json.\~1.12.dist package.json -``` - Then: ```bash @@ -26,4 +21,4 @@ $ APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public - $ open https://localhost:8080 $ vendor/bin/behat $ vendor/bin/phpspec run -``` \ No newline at end of file +``` diff --git a/src/DependencyInjection/BitBagSyliusWishlistExtension.php b/src/DependencyInjection/BitBagSyliusWishlistExtension.php index 83bfe530..d662106e 100644 --- a/src/DependencyInjection/BitBagSyliusWishlistExtension.php +++ b/src/DependencyInjection/BitBagSyliusWishlistExtension.php @@ -13,6 +13,7 @@ use Sylius\Bundle\CoreBundle\DependencyInjection\PrependDoctrineMigrationsTrait; use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension; +use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; diff --git a/tests/Application/.babelrc b/tests/Application/.babelrc deleted file mode 100755 index e563a62e..00000000 --- a/tests/Application/.babelrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - ["env", { - "targets": { - "node": "6" - }, - "useBuiltIns": true - }] - ], - "plugins": [ - ["transform-object-rest-spread", { - "useBuiltIns": true - }] - ] -} diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index 1e1ef827..10e4b4a8 100755 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -138,13 +138,5 @@ private function registerBundlesFromFile(string $bundlesFile): iterable 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/composer.json b/tests/Application/composer.json index 326735f5..ecaabfd1 100755 --- a/tests/Application/composer.json +++ b/tests/Application/composer.json @@ -1,5 +1,5 @@ { - "name": "sylius/plugin-skeleton-test-application", + "name": "bitbag/wishlist-plugin-test-application", "description": "Sylius application for plugin testing purposes (composer.json needed for project dir resolving)", "license": "MIT" } diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index b0f13b83..5368176a 100755 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -60,4 +60,7 @@ Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], League\FlysystemBundle\FlysystemBundle::class => ['all' => true], Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], + BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], + SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], + Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/packages/_sylius.yaml b/tests/Application/config/packages/_sylius.yaml index 163bc476..c011bee6 100755 --- a/tests/Application/config/packages/_sylius.yaml +++ b/tests/Application/config/packages/_sylius.yaml @@ -9,7 +9,13 @@ sylius_api: parameters: sylius_core.public_dir: '%kernel.project_dir%/public' + test_default_state_machine_adapter: 'symfony_workflow' + test_sylius_state_machine_adapter: '%env(string:default:test_default_state_machine_adapter:TEST_SYLIUS_STATE_MACHINE_ADAPTER)%' sylius_shop: product_grid: include_all_descendants: true + +sylius_state_machine_abstraction: + graphs_to_adapters_mapping: + sylius_refund_refund_payment: '%test_sylius_state_machine_adapter%' diff --git a/tests/Application/config/sylius/1.13/packages/security.yaml b/tests/Application/config/packages/security.yaml similarity index 100% rename from tests/Application/config/sylius/1.13/packages/security.yaml rename to tests/Application/config/packages/security.yaml diff --git a/tests/Application/config/sylius/1.12/bundles.php b/tests/Application/config/sylius/1.12/bundles.php deleted file mode 100644 index bd33f4ae..00000000 --- a/tests/Application/config/sylius/1.12/bundles.php +++ /dev/null @@ -1,6 +0,0 @@ - ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.12/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.12/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc613..00000000 --- a/tests/Application/config/sylius/1.12/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/sylius/1.12/packages/security.yaml b/tests/Application/config/sylius/1.12/packages/security.yaml deleted file mode 100644 index 4ed342f8..00000000 --- a/tests/Application/config/sylius/1.12/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/sylius/1.13/bundles.php b/tests/Application/config/sylius/1.13/bundles.php deleted file mode 100644 index b0560bca..00000000 --- a/tests/Application/config/sylius/1.13/bundles.php +++ /dev/null @@ -1,7 +0,0 @@ - ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.13/packages/_sylius.yaml b/tests/Application/config/sylius/1.13/packages/_sylius.yaml deleted file mode 100644 index 76aa43aa..00000000 --- a/tests/Application/config/sylius/1.13/packages/_sylius.yaml +++ /dev/null @@ -1,7 +0,0 @@ -parameters: - test_default_state_machine_adapter: 'symfony_workflow' - test_sylius_state_machine_adapter: '%env(string:default:test_default_state_machine_adapter:TEST_SYLIUS_STATE_MACHINE_ADAPTER)%' - -sylius_state_machine_abstraction: - graphs_to_adapters_mapping: - sylius_refund_refund_payment: '%test_sylius_state_machine_adapter%' diff --git a/tests/Application/package.json b/tests/Application/package.json index 36e6c1f0..dfe32583 100755 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -1,41 +1,13 @@ { - "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": { - "@symfony/webpack-encore": "^1.6.1", - "babel-core": "^6.26.3", - "babel-plugin-external-helpers": "^6.22.0", - "babel-plugin-module-resolver": "^3.1.1", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-preset-env": "^1.7.0", - "babel-register": "^6.26.0", - "dedent": "^0.7.0", - "eslint": "^4.19.1", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-import-resolver-babel-module": "^4.0.0", - "eslint-plugin-import": "^2.11.0", - "merge-stream": "^1.0.0", - "sass": "^1.39.2", - "sass-loader": "^12.1.0" - }, + "license": "MIT", "scripts": { - "dev": "yarn encore dev", - "watch": "yarn encore dev --watch", - "prod": "yarn encore prod", + "build": "encore dev", + "build:prod": "encore production", + "postinstall": "semantic-ui-css-patch", "lint": "yarn lint:js", - "lint:js": "eslint gulpfile.babel.js" + "watch": "encore dev --watch" }, - "repository": { - "type": "git", - "url": "git+https://github.com/Sylius/Sylius.git" - }, - "author": "Paweł Jędrzejewski", - "license": "MIT" + "devDependencies": { + "@sylius-ui/frontend": "^1.0" + } } diff --git a/tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_admin_can_get_wishlists.json b/tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_admin_can_get_wishlists.json similarity index 88% rename from tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_admin_can_get_wishlists.json rename to tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_admin_can_get_wishlists.json index 303b0c98..1aba5098 100644 --- a/tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_admin_can_get_wishlists.json +++ b/tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_admin_can_get_wishlists.json @@ -24,6 +24,7 @@ } ], "shopUser":{ + "@id": "\/api\/v2\/admin\/shop-users\/@integer@", "@type":"ShopUser", "id":"@integer@", "email":"@string@" @@ -36,6 +37,7 @@ "id":"@integer@", "wishlistProducts":"@array@", "shopUser":{ + "@id": "\/api\/v2\/admin\/shop-users\/@integer@", "@type":"ShopUser", "id":"@integer@", "email":"@string@" @@ -50,6 +52,7 @@ ], "shopUser":{ + "@id": "\/api\/v2\/admin\/shop-users\/@integer@", "@type":"ShopUser", "id":"@integer@", "email":"@string@" @@ -62,6 +65,7 @@ "id":"@integer@", "wishlistProducts":"@array@", "shopUser":{ + "@id": "\/api\/v2\/admin\/shop-users\/@integer@", "@type":"ShopUser", "id":"@integer@", "email":"@string@" diff --git a/tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_add_product_to_wishlist.json b/tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_add_product_to_wishlist.json similarity index 92% rename from tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_add_product_to_wishlist.json rename to tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_add_product_to_wishlist.json index db64b25b..8fc09f02 100644 --- a/tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_add_product_to_wishlist.json +++ b/tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_add_product_to_wishlist.json @@ -21,6 +21,7 @@ } ], "shopUser":{ + "@id": "\/api\/v2\/shop\/shop-users\/@integer@", "@type":"ShopUser", "id":"@integer@", "email":"@string@" diff --git a/tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_add_product_variant_to_wishlist.json b/tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_add_product_variant_to_wishlist.json similarity index 92% rename from tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_add_product_variant_to_wishlist.json rename to tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_add_product_variant_to_wishlist.json index db64b25b..8fc09f02 100644 --- a/tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_add_product_variant_to_wishlist.json +++ b/tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_add_product_variant_to_wishlist.json @@ -21,6 +21,7 @@ } ], "shopUser":{ + "@id": "\/api\/v2\/shop\/shop-users\/@integer@", "@type":"ShopUser", "id":"@integer@", "email":"@string@" diff --git a/tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_create_wishlist.json b/tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_create_wishlist.json similarity index 84% rename from tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_create_wishlist.json rename to tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_create_wishlist.json index 9ec800c2..f5d0402a 100644 --- a/tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_create_wishlist.json +++ b/tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_create_wishlist.json @@ -5,6 +5,7 @@ "id":"@integer@", "wishlistProducts":"@array@", "shopUser": { + "@id": "\/api\/v2\/shop\/shop-users\/@integer@", "@type": "ShopUser", "id":"@integer@", "email": "@string@" diff --git a/tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_get_wishlist_items.json b/tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_get_wishlist_items.json similarity index 93% rename from tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_get_wishlist_items.json rename to tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_get_wishlist_items.json index 40238f4a..bcfb6f97 100644 --- a/tests/Functional/Responses/Expected/Api/WishlistTest/1.12/test_user_can_get_wishlist_items.json +++ b/tests/Functional/Responses/Expected/Api/WishlistTest/1.14/test_user_can_get_wishlist_items.json @@ -25,6 +25,7 @@ } ], "shopUser":{ + "@id": "\/api\/v2\/shop\/shop-users\/@integer@", "@type":"ShopUser", "id":"@integer@", "email":"@string@" From 7b971757e21e17aff8788dd58abf79d70bdf4dfb Mon Sep 17 00:00:00 2001 From: Hubert Filar Date: Mon, 10 Feb 2025 13:41:58 +0100 Subject: [PATCH 3/3] [OP-566] Remove composer conflicts --- composer.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/composer.json b/composer.json index c74346bc..585bb76e 100644 --- a/composer.json +++ b/composer.json @@ -38,14 +38,6 @@ "lchrusciel/api-test-case": "^4.1 || ^5.0", "nelmio/alice": "^3.10" }, - "conflict": { - "symfony/symfony": "4.1.8", - "symfony/browser-kit": "4.1.8", - "symfony/dom-crawler": "4.1.8", - "symfony/routing": "4.1.8", - "symfony/doctrine-bridge": "4.4.16", - "symfony/validator": "^6.4.7" - }, "prefer-stable": true, "autoload": { "psr-4": {