From 91475d631f3f53ad0dd6f9708e9c8d6bdbba8f5b Mon Sep 17 00:00:00 2001 From: Piotr Lewandowski Date: Tue, 4 Apr 2023 17:58:05 +0200 Subject: [PATCH 1/7] #10 Initial upgrade to v1.12.x --- .docker/nginx/nginx.conf | 48 +++++++++++ .docker/php/php.ini | 5 ++ .editorconfig | 82 ++++++++++++++++++ .gitignore | 26 ++++++ Makefile | 39 +++++++++ README.md | 6 +- azure-pipelines.yml | 29 ------- bin/console | 17 ++++ composer.json | 54 +++++++----- easy-coding-standard.yml | 2 - ecs.php | 15 ++++ node_modules | 1 + phpcs.xml.dist | 19 ++++ phpspec.yml.dist | 4 +- phpstan.neon | 4 + phpunit.xml.dist | 5 ++ src/Controller/.gitignore | 0 src/Entity/.gitignore | 0 src/Kernel.php | 11 +++ src/Repository/.gitignore | 0 tests/Application/.env | 18 ++-- tests/Application/.env.test | 4 +- tests/Application/.gitignore | 1 + tests/Application/Kernel.php | 54 ++---------- tests/Application/assets/admin/entry.js | 1 + tests/Application/assets/shop/entry.js | 1 + tests/Application/bin/console | 2 +- .../config/api_platform/.gitignore | 0 tests/Application/config/bootstrap.php | 4 + tests/Application/config/bundles.php | 8 +- .../Application/config/packages/_sylius.yaml | 3 + .../config/packages/api_platform.yaml | 10 +++ tests/Application/config/packages/assets.yaml | 7 ++ .../packages/dev/jms_serializer.yaml | 0 .../Application/config/packages/fos_rest.yaml | 2 +- .../config/packages/framework.yaml | 3 + .../1.10 => }/packages/jms_serializer.yaml | 0 tests/Application/config/packages/mailer.yaml | 3 + .../packages/prod/jms_serializer.yaml | 0 .../{sylius/1.10 => }/packages/security.yaml | 86 +++++++------------ .../config/packages/test/framework.yaml | 2 +- .../config/packages/test/mailer.yaml | 5 ++ .../config/packages/test/security.yaml | 7 +- .../packages/test_cached/framework.yaml | 6 +- .../config/packages/test_cached/mailer.yaml | 2 + .../config/packages/test_cached/security.yaml | 5 +- .../config/packages/webpack_encore.yaml | 5 ++ .../config/serialization/.gitignore | 0 .../config/sylius/1.10/bundles.php | 6 -- .../Application/config/sylius/1.8/bundles.php | 6 -- .../1.8/packages/dev/jms_serializer.yaml | 7 -- .../config/sylius/1.8/packages/framework.yaml | 2 - .../sylius/1.8/packages/jms_serializer.yaml | 4 - .../1.8/packages/prod/jms_serializer.yaml | 6 -- .../config/sylius/1.8/routes/dev/twig.yaml | 3 - .../Application/config/sylius/1.9/bundles.php | 6 -- .../1.9/packages/dev/jms_serializer.yaml | 12 --- .../sylius/1.9/packages/jms_serializer.yaml | 4 - .../1.9/packages/prod/jms_serializer.yaml | 10 --- tests/Application/package.json | 84 ++++++++++-------- tests/Application/public/index.php | 2 +- tests/Application/src/Entity/.gitignore | 0 .../SyliusAdminBundle/Layout/_logo.html.twig | 5 ++ .../Security/_content.html.twig | 6 ++ .../SyliusAdminBundle/_scripts.html.twig | 1 + .../SyliusAdminBundle/_styles.html.twig | 1 + .../Homepage/_banner.html.twig | 9 ++ .../Layout/Header/_logo.html.twig | 5 ++ .../SyliusShopBundle/_scripts.html.twig | 1 + .../SyliusShopBundle/_styles.html.twig | 1 + tests/Application/webpack.config.js | 36 ++++---- tests/bootstrap.php | 11 +++ 72 files changed, 530 insertions(+), 304 deletions(-) create mode 100644 .docker/nginx/nginx.conf create mode 100644 .docker/php/php.ini create mode 100644 .editorconfig create mode 100644 Makefile delete mode 100644 azure-pipelines.yml create mode 100755 bin/console delete mode 100644 easy-coding-standard.yml create mode 100644 ecs.php create mode 120000 node_modules create mode 100644 phpcs.xml.dist create mode 100644 src/Controller/.gitignore create mode 100644 src/Entity/.gitignore create mode 100644 src/Kernel.php create mode 100644 src/Repository/.gitignore create mode 100644 tests/Application/assets/admin/entry.js create mode 100644 tests/Application/assets/shop/entry.js create mode 100644 tests/Application/config/api_platform/.gitignore create mode 100644 tests/Application/config/packages/api_platform.yaml create mode 100644 tests/Application/config/packages/assets.yaml rename tests/Application/config/{sylius/1.10 => }/packages/dev/jms_serializer.yaml (100%) rename tests/Application/config/{sylius/1.10 => }/packages/jms_serializer.yaml (100%) create mode 100644 tests/Application/config/packages/mailer.yaml rename tests/Application/config/{sylius/1.10 => }/packages/prod/jms_serializer.yaml (100%) rename tests/Application/config/{sylius/1.10 => }/packages/security.yaml (58%) create mode 100644 tests/Application/config/packages/test/mailer.yaml create mode 100644 tests/Application/config/packages/test_cached/mailer.yaml create mode 100644 tests/Application/config/packages/webpack_encore.yaml create mode 100644 tests/Application/config/serialization/.gitignore delete mode 100644 tests/Application/config/sylius/1.10/bundles.php delete mode 100644 tests/Application/config/sylius/1.8/bundles.php delete mode 100644 tests/Application/config/sylius/1.8/packages/dev/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.8/packages/framework.yaml delete mode 100644 tests/Application/config/sylius/1.8/packages/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.8/packages/prod/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.8/routes/dev/twig.yaml delete mode 100644 tests/Application/config/sylius/1.9/bundles.php delete mode 100644 tests/Application/config/sylius/1.9/packages/dev/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.9/packages/jms_serializer.yaml delete mode 100644 tests/Application/config/sylius/1.9/packages/prod/jms_serializer.yaml create mode 100644 tests/Application/src/Entity/.gitignore create mode 100644 tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig create mode 100644 tests/Application/templates/bundles/SyliusAdminBundle/Security/_content.html.twig create mode 100644 tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig create mode 100644 tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig create mode 100644 tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig create mode 100644 tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig create mode 100644 tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig create mode 100644 tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig create mode 100644 tests/bootstrap.php diff --git a/.docker/nginx/nginx.conf b/.docker/nginx/nginx.conf new file mode 100644 index 0000000..6bfbd29 --- /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.ini b/.docker/php/php.ini new file mode 100644 index 0000000..13f0abe --- /dev/null +++ b/.docker/php/php.ini @@ -0,0 +1,5 @@ +[PHP] +memory_limit=512M + +[date] +date.timezone=${PHP_DATE_TIMEZONE} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b5f72a5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,82 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + +[*] +# Change these settings to your own preference +indent_style = space +indent_size = 4 + +# We recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.feature] +indent_style = space +indent_size = 4 + +[*.js] +indent_style = space +indent_size = 2 + +[*.json] +indent_style = space +indent_size = 2 + +[*.md] +indent_style = space +indent_size = 4 +trim_trailing_whitespace = false + +[*.neon] +indent_style = space +indent_size = 4 + +[*.php] +indent_style = space +indent_size = 4 + +[*.sh] +indent_style = space +indent_size = 4 + +[*.{yaml,yml}] +indent_style = space +indent_size = 4 +trim_trailing_whitespace = false + +[.babelrc] +indent_style = space +indent_size = 2 + +[.gitmodules] +indent_style = tab +indent_size = 4 + +[.php_cs{,.dist}] +indent_style = space +indent_size = 4 + +[composer.json] +indent_style = space +indent_size = 4 + +[package.json] +indent_style = space +indent_size = 2 + +[phpspec.yml{,.dist}] +indent_style = space +indent_size = 4 + +[phpstan.neon] +indent_style = space +indent_size = 4 + +[phpunit.xml{,.dist}] +indent_style = space +indent_size = 4 diff --git a/.gitignore b/.gitignore index f4a283c..a7fce63 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,29 @@ /behat.yml /phpspec.yml /phpunit.xml + +###> symfony/framework-bundle ### +/.env.local +/.env.local.php +/.env.*.local +/config/secrets/prod/prod.decrypt.private.php +/public/bundles/ +/var/ +/vendor/ +###< symfony/framework-bundle ### + +###> phpunit/phpunit ### +/phpunit.xml +.phpunit.result.cache +###< phpunit/phpunit ### + +###> symfony/webpack-encore-bundle ### +/node_modules/ +/public/build/ +npm-debug.log +yarn-error.log +###< symfony/webpack-encore-bundle ### + +###> lexik/jwt-authentication-bundle ### +/config/jwt/*.pem +###< lexik/jwt-authentication-bundle ### diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f752d31 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +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 && GULP_ENV=prod yarn build) + +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 + +serve: + (cd tests/Application && APP_ENV=dev symfony serve) diff --git a/README.md b/README.md index 410476c..3f627ef 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ ## Requirements | | Version | -| :--- | :--- | -| PHP | 7.4 | 8.0 | -| Sylius | 1.9, 1.10 | +| :--- |:--------| +| PHP | ^8.0 | +| Sylius | ^1.12 | For Sylius 1.8 support check [Sylius Size Chart Plugin v1.0.x](https://github.com/mad-coders/sylius-sizechart-plugin/tree/1.0). diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index fd2dae2..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,29 +0,0 @@ -# PHP -# Test and package your PHP project. -# Add steps that run tests, save build artifacts, deploy, and more: -# https://docs.microsoft.com/azure/devops/pipelines/languages/php - -trigger: -- master - -pool: - vmImage: ubuntu-latest - -variables: - phpVersion: 7.4 - -steps: -- script: | - sudo update-alternatives --set php /usr/bin/php$(phpVersion) - sudo update-alternatives --set phar /usr/bin/phar$(phpVersion) - sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion) - sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion) - sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion) - php -version - displayName: 'Use PHP version $(phpVersion)' - -- script: composer install --no-interaction --prefer-dist - displayName: 'composer install' - -- script: php vendor/bin/phpunit -c phpunit.xml.dist - displayName: 'unit tests' diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..c933dc5 --- /dev/null +++ b/bin/console @@ -0,0 +1,17 @@ +#!/usr/bin/env php +2.0.0-alpha.0 ^2.0@dev", - "phpspec/phpspec": "^7.0", - "phpspec/prophecy-phpunit": "^2.0", + "phpspec/phpspec": "^7.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "0.12.85", - "phpstan/phpstan-doctrine": "0.12.33", - "phpstan/phpstan-strict-rules": "^0.12.0", - "phpstan/phpstan-webmozart-assert": "0.12.12", + "phpstan/phpstan": "^1.8.1", + "phpstan/phpstan-doctrine": "1.3.16", + "phpstan/phpstan-strict-rules": "^1.3.0", + "phpstan/phpstan-webmozart-assert": "^1.2.0", "phpunit/phpunit": "^9.5", - "sensiolabs/security-checker": "^6.0", - "sylius-labs/coding-standard": "^4.0", - "symfony/browser-kit": "^4.4 || ^5.2", - "symfony/debug-bundle": "^4.4 || ^5.2", - "symfony/dotenv": "^4.4 || ^5.2", - "symfony/intl": "^4.4 || ^5.2", - "symfony/web-profiler-bundle": "^4.4 || ^5.2", - "vimeo/psalm": "4.7.1" + "polishsymfonycommunity/symfony-mocker-container": "^1.0", + "sylius-labs/coding-standard": "^4.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.0" }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": false, + "phpstan/extension-installer": true, + "symfony/flex": true, + "symfony/thanks": true + } }, "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } }, "autoload": { "psr-4": { @@ -88,6 +91,11 @@ ], "post-create-project-cmd": [ "php bin/create_node_symlink.php" - ] + ], + "auto-scripts": { + "cache:clear": "symfony-cmd", + "assets:install %PUBLIC_DIR%": "symfony-cmd", + "security-checker security:check": "script" + } } } diff --git a/easy-coding-standard.yml b/easy-coding-standard.yml deleted file mode 100644 index 2403599..0000000 --- a/easy-coding-standard.yml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: 'vendor/sylius-labs/coding-standard/easy-coding-standard.yml' } diff --git a/ecs.php b/ecs.php new file mode 100644 index 0000000..707f400 --- /dev/null +++ b/ecs.php @@ -0,0 +1,15 @@ +import('vendor/sylius-labs/coding-standard/ecs.php'); + + $ecsConfig->parameters()->set(Option::SKIP, [ + VisibilityRequiredFixer::class => ['*Spec.php'], + ]); +}; diff --git a/node_modules b/node_modules new file mode 120000 index 0000000..9270531 --- /dev/null +++ b/node_modules @@ -0,0 +1 @@ +tests/Application/node_modules \ No newline at end of file diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..89195e2 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,19 @@ + + + + + + + + + + + + bin/ + config/ + public/ + src/ + tests/ + + diff --git a/phpspec.yml.dist b/phpspec.yml.dist index 91d42b9..ae371ee 100644 --- a/phpspec.yml.dist +++ b/phpspec.yml.dist @@ -1,4 +1,4 @@ suites: main: - namespace: Madcoders\SyliusSizechartPlugin - psr4_prefix: Madcoders\SyliusSizechartPlugin + namespace: Acme\SyliusExamplePlugin + psr4_prefix: Acme\SyliusExamplePlugin diff --git a/phpstan.neon b/phpstan.neon index 2d625f6..2235744 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,10 @@ parameters: + level: max reportUnmatchedIgnoredErrors: false checkMissingIterableValueType: false + paths: + - src + - tests/Behat excludes_analyse: # Makes PHPStan crash diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1acccd4..a84e0eb 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -18,5 +18,10 @@ + + + + + diff --git a/src/Controller/.gitignore b/src/Controller/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/src/Entity/.gitignore b/src/Entity/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/src/Kernel.php b/src/Kernel.php new file mode 100644 index 0000000..779cd1f --- /dev/null +++ b/src/Kernel.php @@ -0,0 +1,11 @@ + lexik/jwt-authentication-bundle ### @@ -21,9 +21,13 @@ JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem JWT_PASSPHRASE=acme_plugin_development ###< lexik/jwt-authentication-bundle ### -###> symfony/swiftmailer-bundle ### -# For Gmail as a transport, use: "gmail://username:password@localhost" -# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" -# Delivery is disabled by default via "null://localhost" -MAILER_URL=smtp://localhost:1025 -###< symfony/swiftmailer-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 index e446333..c0ee239 100644 --- a/tests/Application/.env.test +++ b/tests/Application/.env.test @@ -1,3 +1,3 @@ APP_SECRET='ch4mb3r0f5ecr3ts' -KERNEL_CLASS='Tests\Madcoders\SyliusSizechartPlugin\Application\Kernel' -DATABASE_URL=mysql://root:test@127.0.0.1/scp_%kernel.environment%?serverVersion=5.7 + +KERNEL_CLASS='Tests\Acme\SyliusExamplePlugin\Application\Kernel' diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore index 8ad1225..bc600a8 100644 --- a/tests/Application/.gitignore +++ b/tests/Application/.gitignore @@ -1,4 +1,5 @@ /public/assets +/public/build /public/css /public/js /public/media/* diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index 2ac2768..0bedc86 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -2,28 +2,15 @@ declare(strict_types=1); -namespace Tests\Madcoders\SyliusSizechartPlugin\Application; +namespace Tests\Acme\SyliusExamplePlugin\Application; use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer; use Sylius\Bundle\CoreBundle\Application\Kernel as SyliusKernel; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Kernel as BaseKernel; -use Symfony\Component\Routing\RouteCollectionBuilder; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; -/** - * Sylius Sizechart Plugin - * - * @copyright MADCODERS Team (www.madcoders.co) - * @licence For the full copyright and license information, please view the LICENSE - * - * Architects of this package: - * @author Leonid Moshko - * @author Piotr Lewandowski - */ final class Kernel extends BaseKernel { use MicroKernelTrait; @@ -51,24 +38,7 @@ public function registerBundles(): iterable } } - protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void - { - foreach ($this->getConfigurationDirectories() as $confDir) { - $bundlesFile = $confDir . '/bundles.php'; - if (false === is_file($bundlesFile)) { - continue; - } - $container->addResource(new FileResource($bundlesFile)); - } - - $container->setParameter('container.dumper.inline_class_loader', true); - - foreach ($this->getConfigurationDirectories() as $confDir) { - $this->loadContainerConfiguration($loader, $confDir); - } - } - - protected function configureRoutes(RouteCollectionBuilder $routes): void + protected function configureRoutes(RoutingConfigurator $routes): void { foreach ($this->getConfigurationDirectories() as $confDir) { $this->loadRoutesConfiguration($routes, $confDir); @@ -77,7 +47,7 @@ protected function configureRoutes(RouteCollectionBuilder $routes): void protected function getContainerBaseClass(): string { - if ($this->isTestEnvironment()) { + if ($this->isTestEnvironment() && class_exists(MockerContainer::class)) { return MockerContainer::class; } @@ -89,19 +59,11 @@ private function isTestEnvironment(): bool return 0 === strpos($this->getEnvironment(), 'test'); } - private function loadContainerConfiguration(LoaderInterface $loader, string $confDir): void - { - $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob'); - $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob'); - $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob'); - $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); - } - - private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string $confDir): void + private function loadRoutesConfiguration(RoutingConfigurator $routes, string $confDir): void { - $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob'); + $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS); + $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS); + $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS); } /** diff --git a/tests/Application/assets/admin/entry.js b/tests/Application/assets/admin/entry.js new file mode 100644 index 0000000..635f5ac --- /dev/null +++ b/tests/Application/assets/admin/entry.js @@ -0,0 +1 @@ +import 'sylius/bundle/AdminBundle/Resources/private/entry'; diff --git a/tests/Application/assets/shop/entry.js b/tests/Application/assets/shop/entry.js new file mode 100644 index 0000000..aadc317 --- /dev/null +++ b/tests/Application/assets/shop/entry.js @@ -0,0 +1 @@ +import 'sylius/bundle/ShopBundle/Resources/private/entry'; diff --git a/tests/Application/bin/console b/tests/Application/bin/console index 4099875..f193fd2 100755 --- a/tests/Application/bin/console +++ b/tests/Application/bin/console @@ -1,7 +1,7 @@ #!/usr/bin/env php bootEnv(dirname(__DIR__) . '/.env'); + + return; } else { // load all the .env files (new Dotenv(true))->loadEnv(dirname(__DIR__) . '/.env'); diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index c8aad0f..50d4aee 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -4,7 +4,6 @@ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], - Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true], @@ -45,7 +44,7 @@ Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true], Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true], Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true], - Madcoders\SyliusSizechartPlugin\MadcodersSyliusSizechartPlugin::class => ['all' => true], + Madcoders\SyliusSizeChartPlugin\MadcodersSyliusSizechartPlugin::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], @@ -54,4 +53,9 @@ 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], ]; diff --git a/tests/Application/config/packages/_sylius.yaml b/tests/Application/config/packages/_sylius.yaml index 0be20f1..fd5e7fa 100644 --- a/tests/Application/config/packages/_sylius.yaml +++ b/tests/Application/config/packages/_sylius.yaml @@ -14,3 +14,6 @@ parameters: sylius_shop: product_grid: include_all_descendants: true + +sylius_api: + enabled: true diff --git a/tests/Application/config/packages/api_platform.yaml b/tests/Application/config/packages/api_platform.yaml new file mode 100644 index 0000000..b428304 --- /dev/null +++ b/tests/Application/config/packages/api_platform.yaml @@ -0,0 +1,10 @@ +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 new file mode 100644 index 0000000..2468901 --- /dev/null +++ b/tests/Application/config/packages/assets.yaml @@ -0,0 +1,7 @@ +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/sylius/1.10/packages/dev/jms_serializer.yaml b/tests/Application/config/packages/dev/jms_serializer.yaml similarity index 100% rename from tests/Application/config/sylius/1.10/packages/dev/jms_serializer.yaml rename to tests/Application/config/packages/dev/jms_serializer.yaml diff --git a/tests/Application/config/packages/fos_rest.yaml b/tests/Application/config/packages/fos_rest.yaml index a72eef7..eaebb27 100644 --- a/tests/Application/config/packages/fos_rest.yaml +++ b/tests/Application/config/packages/fos_rest.yaml @@ -7,5 +7,5 @@ fos_rest: empty_content: 204 format_listener: rules: - - { path: '^/api/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true } + - { path: '^/api/v1/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true } - { path: '^/', stop: true } diff --git a/tests/Application/config/packages/framework.yaml b/tests/Application/config/packages/framework.yaml index 9b44501..8be076b 100644 --- a/tests/Application/config/packages/framework.yaml +++ b/tests/Application/config/packages/framework.yaml @@ -4,3 +4,6 @@ framework: csrf_protection: true session: handler_id: ~ + serializer: + mapping: + paths: [ '%kernel.project_dir%/config/serialization' ] diff --git a/tests/Application/config/sylius/1.10/packages/jms_serializer.yaml b/tests/Application/config/packages/jms_serializer.yaml similarity index 100% rename from tests/Application/config/sylius/1.10/packages/jms_serializer.yaml rename to tests/Application/config/packages/jms_serializer.yaml diff --git a/tests/Application/config/packages/mailer.yaml b/tests/Application/config/packages/mailer.yaml new file mode 100644 index 0000000..56a650d --- /dev/null +++ b/tests/Application/config/packages/mailer.yaml @@ -0,0 +1,3 @@ +framework: + mailer: + dsn: '%env(MAILER_DSN)%' diff --git a/tests/Application/config/sylius/1.10/packages/prod/jms_serializer.yaml b/tests/Application/config/packages/prod/jms_serializer.yaml similarity index 100% rename from tests/Application/config/sylius/1.10/packages/prod/jms_serializer.yaml rename to tests/Application/config/packages/prod/jms_serializer.yaml diff --git a/tests/Application/config/sylius/1.10/packages/security.yaml b/tests/Application/config/packages/security.yaml similarity index 58% rename from tests/Application/config/sylius/1.10/packages/security.yaml rename to tests/Application/config/packages/security.yaml index 1062810..4ed342f 100644 --- a/tests/Application/config/sylius/1.10/packages/security.yaml +++ b/tests/Application/config/packages/security.yaml @@ -1,16 +1,5 @@ -parameters: - sylius.security.admin_regex: "^/%sylius_admin.path_name%" - sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++" - sylius.security.new_api_route: "/new-api" - sylius.security.new_api_regex: "^%sylius.security.new_api_route%" - sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" - sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%" - sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop" - sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%" - security: - always_authenticate_before_granting: true + enable_authenticator_manager: true providers: sylius_admin_user_provider: id: sylius.admin_user_provider.email_or_name_based @@ -20,11 +9,8 @@ security: id: sylius.shop_user_provider.email_or_name_based sylius_api_shop_user_provider: id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - encoders: + password_hashers: Sylius\Component\User\Model\UserInterface: argon2i firewalls: admin: @@ -40,7 +26,7 @@ security: default_target_path: sylius_admin_dashboard use_forward: false use_referer: true - csrf_token_generator: security.csrf.token_manager + enable_csrf: true csrf_parameter: _csrf_admin_security_token csrf_token_id: admin_authenticate remember_me: @@ -52,46 +38,32 @@ security: logout: path: sylius_admin_logout target: sylius_admin_login - anonymous: true new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider + pattern: "%sylius.security.new_api_admin_regex%/.*" + provider: sylius_api_admin_user_provider stateless: true - anonymous: true + entry_point: jwt json_login: - check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" + 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 - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider stateless: true - anonymous: true + entry_point: jwt json_login: - check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" + 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 - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true shop: switch_user: { role: ROLE_ALLOWED_TO_SWITCH } @@ -108,7 +80,7 @@ security: default_target_path: sylius_shop_homepage use_forward: false use_referer: true - csrf_token_generator: security.csrf.token_manager + enable_csrf: true csrf_parameter: _csrf_shop_security_token csrf_token_id: shop_authenticate remember_me: @@ -118,31 +90,35 @@ security: remember_me_parameter: _remember_me logout: path: sylius_shop_logout - target: sylius_shop_login + target: sylius_shop_homepage invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ + 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: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { 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: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { 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: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { 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: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { 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.api_regex%/.*", role: ROLE_API_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_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { 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/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml index 76d7e5e..fc1d3c1 100644 --- a/tests/Application/config/packages/test/framework.yaml +++ b/tests/Application/config/packages/test/framework.yaml @@ -1,4 +1,4 @@ framework: test: ~ session: - storage_id: session.storage.mock_file + 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 new file mode 100644 index 0000000..52610d6 --- /dev/null +++ b/tests/Application/config/packages/test/mailer.yaml @@ -0,0 +1,5 @@ +framework: + cache: + pools: + test.mailer_pool: + adapter: cache.adapter.filesystem diff --git a/tests/Application/config/packages/test/security.yaml b/tests/Application/config/packages/test/security.yaml index 21cc377..4071d31 100644 --- a/tests/Application/config/packages/test/security.yaml +++ b/tests/Application/config/packages/test/security.yaml @@ -1,3 +1,6 @@ security: - encoders: - sha512: sha512 + password_hashers: + Sylius\Component\User\Model\UserInterface: + algorithm: argon2i + time_cost: 3 + memory_cost: 10 diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml index 76d7e5e..e9dd6ee 100644 --- a/tests/Application/config/packages/test_cached/framework.yaml +++ b/tests/Application/config/packages/test_cached/framework.yaml @@ -1,4 +1,2 @@ -framework: - test: ~ - session: - storage_id: session.storage.mock_file +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 new file mode 100644 index 0000000..16f3170 --- /dev/null +++ b/tests/Application/config/packages/test_cached/mailer.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "../test/mailer.yaml" } diff --git a/tests/Application/config/packages/test_cached/security.yaml b/tests/Application/config/packages/test_cached/security.yaml index 21cc377..76e9273 100644 --- a/tests/Application/config/packages/test_cached/security.yaml +++ b/tests/Application/config/packages/test_cached/security.yaml @@ -1,3 +1,2 @@ -security: - encoders: - sha512: sha512 +imports: + - { resource: ../test/security.yaml } diff --git a/tests/Application/config/packages/webpack_encore.yaml b/tests/Application/config/packages/webpack_encore.yaml new file mode 100644 index 0000000..9bee248 --- /dev/null +++ b/tests/Application/config/packages/webpack_encore.yaml @@ -0,0 +1,5 @@ +webpack_encore: + output_path: '%kernel.project_dir%/public/build/default' + builds: + shop: '%kernel.project_dir%/public/build/shop' + admin: '%kernel.project_dir%/public/build/admin' diff --git a/tests/Application/config/serialization/.gitignore b/tests/Application/config/serialization/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tests/Application/config/sylius/1.10/bundles.php b/tests/Application/config/sylius/1.10/bundles.php deleted file mode 100644 index bd33f4a..0000000 --- a/tests/Application/config/sylius/1.10/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.8/bundles.php b/tests/Application/config/sylius/1.8/bundles.php deleted file mode 100644 index 74ee2bc..0000000 --- a/tests/Application/config/sylius/1.8/bundles.php +++ /dev/null @@ -1,6 +0,0 @@ - ['all' => true], - WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.8/packages/dev/jms_serializer.yaml b/tests/Application/config/sylius/1.8/packages/dev/jms_serializer.yaml deleted file mode 100644 index 353e460..0000000 --- a/tests/Application/config/sylius/1.8/packages/dev/jms_serializer.yaml +++ /dev/null @@ -1,7 +0,0 @@ -jms_serializer: - visitors: - json: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.8/packages/framework.yaml b/tests/Application/config/sylius/1.8/packages/framework.yaml deleted file mode 100644 index 62f82d3..0000000 --- a/tests/Application/config/sylius/1.8/packages/framework.yaml +++ /dev/null @@ -1,2 +0,0 @@ -framework: - templating: { engines: ["twig"] } diff --git a/tests/Application/config/sylius/1.8/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.8/packages/jms_serializer.yaml deleted file mode 100644 index 64dd8d1..0000000 --- a/tests/Application/config/sylius/1.8/packages/jms_serializer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -jms_serializer: - visitors: - xml: - format_output: '%kernel.debug%' diff --git a/tests/Application/config/sylius/1.8/packages/prod/jms_serializer.yaml b/tests/Application/config/sylius/1.8/packages/prod/jms_serializer.yaml deleted file mode 100644 index bc97faf..0000000 --- a/tests/Application/config/sylius/1.8/packages/prod/jms_serializer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -jms_serializer: - visitors: - json: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.8/routes/dev/twig.yaml b/tests/Application/config/sylius/1.8/routes/dev/twig.yaml deleted file mode 100644 index f4ee839..0000000 --- a/tests/Application/config/sylius/1.8/routes/dev/twig.yaml +++ /dev/null @@ -1,3 +0,0 @@ -_errors: - resource: '@TwigBundle/Resources/config/routing/errors.xml' - prefix: /_error diff --git a/tests/Application/config/sylius/1.9/bundles.php b/tests/Application/config/sylius/1.9/bundles.php deleted file mode 100644 index bd33f4a..0000000 --- a/tests/Application/config/sylius/1.9/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.9/packages/dev/jms_serializer.yaml b/tests/Application/config/sylius/1.9/packages/dev/jms_serializer.yaml deleted file mode 100644 index 2f32a9b..0000000 --- a/tests/Application/config/sylius/1.9/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/sylius/1.9/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.9/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc61..0000000 --- a/tests/Application/config/sylius/1.9/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.9/packages/prod/jms_serializer.yaml b/tests/Application/config/sylius/1.9/packages/prod/jms_serializer.yaml deleted file mode 100644 index c288182..0000000 --- a/tests/Application/config/sylius/1.9/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/package.json b/tests/Application/package.json index b27949d..32ccdc4 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -1,53 +1,63 @@ { "dependencies": { - "babel-polyfill": "^6.26.0", - "chart.js": "^2.9.3", - "jquery": "^3.4.0", + "@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": "^0.28.0", - "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", + "@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": "^4.19.1", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-import-resolver-babel-module": "^4.0.0", - "eslint-plugin-import": "^2.11.0", - "fast-async": "^6.3.7", - "gulp": "^4.0.0", - "gulp-chug": "^0.5", - "gulp-concat": "^2.6.0", - "gulp-debug": "^2.1.2", - "gulp-if": "^2.0.0", - "gulp-livereload": "^4.0.1", - "gulp-order": "^1.1.1", - "gulp-sass": "^4.0.1", - "gulp-sourcemaps": "^1.6.0", - "gulp-uglifycss": "^1.0.5", - "merge-stream": "^1.0.0", - "rollup": "^0.60.2", - "rollup-plugin-babel": "^3.0.4", - "rollup-plugin-commonjs": "^9.1.3", - "rollup-plugin-inject": "^2.0.0", - "rollup-plugin-node-resolve": "^3.3.0", - "rollup-plugin-uglify": "^4.0.0", - "sass-loader": "^7.0.1", - "upath": "^1.1.0", - "yargs": "^6.4.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": { - "build": "gulp build", + "watch": "encore dev --watch", + "build": "encore dev", + "build:prod": "encore production", "gulp": "gulp build", "lint": "yarn lint:js", - "lint:js": "eslint gulpfile.babel.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", diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php index 5feb7f4..af4ad7e 100644 --- a/tests/Application/public/index.php +++ b/tests/Application/public/index.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Tests\Madcoders\SyliusSizechartPlugin\Application\Kernel; +use Tests\Acme\SyliusExamplePlugin\Application\Kernel; use Symfony\Component\ErrorHandler\Debug; use Symfony\Component\HttpFoundation\Request; diff --git a/tests/Application/src/Entity/.gitignore b/tests/Application/src/Entity/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig new file mode 100644 index 0000000..1d9fa7d --- /dev/null +++ b/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig @@ -0,0 +1,5 @@ + +
+ +
+
diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Security/_content.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Security/_content.html.twig new file mode 100644 index 0000000..ce17621 --- /dev/null +++ b/tests/Application/templates/bundles/SyliusAdminBundle/Security/_content.html.twig @@ -0,0 +1,6 @@ +{% 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 new file mode 100644 index 0000000..f5f9835 --- /dev/null +++ b/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig @@ -0,0 +1 @@ +{{ 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 new file mode 100644 index 0000000..a96144c --- /dev/null +++ b/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig @@ -0,0 +1 @@ +{{ encore_entry_link_tags('admin-entry', null, 'admin') }} diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig new file mode 100644 index 0000000..8486493 --- /dev/null +++ b/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig @@ -0,0 +1,9 @@ +
+
+ {{ '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 new file mode 100644 index 0000000..84b8df5 --- /dev/null +++ b/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig @@ -0,0 +1,5 @@ + diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig new file mode 100644 index 0000000..d1655bb --- /dev/null +++ b/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig @@ -0,0 +1 @@ +{{ 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 new file mode 100644 index 0000000..fd2c7cb --- /dev/null +++ b/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig @@ -0,0 +1 @@ +{{ encore_entry_link_tags('shop-entry', null, 'shop') }} diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js index ba0308f..599e371 100644 --- a/tests/Application/webpack.config.js +++ b/tests/Application/webpack.config.js @@ -1,46 +1,48 @@ const path = require('path'); const Encore = require('@symfony/webpack-encore'); -const syliusBundles = path.resolve(__dirname, 'vendor/sylius/sylius/src/Sylius/Bundle/'); +const syliusBundles = path.resolve(__dirname, '../../vendor/sylius/sylius/src/Sylius/Bundle/'); const uiBundleScripts = path.resolve(syliusBundles, 'UiBundle/Resources/private/js/'); const uiBundleResources = path.resolve(syliusBundles, 'UiBundle/Resources/private/'); // Shop config Encore - .setOutputPath('public/build/shop/') - .setPublicPath('/build/shop') - .addEntry('shop-entry', './assets/shop/entry.js') - .disableSingleRuntimeChunk() - .cleanupOutputBeforeBuild() - .enableSourceMaps(!Encore.isProduction()) - .enableVersioning(Encore.isProduction()) - .enableSassLoader(); + .setOutputPath('public/build/shop/') + .setPublicPath('/build/shop') + .addEntry('shop-entry', './assets/shop/entry.js') + .disableSingleRuntimeChunk() + .cleanupOutputBeforeBuild() + .enableSourceMaps(!Encore.isProduction()) + .enableVersioning(Encore.isProduction()) + .enableSassLoader(); const shopConfig = Encore.getWebpackConfig(); 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(); + .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'; diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..469dcce --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,11 @@ +bootEnv(dirname(__DIR__).'/.env'); +} From 845349cd77790e41167fec371b56b183aad97088 Mon Sep 17 00:00:00 2001 From: Piotr Lewandowski Date: Tue, 4 Apr 2023 18:00:14 +0200 Subject: [PATCH 2/7] #10 add reinit to make file --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f752d31..b2d5d46 100644 --- a/Makefile +++ b/Makefile @@ -27,11 +27,19 @@ frontend: behat: APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress +dropdb: + tests/Application/bin/console doctrine:database:drop --if-exists --force + +createdb: + tests/Application/bin/console doctrine:database:create --if-not-exists + init: install backend frontend +reinit: dropdb init + ci: init phpstan psalm phpunit phpspec behat -integration: init phpunit behat +integration: init phpunit behate static: install phpspec phpstan psalm From 02d5af203846a31c7b66e14d69fe672015abcd05 Mon Sep 17 00:00:00 2001 From: Piotr Lewandowski Date: Tue, 4 Apr 2023 19:03:40 +0200 Subject: [PATCH 3/7] #10 clean up after upgrade, fix Kernel, move dev dependencies to dev autoloader --- Makefile | 2 +- bin/console | 17 ----------------- composer.json | 6 ++++-- src/Kernel.php | 11 ----------- tests/Application/.babelrc | 15 --------------- tests/Application/Kernel.php | 2 +- tests/Application/bin/console | 2 +- tests/Application/config/bundles.php | 2 +- .../config/packages/dev/swiftmailer.yaml | 2 -- .../config/packages/security_checker.yaml | 9 --------- .../config/packages/swiftmailer.yaml | 2 -- .../config/packages/test/swiftmailer.yaml | 6 ------ .../packages/test_cached/swiftmailer.yaml | 6 ------ tests/Application/public/media/image/.gitignore | 0 14 files changed, 8 insertions(+), 74 deletions(-) delete mode 100755 bin/console delete mode 100644 src/Kernel.php delete mode 100644 tests/Application/.babelrc delete mode 100644 tests/Application/config/packages/dev/swiftmailer.yaml delete mode 100644 tests/Application/config/packages/security_checker.yaml delete mode 100644 tests/Application/config/packages/swiftmailer.yaml delete mode 100644 tests/Application/config/packages/test/swiftmailer.yaml delete mode 100644 tests/Application/config/packages/test_cached/swiftmailer.yaml delete mode 100644 tests/Application/public/media/image/.gitignore diff --git a/Makefile b/Makefile index b2d5d46..f00b41a 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ dropdb: createdb: tests/Application/bin/console doctrine:database:create --if-not-exists -init: install backend frontend +init: createdb install backend frontend reinit: dropdb init diff --git a/bin/console b/bin/console deleted file mode 100755 index c933dc5..0000000 --- a/bin/console +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env php - ['all' => true], Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true], Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true], - Madcoders\SyliusSizeChartPlugin\MadcodersSyliusSizechartPlugin::class => ['all' => true], + Madcoders\SyliusSizechartPlugin\MadcodersSyliusSizechartPlugin::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], diff --git a/tests/Application/config/packages/dev/swiftmailer.yaml b/tests/Application/config/packages/dev/swiftmailer.yaml deleted file mode 100644 index f438078..0000000 --- a/tests/Application/config/packages/dev/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - disable_delivery: true diff --git a/tests/Application/config/packages/security_checker.yaml b/tests/Application/config/packages/security_checker.yaml deleted file mode 100644 index 0f9cf00..0000000 --- a/tests/Application/config/packages/security_checker.yaml +++ /dev/null @@ -1,9 +0,0 @@ -services: - SensioLabs\Security\SecurityChecker: - public: false - - SensioLabs\Security\Command\SecurityCheckerCommand: - arguments: ['@SensioLabs\Security\SecurityChecker'] - public: false - tags: - - { name: console.command, command: 'security:check' } diff --git a/tests/Application/config/packages/swiftmailer.yaml b/tests/Application/config/packages/swiftmailer.yaml deleted file mode 100644 index 3bab0d3..0000000 --- a/tests/Application/config/packages/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - url: '%env(MAILER_URL)%' diff --git a/tests/Application/config/packages/test/swiftmailer.yaml b/tests/Application/config/packages/test/swiftmailer.yaml deleted file mode 100644 index c438f4b..0000000 --- a/tests/Application/config/packages/test/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/packages/test_cached/swiftmailer.yaml b/tests/Application/config/packages/test_cached/swiftmailer.yaml deleted file mode 100644 index c438f4b..0000000 --- a/tests/Application/config/packages/test_cached/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/public/media/image/.gitignore b/tests/Application/public/media/image/.gitignore deleted file mode 100644 index e69de29..0000000 From 8b9344d10eb9344140b076a440e96ecf5449b2ab Mon Sep 17 00:00:00 2001 From: Piotr Lewandowski Date: Tue, 4 Apr 2023 22:08:36 +0200 Subject: [PATCH 4/7] #10 fix Kernel namespace in index.php --- tests/Application/public/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php index af4ad7e..5feb7f4 100644 --- a/tests/Application/public/index.php +++ b/tests/Application/public/index.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Tests\Acme\SyliusExamplePlugin\Application\Kernel; +use Tests\Madcoders\SyliusSizechartPlugin\Application\Kernel; use Symfony\Component\ErrorHandler\Debug; use Symfony\Component\HttpFoundation\Request; From 6fe1ef818d1893b6a944a03c4b11b21f2b29f5b1 Mon Sep 17 00:00:00 2001 From: Piotr Lewandowski Date: Wed, 5 Apr 2023 09:05:49 +0200 Subject: [PATCH 5/7] #10 fix default db dsn and kernel FQCN for test env --- tests/Application/.env | 2 +- tests/Application/.env.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Application/.env b/tests/Application/.env index 5a6e376..89a592d 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -12,7 +12,7 @@ APP_SECRET=EDITME # 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/acme_sylius_example_plugin_%kernel.environment%?serverVersion=5.7 +DATABASE_URL=mysql://root@127.0.0.1/madcoders_sylius_sizechart_plugin_%kernel.environment%?serverVersion=5.7 ###< doctrine/doctrine-bundle ### ###> lexik/jwt-authentication-bundle ### diff --git a/tests/Application/.env.test b/tests/Application/.env.test index c0ee239..b3096ec 100644 --- a/tests/Application/.env.test +++ b/tests/Application/.env.test @@ -1,3 +1,3 @@ APP_SECRET='ch4mb3r0f5ecr3ts' -KERNEL_CLASS='Tests\Acme\SyliusExamplePlugin\Application\Kernel' +KERNEL_CLASS='Tests\Madcoders\SyliusSizechartPlugin\Application\Kernel' From 0fb2ca320123f28f5d9dcfc485d44bb65162d751 Mon Sep 17 00:00:00 2001 From: Piotr Lewandowski Date: Wed, 5 Apr 2023 12:36:13 +0200 Subject: [PATCH 6/7] #10 update README.md - add info about older releases --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3f627ef..03cf81e 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ | Sylius | ^1.12 | For Sylius 1.8 support check [Sylius Size Chart Plugin v1.0.x](https://github.com/mad-coders/sylius-sizechart-plugin/tree/1.0). +For Sylius 1.9, 1.10 support check [Sylius Size Chart Plugin v1.1.x](https://github.com/mad-coders/sylius-sizechart-plugin/tree/1.1). ## Screenshots ![store front](./docs/img/size_chart_store_front.png) From 9f17f5b058882d44e06253ef3bf4a80b1a4d132e Mon Sep 17 00:00:00 2001 From: Piotr Lewandowski Date: Wed, 5 Apr 2023 12:37:18 +0200 Subject: [PATCH 7/7] #10 update README.md - add info about older releases (fix formatting) --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 03cf81e..aa4628c 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,9 @@ | PHP | ^8.0 | | Sylius | ^1.12 | -For Sylius 1.8 support check [Sylius Size Chart Plugin v1.0.x](https://github.com/mad-coders/sylius-sizechart-plugin/tree/1.0). -For Sylius 1.9, 1.10 support check [Sylius Size Chart Plugin v1.1.x](https://github.com/mad-coders/sylius-sizechart-plugin/tree/1.1). +## Older releases +- For Sylius 1.8 support check [Sylius Size Chart Plugin v1.0.x](https://github.com/mad-coders/sylius-sizechart-plugin/tree/1.0). +- For Sylius 1.9, 1.10 support check [Sylius Size Chart Plugin v1.1.x](https://github.com/mad-coders/sylius-sizechart-plugin/tree/1.1). ## Screenshots ![store front](./docs/img/size_chart_store_front.png)