diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0d2db9d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - + package-ecosystem: composer + directory: "/" + schedule: + interval: daily + time: "10:00" + open-pull-requests-limit: 4 + versioning-strategy: increase-if-necessary diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0e29de..dccd9ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,8 +14,7 @@ on: release: types: [created] schedule: - - - cron: "0 1 * * 6" # Run at 1am every Saturday + - cron: "0 1 * * 6" # Run at 1am every Saturday workflow_dispatch: ~ jobs: @@ -29,12 +28,12 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.0"] - symfony: ["^4.4", "^5.4"] + php: [ 8.0 ] + symfony: [ ^5.4, ^6.0 ] steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP @@ -51,15 +50,15 @@ jobs: if: matrix.symfony != '' run: | composer global config --no-plugins allow-plugins.symfony/flex true - composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" + composer global require --no-progress --no-scripts --no-plugins "symfony/flex" - name: Get Composer cache directory + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} @@ -85,21 +84,26 @@ jobs: - name: Validate Yaml files run: vendor/bin/yaml-lint src - if: always() && steps.end-of-setup.outcome == 'success' && matrix.symfony != '^4.4' + if: always() && steps.end-of-setup.outcome == 'success' - name: Run ECS run: vendor/bin/ecs check src - if: always() && steps.end-of-setup.outcome == 'success' && matrix.symfony != '^4.4' + if: always() && steps.end-of-setup.outcome == 'success' - name: Run Psalm - run: vendor/bin/psalm --show-info=false --output-format=github --php-version=${{ matrix.php }} + run: vendor/bin/psalm --show-info=false --output-format=github if: always() && steps.end-of-setup.outcome == 'success' - name: Run PHPStan - run: vendor/bin/phpstan analyse -l max src + run: vendor/bin/phpstan analyse + if: always() && steps.end-of-setup.outcome == 'success' + + - + name: Run PHPSpec + run: vendor/bin/phpspec run --ansi -f progress --no-interaction if: always() && steps.end-of-setup.outcome == 'success' tests: runs-on: ubuntu-latest @@ -110,18 +114,12 @@ jobs: fail-fast: false matrix: php: [7.3, 7.4, 8.0] - symfony: [^4.4, ^5.4] - sylius: [~1.8.0, ~1.9.0, ~1.10.0, ~1.11.0] - node: [12.x] + symfony: [^5.4, ^6.0] + sylius: [~1.9.0, ~1.10.0, ~1.11.0, ~1.12.0] + node: [18.x] mysql: [5.7] exclude: - - - sylius: ~1.8.0 - symfony: ^5.4 - - - sylius: ~1.8.0 - php: 8.0 - sylius: ~1.9.0 php: 8.0 @@ -129,8 +127,8 @@ jobs: sylius: ~1.10.0 php: 7.3 - - sylius: ~1.10.0 # issue with a missing service declaration : Service "api_platform.error_listener": Parent definition "exception_listener" does not exist. - symfony: ^4.4 + sylius: ~1.10.0 + symfony: ^6.0 - sylius: ~1.11.0 php: 7.3 @@ -139,7 +137,19 @@ jobs: php: 7.4 - sylius: ~1.11.0 - symfony: ^4.4 + symfony: ^6.0 + - + sylius: ~1.12.0 + php: 7.3 + - + sylius: ~1.12.0 + php: 7.4 + - + php: 7.3 + symfony: ^6.0 + - + php: 7.4 + symfony: ^6.0 env: APP_ENV: test @@ -147,7 +157,7 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP @@ -160,7 +170,7 @@ jobs: - name: Setup Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: "${{ matrix.node }}" @@ -183,22 +193,22 @@ jobs: name: Install certificates run: symfony server:ca:install - - - name: Run Chrome Headless - run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' https://127.0.0.1 > /dev/null 2>&1 & - - name: Run webserver run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) + - + name: Run Chrome Headless + run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-features=Translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 https://127.0.0.1 > /dev/null 2>&1 & + - name: Get Composer cache directory + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} @@ -210,23 +220,13 @@ jobs: if: matrix.symfony != '' run: | composer global config --no-plugins allow-plugins.symfony/flex true - composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" + composer global require --no-progress --no-scripts --no-plugins "symfony/flex" - name: Restrict Sylius version if: matrix.sylius != '' run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction - - - name: Fix build on Sylius 1.8 - if: matrix.sylius == '~1.8.0' - run: | - composer require "friendsofsymfony/oauth-server-bundle:^1.6 || >2.0.0-alpha.0 ^2.0@dev" --no-update --no-scripts --no-interaction - # Sylius issues on `json_array` type not existing - composer require "doctrine/dbal:^2.6" --no-update --no-scripts --no-interaction - # Not added into Sylius 1.8 but available in 1.9 - composer require "liip/imagine-bundle:<2.6" --no-update --no-scripts --no-interaction - - name: Fix build on Sylius 1.9 if: matrix.sylius == '~1.9.0' @@ -244,11 +244,11 @@ jobs: - name: Get Yarn cache directory id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache Yarn - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.yarn-cache.outputs.dir }} key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} @@ -288,7 +288,7 @@ jobs: - name: Upload Behat logs - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: failure() with: name: Behat logs diff --git a/composer.json b/composer.json index 0900a56..b1638b6 100644 --- a/composer.json +++ b/composer.json @@ -16,11 +16,11 @@ }, "require-dev": { "ext-json": "*", - "behat/behat": "^3.7", - "behat/mink": "^1.8", - "dmore/behat-chrome-extension": "^1.3", - "dmore/chrome-mink-driver": "^2.7", - "friends-of-behat/mink": "^1.8", + "behat/behat": "^3.7", + "behat/mink": "^1.9", + "dmore/behat-chrome-extension": "^1.4", + "dmore/chrome-mink-driver": "^2.8", + "friends-of-behat/mink": "^1.9", "friends-of-behat/mink-browserkit-driver": "^1.4", "friends-of-behat/mink-debug-extension": "^2.0", "friends-of-behat/mink-extension": "^2.4", @@ -28,19 +28,21 @@ "friends-of-behat/symfony-extension": "^2.1", "friends-of-behat/variadic-extension": "^1.3", "phpspec/phpspec": "^7.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-doctrine": "^0.12.33", - "phpstan/phpstan-strict-rules": "^0.12.0", - "phpstan/phpstan-webmozart-assert": "0.12.12", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan-doctrine": "^1", + "phpstan/phpstan-strict-rules": "^1", + "phpstan/phpstan-webmozart-assert": "^1", "phpunit/phpunit": "^9.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "sylius-labs/coding-standard": "^4.0", - "symfony/browser-kit": "^4.4 || ^5.4", - "symfony/debug-bundle": "^4.4 || ^5.4", - "symfony/dotenv": "^4.4 || ^5.4", - "symfony/intl": "^4.4 || ^5.4", - "symfony/web-profiler-bundle": "^4.4 || ^5.4", - "vimeo/psalm": "^4.6.4" + "symfony/browser-kit": "^5.4|^6.0", + "symfony/debug-bundle": "^5.4|^6.0", + "symfony/dotenv": "^5.4|^6.0", + "symfony/intl": "^5.4|^6.0", + "symfony/runtime": "^5.4|^6.0", + "symfony/web-profiler-bundle": "^5.4|^6.0", + "symfony/webpack-encore-bundle": "^1.16", + "vimeo/psalm": "^4|^5" }, "autoload": { "psr-4": { "FluxSE\\SyliusPayumMoneticoPlugin\\": "src/" } @@ -51,20 +53,6 @@ "Tests\\FluxSE\\SyliusPayumMoneticoPlugin\\App\\": "tests/Application/src/" } }, - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "config": { - "sort-packages": true, - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": false, - "phpstan/extension-installer": true, - "symfony/flex": true, - "symfony/thanks": true - } - }, "scripts": { "post-install-cmd": [ "@php bin/create_node_symlink.php" @@ -75,5 +63,22 @@ "post-create-project-cmd": [ "@php bin/create_node_symlink.php" ] + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "phpstan/extension-installer": true, + "symfony/thanks": true, + "symfony/runtime": true + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + }, + "runtime": { + "project_dir": "tests/Application", + "dotenv_path": "tests/Application/.env" + } } } diff --git a/ecs.php b/ecs.php index 01e1ef5..cd3d17f 100644 --- a/ecs.php +++ b/ecs.php @@ -5,10 +5,10 @@ use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer; use Symplify\EasyCodingStandard\Config\ECSConfig; -return static function (ECSConfig $config): void { - $config->import(__DIR__ . '/vendor/sylius-labs/coding-standard/ecs.php'); +return static function (ECSConfig $ecsConfig): void { + $ecsConfig->import(__DIR__ . '/vendor/sylius-labs/coding-standard/ecs.php'); - $services = $config->services(); + $services = $ecsConfig->services(); // PHP 7 compatibility $services diff --git a/features/shop/paying_with_monetico_during_checkout.feature b/features/shop/paying_with_monetico_during_checkout.feature index b3dea09..d17a042 100644 --- a/features/shop/paying_with_monetico_during_checkout.feature +++ b/features/shop/paying_with_monetico_during_checkout.feature @@ -60,4 +60,4 @@ Feature: Paying with Monetico during checkout And I retry my payment attempt and succeed When I get back from the Monetico portal Then I should be notified that my payment has been completed - And I should see the thank you page \ No newline at end of file + And I should see the thank you page diff --git a/node_modules b/node_modules deleted file mode 120000 index 9270531..0000000 --- a/node_modules +++ /dev/null @@ -1 +0,0 @@ -tests/Application/node_modules \ No newline at end of file diff --git a/phpstan.neon b/phpstan.neon.dist similarity index 65% rename from phpstan.neon rename to phpstan.neon.dist index 41f23b3..d375fe3 100755 --- a/phpstan.neon +++ b/phpstan.neon.dist @@ -2,15 +2,25 @@ parameters: reportUnmatchedIgnoredErrors: false checkMissingIterableValueType: false - excludes_analyse: + level: max + + paths: + - src + - tests + + excludePaths: # Makes PHPStan crash - - 'src/DependencyInjection/Configuration.php' + - src/DependencyInjection/Configuration.php - # Test dependencies - - 'tests/Application/app/**.php' - - 'tests/Application/src/**.php' + - tests/Application/Kernel.php + - tests/Application/public/index.php + - tests/Application/config/**.php + - tests/Application/var/**.php + - tests/Application/node_modules/**.php ignoreErrors: + - message: '/Method Tests\\FluxSE\\SyliusPayumMoneticoPlugin\\Behat\\Page\\External\\MoneticoCheckoutPage::__construct\(\) has parameter \$minkParameters with generic interface ArrayAccess but does not specify its types: TKey, TValue/' + path: tests/Behat/Page/External/MoneticoCheckoutPage.php - '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./' - '/Parameter #1 \$request \(Payum\\Core\\Request\\Cancel\) of method FluxSE\\SyliusPayumMoneticoPlugin\\Action\\CancelAction::execute\(\) should be contravariant with parameter \$request \(mixed\) of method Payum\\Core\\Action\\ActionInterface::execute\(\)/' - '/Parameter #1 \$request \(Payum\\Core\\Request\\Convert\) of method FluxSE\\SyliusPayumMoneticoPlugin\\Action\\ConvertPaymentAction::execute\(\) should be contravariant with parameter \$request \(mixed\) of method Payum\\Core\\Action\\ActionInterface::execute\(\)/' diff --git a/tests/Application/.babelrc b/tests/Application/.babelrc index e563a62..14eaf4c 100644 --- a/tests/Application/.babelrc +++ b/tests/Application/.babelrc @@ -1,14 +1,13 @@ { "presets": [ - ["env", { + ["@babel/preset-env", { "targets": { "node": "6" - }, - "useBuiltIns": true + } }] ], "plugins": [ - ["transform-object-rest-spread", { + ["@babel/plugin-proposal-object-rest-spread", { "useBuiltIns": true }] ] diff --git a/tests/Application/.env b/tests/Application/.env index 416e985..efa89db 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -28,6 +28,10 @@ JWT_PASSPHRASE=acme_plugin_development MAILER_URL=smtp://localhost ###< 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 diff --git a/tests/Application/.env.test b/tests/Application/.env.test index 9dd7633..177b212 100644 --- a/tests/Application/.env.test +++ b/tests/Application/.env.test @@ -1,5 +1,28 @@ -APP_SECRET='ch4mb3r0f5ecr3ts' +###> symfony/framework-bundle ### +APP_ENV=test +APP_DEBUG=1 +APP_SECRET=ch4mb3r0f5ecr3ts +###< symfony/framework-bundle ### KERNEL_CLASS='Tests\FluxSE\SyliusPayumMoneticoPlugin\Application\Kernel' +###> 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=null://localhost +###< symfony/swiftmailer-bundle ### + +###> lexik/jwt-authentication-bundle ### +JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private-test.pem +JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public-test.pem +JWT_PASSPHRASE=ALL_THAT_IS_GOLD_DOES_NOT_GLITTER_NOT_ALL_THOSE_WHO_WANDER_ARE_LOST +###< lexik/jwt-authentication-bundle ### + +###> symfony/messenger ### MESSENGER_TRANSPORT_DSN=sync:// +###< symfony/messenger ### + +###> symfony/mailer ### +MAILER_DSN=null://null +###< symfony/mailer ### diff --git a/tests/Application/.eslintrc.js b/tests/Application/.eslintrc.js index 92c4cee..b189064 100644 --- a/tests/Application/.eslintrc.js +++ b/tests/Application/.eslintrc.js @@ -1,5 +1,7 @@ module.exports = { - extends: 'airbnb-base', + extends: [ + 'airbnb-base', + ], env: { node: true, }, @@ -17,4 +19,7 @@ module.exports = { ignoreTemplateLiterals: true, }], }, + settings: { + 'import/resolver': 'webpack', + }, }; 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 8a4e5f3..a4310de 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -12,8 +12,11 @@ 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; +/** + * @property string $environment + */ final class Kernel extends BaseKernel { use MicroKernelTrait; @@ -41,7 +44,7 @@ public function registerBundles(): iterable } } - protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void + private function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void { foreach ($this->getConfigurationDirectories() as $confDir) { $bundlesFile = $confDir . '/bundles.php'; @@ -58,7 +61,7 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa } } - protected function configureRoutes(RouteCollectionBuilder $routes): void + private function configureRoutes(RoutingConfigurator $routes): void { foreach ($this->getConfigurationDirectories() as $confDir) { $this->loadRoutesConfiguration($routes, $confDir); @@ -87,11 +90,11 @@ private function loadContainerConfiguration(LoaderInterface $loader, string $con $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); } /** @@ -99,6 +102,7 @@ private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string */ private function registerBundlesFromFile(string $bundlesFile): iterable { + /** @var array $contents */ $contents = require $bundlesFile; foreach ($contents as $class => $envs) { if (isset($envs['all']) || isset($envs[$this->environment])) { 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 61a6e04..40d48e5 100755 --- a/tests/Application/bin/console +++ b/tests/Application/bin/console @@ -3,36 +3,13 @@ use Tests\FluxSE\SyliusPayumMoneticoPlugin\Application\Kernel; use Symfony\Bundle\FrameworkBundle\Console\Application; -use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\ErrorHandler\Debug; -set_time_limit(0); - -require __DIR__.'/../../../vendor/autoload.php'; - -if (!class_exists(Application::class)) { - throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.'); +if (!is_file(dirname(__DIR__).'/../../vendor/autoload_runtime.php')) { + throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".'); } -$input = new ArgvInput(); -if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); -} - -if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); -} - -require dirname(__DIR__).'/config/bootstrap.php'; - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists(Debug::class)) { - Debug::enable(); - } -} +require_once dirname(__DIR__).'/../../vendor/autoload_runtime.php'; -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$application = new Application($kernel); -$application->run($input); +return function (array $context) { + return new Application(new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG'])); +}; diff --git a/tests/Application/config/api_platform/.gitignore b/tests/Application/config/api_platform/.gitkeep similarity index 100% rename from tests/Application/config/api_platform/.gitignore rename to tests/Application/config/api_platform/.gitkeep diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php index d7ac51d..677571e 100644 --- a/tests/Application/config/bootstrap.php +++ b/tests/Application/config/bootstrap.php @@ -13,6 +13,10 @@ $_ENV += $env; } elseif (!class_exists(Dotenv::class)) { throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); +} elseif (method_exists(Dotenv::class, 'bootEnv')) { + (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); + + return; } else { // load all the .env files (new Dotenv(true))->loadEnv(dirname(__DIR__) . '/.env'); @@ -20,4 +24,4 @@ $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; -$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; +$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index f3459ce..f00ab11 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -6,7 +6,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], @@ -55,5 +54,6 @@ Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], + Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], FluxSE\SyliusPayumMoneticoPlugin\FluxSESyliusPayumMoneticoPlugin::class => ['all' => true], ]; diff --git a/tests/Application/config/packages/assets.yaml b/tests/Application/config/packages/assets.yaml new file mode 100644 index 0000000..b1ea48b --- /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/packages/doctrine_migrations.yaml b/tests/Application/config/packages/doctrine_migrations.yaml index cdbc01a..b3dffec 100644 --- a/tests/Application/config/packages/doctrine_migrations.yaml +++ b/tests/Application/config/packages/doctrine_migrations.yaml @@ -2,3 +2,5 @@ doctrine_migrations: storage: table_storage: table_name: sylius_migrations +# migrations_paths: +# 'App\Migrations': '%kernel.project_dir%/src/Migrations/' diff --git a/tests/Application/config/packages/test/security.yaml b/tests/Application/config/packages/test/security.yaml deleted file mode 100644 index 21cc377..0000000 --- a/tests/Application/config/packages/test/security.yaml +++ /dev/null @@ -1,3 +0,0 @@ -security: - encoders: - sha512: sha512 diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml deleted file mode 100644 index 76d7e5e..0000000 --- a/tests/Application/config/packages/test_cached/framework.yaml +++ /dev/null @@ -1,4 +0,0 @@ -framework: - test: ~ - session: - storage_id: session.storage.mock_file diff --git a/tests/Application/config/packages/test_cached/security.yaml b/tests/Application/config/packages/test_cached/security.yaml deleted file mode 100644 index 21cc377..0000000 --- a/tests/Application/config/packages/test_cached/security.yaml +++ /dev/null @@ -1,3 +0,0 @@ -security: - encoders: - sha512: sha512 diff --git a/tests/Application/config/packages/twig.yaml b/tests/Application/config/packages/twig.yaml index 3b315dc..8545473 100644 --- a/tests/Application/config/packages/twig.yaml +++ b/tests/Application/config/packages/twig.yaml @@ -2,3 +2,11 @@ twig: paths: ['%kernel.project_dir%/templates'] debug: '%kernel.debug%' strict_variables: '%kernel.debug%' + +services: + _defaults: + public: false + autowire: true + autoconfigure: true + + Twig\Extra\Intl\IntlExtension: ~ diff --git a/tests/Application/config/packages/twig_extensions.yaml b/tests/Application/config/packages/twig_extensions.yaml deleted file mode 100644 index 0482a15..0000000 --- a/tests/Application/config/packages/twig_extensions.yaml +++ /dev/null @@ -1,11 +0,0 @@ -services: - _defaults: - public: false - autowire: true - autoconfigure: true - - # Uncomment any lines below to activate that Twig extension - #Twig\Extensions\ArrayExtension: ~ - #Twig\Extensions\DateExtension: ~ - Twig\Extra\Intl\IntlExtension: ~ - #Twig\Extensions\TextExtension: ~ diff --git a/tests/Application/config/packages/webpack_encore.yaml b/tests/Application/config/packages/webpack_encore.yaml new file mode 100644 index 0000000..9427d36 --- /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/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml index 92eeae0..fae46cb 100644 --- a/tests/Application/config/routes/sylius_shop.yaml +++ b/tests/Application/config/routes/sylius_shop.yaml @@ -11,4 +11,4 @@ sylius_shop_default_locale: path: / methods: [GET] defaults: - _controller: sylius.controller.shop.locale_switch:switchAction + _controller: sylius.controller.shop.locale_switch::switchAction diff --git a/tests/Application/config/sylius/1.10/bundles.php b/tests/Application/config/sylius/1.10/bundles.php index d50639f..bb5146a 100644 --- a/tests/Application/config/sylius/1.10/bundles.php +++ b/tests/Application/config/sylius/1.10/bundles.php @@ -3,6 +3,7 @@ declare(strict_types=1); return [ + Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/packages/dev/swiftmailer.yaml b/tests/Application/config/sylius/1.10/packages/dev/swiftmailer.yaml similarity index 100% rename from tests/Application/config/packages/dev/swiftmailer.yaml rename to tests/Application/config/sylius/1.10/packages/dev/swiftmailer.yaml diff --git a/tests/Application/config/sylius/1.10/packages/security.yaml b/tests/Application/config/sylius/1.10/packages/security.yaml deleted file mode 100644 index 1062810..0000000 --- a/tests/Application/config/sylius/1.10/packages/security.yaml +++ /dev/null @@ -1,148 +0,0 @@ -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 - 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 - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - 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 - csrf_token_generator: security.csrf.token_manager - 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 - anonymous: true - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-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_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-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 - - 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 - csrf_token_generator: security.csrf.token_manager - 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_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - 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: 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: 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.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { 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_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/packages/swiftmailer.yaml b/tests/Application/config/sylius/1.10/packages/swiftmailer.yaml similarity index 100% rename from tests/Application/config/packages/swiftmailer.yaml rename to tests/Application/config/sylius/1.10/packages/swiftmailer.yaml diff --git a/tests/Application/config/packages/test/swiftmailer.yaml b/tests/Application/config/sylius/1.10/packages/test/swiftmailer.yaml similarity index 100% rename from tests/Application/config/packages/test/swiftmailer.yaml rename to tests/Application/config/sylius/1.10/packages/test/swiftmailer.yaml diff --git a/tests/Application/config/sylius/1.10/packages/test_cached/swiftmailer.yaml b/tests/Application/config/sylius/1.10/packages/test_cached/swiftmailer.yaml new file mode 100644 index 0000000..1bc61b8 --- /dev/null +++ b/tests/Application/config/sylius/1.10/packages/test_cached/swiftmailer.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "../test/swiftmailer.yaml" } diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.11/bundles.php index 400b877..15f3aa7 100644 --- a/tests/Application/config/sylius/1.11/bundles.php +++ b/tests/Application/config/sylius/1.11/bundles.php @@ -3,6 +3,7 @@ declare(strict_types=1); return [ + Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], diff --git a/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml new file mode 100644 index 0000000..f438078 --- /dev/null +++ b/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml @@ -0,0 +1,2 @@ +swiftmailer: + disable_delivery: true diff --git a/tests/Application/config/sylius/1.11/packages/security.yaml b/tests/Application/config/sylius/1.11/packages/security.yaml deleted file mode 100644 index 1062810..0000000 --- a/tests/Application/config/sylius/1.11/packages/security.yaml +++ /dev/null @@ -1,148 +0,0 @@ -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 - 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 - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - 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 - csrf_token_generator: security.csrf.token_manager - 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 - anonymous: true - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-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_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-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 - - 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 - csrf_token_generator: security.csrf.token_manager - 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_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - 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: 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: 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.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { 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_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml new file mode 100644 index 0000000..3bab0d3 --- /dev/null +++ b/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml @@ -0,0 +1,2 @@ +swiftmailer: + url: '%env(MAILER_URL)%' diff --git a/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml new file mode 100644 index 0000000..c438f4b --- /dev/null +++ b/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml @@ -0,0 +1,6 @@ +swiftmailer: + disable_delivery: true + logging: true + spool: + type: file + path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml new file mode 100644 index 0000000..1bc61b8 --- /dev/null +++ b/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "../test/swiftmailer.yaml" } diff --git a/tests/Application/config/sylius/1.12/bundles.php b/tests/Application/config/sylius/1.12/bundles.php new file mode 100644 index 0000000..4a8358c --- /dev/null +++ b/tests/Application/config/sylius/1.12/bundles.php @@ -0,0 +1,8 @@ + ['all' => true], + SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], + Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], + League\FlysystemBundle\FlysystemBundle::class => ['all' => true], +]; diff --git a/tests/Application/config/sylius/1.12/packages/dev/jms_serializer.yaml b/tests/Application/config/sylius/1.12/packages/dev/jms_serializer.yaml new file mode 100644 index 0000000..2f32a9b --- /dev/null +++ b/tests/Application/config/sylius/1.12/packages/dev/jms_serializer.yaml @@ -0,0 +1,12 @@ +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.8/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.12/packages/jms_serializer.yaml similarity index 73% rename from tests/Application/config/sylius/1.8/packages/jms_serializer.yaml rename to tests/Application/config/sylius/1.12/packages/jms_serializer.yaml index 64dd8d1..ed7bc61 100644 --- a/tests/Application/config/sylius/1.8/packages/jms_serializer.yaml +++ b/tests/Application/config/sylius/1.12/packages/jms_serializer.yaml @@ -1,4 +1,4 @@ jms_serializer: visitors: - xml: + xml_serialization: format_output: '%kernel.debug%' diff --git a/tests/Application/config/sylius/1.12/packages/mailer.yaml b/tests/Application/config/sylius/1.12/packages/mailer.yaml new file mode 100644 index 0000000..0a0697c --- /dev/null +++ b/tests/Application/config/sylius/1.12/packages/mailer.yaml @@ -0,0 +1,3 @@ +framework: + mailer: + dsn: '%env(MAILER_DSN)%' diff --git a/tests/Application/config/sylius/1.12/packages/prod/jms_serializer.yaml b/tests/Application/config/sylius/1.12/packages/prod/jms_serializer.yaml new file mode 100644 index 0000000..c288182 --- /dev/null +++ b/tests/Application/config/sylius/1.12/packages/prod/jms_serializer.yaml @@ -0,0 +1,10 @@ +jms_serializer: + visitors: + json_serialization: + options: + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION + json_deserialization: + options: + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/sylius/1.12/packages/test/mailer.yaml b/tests/Application/config/sylius/1.12/packages/test/mailer.yaml new file mode 100644 index 0000000..52610d6 --- /dev/null +++ b/tests/Application/config/sylius/1.12/packages/test/mailer.yaml @@ -0,0 +1,5 @@ +framework: + cache: + pools: + test.mailer_pool: + adapter: cache.adapter.filesystem diff --git a/tests/Application/config/sylius/1.12/packages/test_cached/mailer.yaml b/tests/Application/config/sylius/1.12/packages/test_cached/mailer.yaml new file mode 100644 index 0000000..16f3170 --- /dev/null +++ b/tests/Application/config/sylius/1.12/packages/test_cached/mailer.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "../test/mailer.yaml" } diff --git a/tests/Application/config/sylius/1.12/services_test.yaml b/tests/Application/config/sylius/1.12/services_test.yaml new file mode 100644 index 0000000..8d086f8 --- /dev/null +++ b/tests/Application/config/sylius/1.12/services_test.yaml @@ -0,0 +1,7 @@ +services: + + Tests\FluxSE\SyliusPayumMoneticoPlugin\App\Action\GetHttpRequestAction: + decorates: payum.action.get_http_request + arguments: + $decoratedGetHttpRequestAction: '@Tests\FluxSE\SyliusPayumMoneticoPlugin\App\Action\GetHttpRequestAction.inner' + $httpRequestStack: '@request_stack' 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 161339d..0000000 --- a/tests/Application/config/sylius/1.8/bundles.php +++ /dev/null @@ -1,10 +0,0 @@ - ['all' => true], - WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true], - FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true], - Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.8/packages/_sylius.yaml b/tests/Application/config/sylius/1.8/packages/_sylius.yaml deleted file mode 100644 index 1674a97..0000000 --- a/tests/Application/config/sylius/1.8/packages/_sylius.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" } 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/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/packages/security.yaml b/tests/Application/config/sylius/1.8/packages/security.yaml deleted file mode 100644 index 8161bda..0000000 --- a/tests/Application/config/sylius/1.8/packages/security.yaml +++ /dev/null @@ -1,159 +0,0 @@ -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 - 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 - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - 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 - csrf_token_generator: security.csrf.token_manager - 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 - anonymous: true - - oauth_token: - pattern: "%sylius.security.api_regex%/oauth/v2/token" - security: false - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-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_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-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 - - api: - pattern: "%sylius.security.api_regex%/.*" - provider: sylius_admin_user_provider - fos_oauth: true - stateless: true - anonymous: 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 - csrf_token_generator: security.csrf.token_manager - 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_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - 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: 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: 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.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { 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_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } 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.8/routes/sylius_admin_api.yaml b/tests/Application/config/sylius/1.8/routes/sylius_admin_api.yaml deleted file mode 100644 index 80aed45..0000000 --- a/tests/Application/config/sylius/1.8/routes/sylius_admin_api.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_admin_api: - resource: "@SyliusAdminApiBundle/Resources/config/routing.yml" - prefix: /api diff --git a/tests/Application/config/sylius/1.9/bundles.php b/tests/Application/config/sylius/1.9/bundles.php index 36137b9..b4f7d4a 100644 --- a/tests/Application/config/sylius/1.9/bundles.php +++ b/tests/Application/config/sylius/1.9/bundles.php @@ -3,6 +3,7 @@ declare(strict_types=1); return [ + Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true], diff --git a/tests/Application/config/sylius/1.9/packages/dev/swiftmailer.yaml b/tests/Application/config/sylius/1.9/packages/dev/swiftmailer.yaml new file mode 100644 index 0000000..f438078 --- /dev/null +++ b/tests/Application/config/sylius/1.9/packages/dev/swiftmailer.yaml @@ -0,0 +1,2 @@ +swiftmailer: + disable_delivery: true diff --git a/tests/Application/config/sylius/1.9/packages/security.yaml b/tests/Application/config/sylius/1.9/packages/security.yaml deleted file mode 100644 index 8161bda..0000000 --- a/tests/Application/config/sylius/1.9/packages/security.yaml +++ /dev/null @@ -1,159 +0,0 @@ -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 - 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 - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - 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 - csrf_token_generator: security.csrf.token_manager - 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 - anonymous: true - - oauth_token: - pattern: "%sylius.security.api_regex%/oauth/v2/token" - security: false - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-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_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-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 - - api: - pattern: "%sylius.security.api_regex%/.*" - provider: sylius_admin_user_provider - fos_oauth: true - stateless: true - anonymous: 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 - csrf_token_generator: security.csrf.token_manager - 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_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - 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: 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: 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.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { 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_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/sylius/1.9/packages/swiftmailer.yaml b/tests/Application/config/sylius/1.9/packages/swiftmailer.yaml new file mode 100644 index 0000000..3bab0d3 --- /dev/null +++ b/tests/Application/config/sylius/1.9/packages/swiftmailer.yaml @@ -0,0 +1,2 @@ +swiftmailer: + url: '%env(MAILER_URL)%' diff --git a/tests/Application/config/sylius/1.9/packages/test/swiftmailer.yaml b/tests/Application/config/sylius/1.9/packages/test/swiftmailer.yaml new file mode 100644 index 0000000..c438f4b --- /dev/null +++ b/tests/Application/config/sylius/1.9/packages/test/swiftmailer.yaml @@ -0,0 +1,6 @@ +swiftmailer: + disable_delivery: true + logging: true + spool: + type: file + path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/sylius/1.9/packages/test_cached/swiftmailer.yaml b/tests/Application/config/sylius/1.9/packages/test_cached/swiftmailer.yaml new file mode 100644 index 0000000..1bc61b8 --- /dev/null +++ b/tests/Application/config/sylius/1.9/packages/test_cached/swiftmailer.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "../test/swiftmailer.yaml" } diff --git a/tests/Application/public/media/image/.gitignore b/tests/Application/config/symfony/.gitkeep similarity index 100% rename from tests/Application/public/media/image/.gitignore rename to tests/Application/config/symfony/.gitkeep diff --git a/tests/Application/config/symfony/4.4/packages/framework.yaml b/tests/Application/config/symfony/4.4/packages/framework.yaml deleted file mode 100644 index 62f82d3..0000000 --- a/tests/Application/config/symfony/4.4/packages/framework.yaml +++ /dev/null @@ -1,2 +0,0 @@ -framework: - templating: { engines: ["twig"] } diff --git a/tests/Application/config/symfony/5.4/packages/security.yaml b/tests/Application/config/symfony/5.4/packages/security.yaml new file mode 100644 index 0000000..2821ee3 --- /dev/null +++ b/tests/Application/config/symfony/5.4/packages/security.yaml @@ -0,0 +1,142 @@ +parameters: + sylius.security.admin_regex: "^/%sylius_admin.path_name%" + sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|api/.*|api$|media/.*)[^/]++" + sylius.security.new_api_route: "/api/v2" + 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%" + sylius.security.new_api_user_account_route: "%sylius.security.new_api_shop_route%/account" + sylius.security.new_api_user_account_regex: "^%sylius.security.new_api_user_account_route%" + +security: + always_authenticate_before_granting: 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 + + encoders: + 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 + csrf_token_generator: security.csrf.token_manager + 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 + anonymous: true + + new_api_admin_user: + pattern: "%sylius.security.new_api_admin_regex%/.*" + provider: sylius_api_admin_user_provider + stateless: true + anonymous: true + 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 + guard: + authenticators: + - lexik_jwt_authentication.jwt_token_authenticator + + new_api_shop_user: + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider + stateless: true + anonymous: true + 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 + guard: + authenticators: + - lexik_jwt_authentication.jwt_token_authenticator + + 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 + csrf_token_generator: security.csrf.token_manager + 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_login + invalidate_session: false + success_handler: sylius.handler.shop_user_logout + anonymous: true + + 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: IS_AUTHENTICATED_ANONYMOUSLY, 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: ROLE_NO_ACCESS } + + - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } + + - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } + + - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } + - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } + + - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/symfony/5.4/packages/test/framework.yaml similarity index 100% rename from tests/Application/config/packages/test/framework.yaml rename to tests/Application/config/symfony/5.4/packages/test/framework.yaml diff --git a/tests/Application/config/symfony/5.4/packages/test_cached/framework.yaml b/tests/Application/config/symfony/5.4/packages/test_cached/framework.yaml new file mode 100644 index 0000000..7c6483d --- /dev/null +++ b/tests/Application/config/symfony/5.4/packages/test_cached/framework.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "../test/framework.yaml" } diff --git a/tests/Application/config/symfony/6.0/packages/security.yaml b/tests/Application/config/symfony/6.0/packages/security.yaml new file mode 100644 index 0000000..dbc9e1a --- /dev/null +++ b/tests/Application/config/symfony/6.0/packages/security.yaml @@ -0,0 +1,137 @@ +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: + 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 + sylius_api_chain_provider: + chain: + providers: [ sylius_api_shop_user_provider, sylius_api_admin_user_provider ] + + 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 + + access_control: + - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } + - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } + + - { path: "%sylius.security.admin_regex%/forgotten-password", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } + - { 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/symfony/6.0/packages/test/framework.yaml b/tests/Application/config/symfony/6.0/packages/test/framework.yaml new file mode 100644 index 0000000..28277fd --- /dev/null +++ b/tests/Application/config/symfony/6.0/packages/test/framework.yaml @@ -0,0 +1,4 @@ +framework: + test: ~ + session: + storage_factory_id: session.storage.factory.mock_file diff --git a/tests/Application/config/symfony/6.0/packages/test_cached/framework.yaml b/tests/Application/config/symfony/6.0/packages/test_cached/framework.yaml new file mode 100644 index 0000000..7c6483d --- /dev/null +++ b/tests/Application/config/symfony/6.0/packages/test_cached/framework.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "../test/framework.yaml" } diff --git a/tests/Application/config/symfony/6.1 b/tests/Application/config/symfony/6.1 new file mode 120000 index 0000000..5049538 --- /dev/null +++ b/tests/Application/config/symfony/6.1 @@ -0,0 +1 @@ +6.0 \ No newline at end of file diff --git a/tests/Application/config/symfony/6.2 b/tests/Application/config/symfony/6.2 new file mode 120000 index 0000000..5049538 --- /dev/null +++ b/tests/Application/config/symfony/6.2 @@ -0,0 +1 @@ +6.0 \ No newline at end of file diff --git a/tests/Application/config/symfony/6.3 b/tests/Application/config/symfony/6.3 new file mode 120000 index 0000000..5049538 --- /dev/null +++ b/tests/Application/config/symfony/6.3 @@ -0,0 +1 @@ +6.0 \ No newline at end of file diff --git a/tests/Application/config/symfony/6.4 b/tests/Application/config/symfony/6.4 new file mode 120000 index 0000000..5049538 --- /dev/null +++ b/tests/Application/config/symfony/6.4 @@ -0,0 +1 @@ +6.0 \ No newline at end of file diff --git a/tests/Application/gulpfile.babel.js b/tests/Application/gulpfile.babel.js deleted file mode 100644 index 5920316..0000000 --- a/tests/Application/gulpfile.babel.js +++ /dev/null @@ -1,60 +0,0 @@ -import chug from 'gulp-chug'; -import gulp from 'gulp'; -import yargs from 'yargs'; - -const { argv } = yargs - .options({ - rootPath: { - description: ' path to public assets directory', - type: 'string', - requiresArg: true, - required: false, - }, - nodeModulesPath: { - description: ' path to node_modules directory', - type: 'string', - requiresArg: true, - required: false, - }, - }); - -const config = [ - '--rootPath', - argv.rootPath || '../../../../../../../tests/Application/public/assets', - '--nodeModulesPath', - argv.nodeModulesPath || '../../../../../../../tests/Application/node_modules', -]; - -export const buildAdmin = function buildAdmin() { - return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/gulpfile.babel.js', { read: false }) - .pipe(chug({ args: config, tasks: 'build' })); -}; -buildAdmin.description = 'Build admin assets.'; - -export const watchAdmin = function watchAdmin() { - return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/gulpfile.babel.js', { read: false }) - .pipe(chug({ args: config, tasks: 'watch' })); -}; -watchAdmin.description = 'Watch admin asset sources and rebuild on changes.'; - -export const buildShop = function buildShop() { - return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/gulpfile.babel.js', { read: false }) - .pipe(chug({ args: config, tasks: 'build' })); -}; -buildShop.description = 'Build shop assets.'; - -export const watchShop = function watchShop() { - return gulp.src('../../vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/gulpfile.babel.js', { read: false }) - .pipe(chug({ args: config, tasks: 'watch' })); -}; -watchShop.description = 'Watch shop asset sources and rebuild on changes.'; - -export const build = gulp.parallel(buildAdmin, buildShop); -build.description = 'Build assets.'; - -gulp.task('admin', buildAdmin); -gulp.task('admin-watch', watchAdmin); -gulp.task('shop', buildShop); -gulp.task('shop-watch', watchShop); - -export default build; diff --git a/tests/Application/package.json b/tests/Application/package.json index 4c8e8e0..7f77d97 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -1,7 +1,6 @@ { "dependencies": { - "babel-polyfill": "^6.26.0", - "chart.js": "^2.9.3", + "chart.js": "^3.7.1", "jquery": "^3.5.0", "jquery.dirtyforms": "^2.0.0", "lightbox2": "^2.9.0", @@ -9,46 +8,43 @@ "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/eslint-parser": "^7.19.1", + "@babel/plugin-proposal-object-rest-spread": "^7.18.9", + "@babel/preset-env": "^7.18.10", + "@babel/register": "^7.18.9", + "@rollup/plugin-babel": "^6.0.3", + "@rollup/plugin-commonjs": "^23.0.3", + "@rollup/plugin-inject": "^5.0.2", + "@rollup/plugin-node-resolve": "^15.0.1", + "@semantic-ui-react/css-patch": "^1.1.2", + "@symfony/webpack-encore": "^4.0.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": "https://github.com/MrFlashAccount/gulp-sass", - "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.28.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-import-resolver-babel-module": "^5.3.1", + "eslint-import-resolver-webpack": "^0.13.2", + "eslint-plugin-import": "^2.26.0", + "eslint-webpack-plugin": "^3.2.0", + "fast-async": "^6.3.8", + "merge-stream": "^2.0.0", + "rollup": "^2.79.1", + "rollup-plugin-terser": "^7.0.2", + "sass": "^1.56.1", + "sass-loader": "^13.0.0", + "webpack": "^5.75.0", + "webpack-cli": "^4.10.0" }, + "engineStrict": true, "scripts": { - "build": "gulp build", - "gulp": "gulp build", + "watch": "encore dev --watch", + "build": "encore dev", + "build:prod": "encore production", "lint": "yarn lint:js", - "lint:js": "eslint gulpfile.babel.js", - "watch": "gulp watch" + "lint:js": "eslint webpack.config.js assets/admin assets/shop", + "postinstall": "semantic-ui-css-patch" }, "repository": { "type": "git", diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php index 433b496..c08667b 100644 --- a/tests/Application/public/index.php +++ b/tests/Application/public/index.php @@ -2,28 +2,10 @@ declare(strict_types=1); -use Symfony\Component\ErrorHandler\Debug; -use Symfony\Component\HttpFoundation\Request; use Tests\FluxSE\SyliusPayumMoneticoPlugin\Application\Kernel; -require dirname(__DIR__).'/config/bootstrap.php'; +require_once dirname(__DIR__) . '/../../vendor/autoload_runtime.php'; -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - Debug::enable(); -} - -if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) { - Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); -} - -if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) { - Request::setTrustedHosts([$trustedHosts]); -} - -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$request = Request::createFromGlobals(); -$response = $kernel->handle($request); -$response->send(); -$kernel->terminate($request, $response); +return static function (array $context) { + return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); +}; diff --git a/tests/Application/public/media/image/.gitkeep b/tests/Application/public/media/image/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/Application/src/Action/GetHttpRequestAction.php b/tests/Application/src/Action/GetHttpRequestAction.php new file mode 100644 index 0000000..9fddc8a --- /dev/null +++ b/tests/Application/src/Action/GetHttpRequestAction.php @@ -0,0 +1,47 @@ +decoratedGetHttpRequestAction = $decoratedGetHttpRequestAction; + $this->httpRequestStack = $httpRequestStack; + } + + public function execute($request): void + { + RequestNotSupportedException::assertSupports($this, $request); + + if ($this->httpRequestStack->getCurrentRequest() !== $this->httpRequestStack->getMainRequest()) + { + $this->decoratedGetHttpRequestAction->setHttpRequest($this->httpRequestStack->getCurrentRequest()); + } + $this->decoratedGetHttpRequestAction->execute($request); + } + + public function supports($request): bool + { + return $this->decoratedGetHttpRequestAction->supports($request); + } +} diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js index ba0308f..f07f525 100644 --- a/tests/Application/webpack.config.js +++ b/tests/Application/webpack.config.js @@ -1,9 +1,9 @@ const path = require('path'); const Encore = require('@symfony/webpack-encore'); -const syliusBundles = path.resolve(__dirname, 'vendor/sylius/sylius/src/Sylius/Bundle/'); -const uiBundleScripts = path.resolve(syliusBundles, 'UiBundle/Resources/private/js/'); +const syliusBundles = path.resolve(__dirname, '../../vendor/sylius/sylius/src/Sylius/Bundle/'); const uiBundleResources = path.resolve(syliusBundles, 'UiBundle/Resources/private/'); +const uiBundleScripts = path.resolve(uiBundleResources, 'js/'); // Shop config Encore @@ -15,6 +15,9 @@ Encore .enableSourceMaps(!Encore.isProduction()) .enableVersioning(Encore.isProduction()) .enableSassLoader(); +// Disabled because it create error : +// > 'sylius' should be listed in the project's dependencies. Run 'npm i -S sylius' to add it import/no-extraneous-dependencies +//.enableEslintPlugin(); const shopConfig = Encore.getWebpackConfig(); @@ -35,13 +38,17 @@ Encore .enableSourceMaps(!Encore.isProduction()) .enableVersioning(Encore.isProduction()) .enableSassLoader(); +// Disabled because it create error : +// > 'sylius' should be listed in the project's dependencies. Run 'npm i -S sylius' to add it import/no-extraneous-dependencies +// .enableEslintPlugin(); const adminConfig = Encore.getWebpackConfig(); adminConfig.resolve.alias['sylius/ui'] = uiBundleScripts; adminConfig.resolve.alias['sylius/ui-resources'] = uiBundleResources; adminConfig.resolve.alias['sylius/bundle'] = syliusBundles; -adminConfig.externals = Object.assign({}, adminConfig.externals, { window: 'window', document: 'document' }); +adminConfig.resolve.alias['chart.js/dist/Chart.min'] = path.resolve(__dirname, 'node_modules/chart.js/dist/chart.min.js'); +adminConfig.externals = { ...adminConfig.externals, ...{ window: 'window', document: 'document' } }; adminConfig.name = 'admin'; module.exports = [shopConfig, adminConfig]; diff --git a/tests/Behat/Context/Setup/MoneticoContext.php b/tests/Behat/Context/Setup/MoneticoContext.php index 8b2c549..97beb86 100644 --- a/tests/Behat/Context/Setup/MoneticoContext.php +++ b/tests/Behat/Context/Setup/MoneticoContext.php @@ -11,6 +11,7 @@ use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Core\Repository\PaymentMethodRepositoryInterface; +use Webmozart\Assert\Assert; class MoneticoContext implements Context { @@ -57,7 +58,9 @@ public function theStoreHasAPaymentMethodWithACodeAndMoneticoPaymentGateway( 'monetico', 'Monetico' ); - $paymentMethod->getGatewayConfig()->setConfig([ + $gatewayConfig = $paymentMethod->getGatewayConfig(); + Assert::notNull($gatewayConfig); + $gatewayConfig->setConfig([ 'key' => self::KEY, 'tpe' => self::TPE, 'company' => self::COMPANY, diff --git a/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodsContext.php b/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodsContext.php index 26667f0..fb80c0a 100644 --- a/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodsContext.php +++ b/tests/Behat/Context/Ui/Admin/ManagingPaymentMethodsContext.php @@ -33,7 +33,7 @@ public function iWantToCreateANewMoneticoPaymentMethod(): void /** * @When I configure it with test monetico gateway data */ - public function iConfigureItWithTestMoneticoGatewayData() + public function iConfigureItWithTestMoneticoGatewayData(): void { $this->createPage->setMoneticoKey(MoneticoContext::KEY); $this->createPage->setMoneticoTpe(MoneticoContext::TPE); diff --git a/tests/Behat/Context/Ui/Shop/MoneticoShopContext.php b/tests/Behat/Context/Ui/Shop/MoneticoShopContext.php index 2ba5874..31336c0 100644 --- a/tests/Behat/Context/Ui/Shop/MoneticoShopContext.php +++ b/tests/Behat/Context/Ui/Shop/MoneticoShopContext.php @@ -35,7 +35,7 @@ public function __construct( * @When I confirm my order with Monetico payment * @Given I have confirmed my order with Monetico payment */ - public function iConfirmMyOrderWithMoneticoPayment() + public function iConfirmMyOrderWithMoneticoPayment(): void { $this->summaryPage->confirmOrder(); } @@ -73,7 +73,7 @@ public function IRetryMyPaymentAttemptAndSucceed(): void * @When I click on "go back" during my Monetico payment * @When I get back from the Monetico portal */ - public function iCancelMyMoneticoPayment() + public function iCancelMyMoneticoPayment(): void { $this->paymentPage->capture(); } diff --git a/tests/Behat/Page/Admin/PaymentMethod/CreatePage.php b/tests/Behat/Page/Admin/PaymentMethod/CreatePage.php index dcb255a..b618d91 100644 --- a/tests/Behat/Page/Admin/PaymentMethod/CreatePage.php +++ b/tests/Behat/Page/Admin/PaymentMethod/CreatePage.php @@ -4,38 +4,25 @@ namespace Tests\FluxSE\SyliusPayumMoneticoPlugin\Behat\Page\Admin\PaymentMethod; -use Behat\Mink\Exception\ElementNotFoundException; use Sylius\Behat\Page\Admin\PaymentMethod\CreatePage as BaseCreatePage; final class CreatePage extends BaseCreatePage implements CreatePageInterface { - /** - * @throws ElementNotFoundException - */ public function setMoneticoKey(string $key): void { $this->getDocument()->fillField('KEY', $key); } - /** - * @throws ElementNotFoundException - */ public function setMoneticoTpe(string $tpe): void { $this->getDocument()->fillField('TPE number', $tpe); } - /** - * @throws ElementNotFoundException - */ public function setMoneticoCompany(string $company): void { $this->getDocument()->fillField('COMPANY', $company); } - /** - * @throws ElementNotFoundException - */ public function selectMoneticoMode(string $mode): void { $this->getElement('monetico_mode')->selectOption($mode); diff --git a/tests/Behat/Page/External/MoneticoCheckoutPage.php b/tests/Behat/Page/External/MoneticoCheckoutPage.php index 2f78341..e811447 100644 --- a/tests/Behat/Page/External/MoneticoCheckoutPage.php +++ b/tests/Behat/Page/External/MoneticoCheckoutPage.php @@ -4,14 +4,13 @@ namespace Tests\FluxSE\SyliusPayumMoneticoPlugin\Behat\Page\External; -use Behat\Mink\Exception\DriverException; -use Behat\Mink\Exception\UnsupportedDriverActionException; use Behat\Mink\Session; use Ekyna\Component\Payum\Monetico\Api\Api; use FriendsOfBehat\PageObjectExtension\Page\Page; use LogicException; use Payum\Core\Security\TokenInterface; use RuntimeException; +use Sylius\Bundle\PayumBundle\Model\PaymentSecurityTokenInterface; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; use Symfony\Component\HttpKernel\HttpKernelBrowser; @@ -20,7 +19,7 @@ final class MoneticoCheckoutPage extends Page implements MoneticoCheckoutPageInterface { - /** @var RepositoryInterface */ + /** @var RepositoryInterface */ private $securityTokenRepository; /** @var HttpKernelBrowser */ @@ -29,10 +28,14 @@ final class MoneticoCheckoutPage extends Page implements MoneticoCheckoutPageInt /** @var MoneticoNotifyPageInterface */ private $moneticoNotifyPage; - /** @var RepositoryInterface */ + /** @var RepositoryInterface */ private $paymentRepository; - public function __construct( + /** + * @param RepositoryInterface $securityTokenRepository + * @param RepositoryInterface $paymentRepository + */ + public function __construct( Session $session, $minkParameters, RepositoryInterface $securityTokenRepository, @@ -48,10 +51,6 @@ public function __construct( $this->paymentRepository = $paymentRepository; } - /** - * @throws DriverException - * @throws UnsupportedDriverActionException - */ public function capture(): void { $captureToken = $this->findToken(false); @@ -59,9 +58,6 @@ public function capture(): void $this->getDriver()->visit($captureToken->getTargetUrl()); } - /** - * {@inheritdoc} - */ public function notify(array $postData): void { $api = new Api(); @@ -86,13 +82,14 @@ public function notify(array $postData): void private function findToken(bool $afterType = true): TokenInterface { - /** @var TokenInterface $token */ foreach ($this->securityTokenRepository->findAll() as $token) { - if ($afterType && null === $token->getAfterUrl()) { + /** @var string|null $afterUrl */ + $afterUrl = $token->getAfterUrl(); + if ($afterType && null === $afterUrl) { return $token; } - if (!$afterType && null !== $token->getAfterUrl()) { + if (!$afterType && null !== $afterUrl) { return $token; } } @@ -100,9 +97,6 @@ private function findToken(bool $afterType = true): TokenInterface throw new RuntimeException('Cannot find token, check if you are after proper checkout steps'); } - /** - * {@inheritdoc} - */ protected function getUrl(array $urlParameters = []): string { return 'https://www.monetico-paiement.fr'; diff --git a/tests/Behat/Page/Monetico/MoneticoNotifyPage.php b/tests/Behat/Page/Monetico/MoneticoNotifyPage.php index 1ecddd8..de2339e 100644 --- a/tests/Behat/Page/Monetico/MoneticoNotifyPage.php +++ b/tests/Behat/Page/Monetico/MoneticoNotifyPage.php @@ -8,9 +8,6 @@ class MoneticoNotifyPage extends SymfonyPage implements MoneticoNotifyPageInterface { - /** - * {@inheritdoc} - */ public function getAbsoluteUrl(): string { return $this->getUrl();