diff --git a/.editorconfig b/.editorconfig index 0b3c7af..003d498 100644 --- a/.editorconfig +++ b/.editorconfig @@ -69,14 +69,10 @@ indent_size = 4 indent_style = space indent_size = 2 -[phpspec.yml{,.dist}] -indent_style = space -indent_size = 4 - [phpstan.neon] indent_style = space indent_size = 4 [phpunit.xml{,.dist}] indent_style = space -indent_size = 4 \ No newline at end of file +indent_size = 4 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07c02f6..53fa2ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,15 +12,15 @@ on: jobs: tests: runs-on: ubuntu-latest - + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" strategy: fail-fast: false matrix: - php: [ "8.1", "8.2", "8.3" ] - symfony: [ "^5.4", "^6.4" ] - sylius: [ "^1.14"] + php: [ "8.2", "8.3" ] + symfony: [ "^6.4", "^7.3" ] + sylius: [ "^2.0", "^2.1" ] node: [ "20.x" ] mysql: [ "8.0" ] env: @@ -35,7 +35,7 @@ jobs: with: php-version: "${{ matrix.php }}" extensions: intl - tools: symfony, composer-require-checker, composer-unused, flex + tools: composer-require-checker, composer-unused, flex, symfony coverage: none - name: Setup Node @@ -61,9 +61,6 @@ jobs: - name: Run Chrome Headless run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & - - name: Run webserver - run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) - - name: Validate composer.json run: composer validate --ansi --strict @@ -107,22 +104,23 @@ jobs: key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} restore-keys: | ${{ runner.os }}-node-${{ matrix.node }}-yarn- + - name: Install JS dependencies - run: (cd tests/Application && yarn install) + run: yarn install --cwd vendor/sylius/test-application - name: Prepare test application database run: | - (cd tests/Application && bin/console doctrine:database:create -vvv) - (cd tests/Application && bin/console doctrine:schema:create -vvv) + vendor/bin/console doctrine:database:create -vvv + vendor/bin/console doctrine:migrations:migrate --no-interaction -vvv - name: Prepare test application assets run: | - (cd tests/Application && bin/console assets:install public -vvv) - (cd tests/Application && yarn build:prod) + vendor/bin/console assets:install -vvv + yarn --cwd vendor/sylius/test-application build:prod - name: Prepare test application cache - run: (cd tests/Application && bin/console cache:warmup -vvv) + run: vendor/bin/console cache:warmup -vvv - name: Load fixtures in test application - run: (cd tests/Application && bin/console sylius:fixtures:load -n) + run: vendor/bin/console sylius:fixtures:load -n - name: Run Coding Standard run: vendor/bin/ecs check @@ -134,7 +132,7 @@ jobs: run: composer-unused - name: Validate database schema - run: (cd tests/Application && bin/console doctrine:schema:validate) + run: vendor/bin/console doctrine:schema:validate - name: Run PHPStan run: vendor/bin/phpstan analyse @@ -142,12 +140,12 @@ jobs: - name: Run Psalm run: vendor/bin/psalm - - name: Run PHPSpec - run: vendor/bin/phpspec run --ansi -f progress --no-interaction - - name: Run PHPUnit run: vendor/bin/phpunit --colors=always + - name: Run webserver + run: symfony server:start --port=8080 --daemon + - name: Run Behat run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun diff --git a/.gitignore b/.gitignore index 2a5626c..a53efe5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,19 @@ /vendor/ +/var/ /node_modules/ /composer.lock /etc/build/* !/etc/build/.gitignore -/tests/Application/yarn.lock +/tests/TestApplication/.env.local +/tests/TestApplication/.env.test.local +/tests/TestApplication/.env.*.local /.phpunit.result.cache /behat.yml -/phpspec.yml /phpunit.xml /docker-compose.override.yml +/compose.override.yaml .phpunit.result.cache diff --git a/.php-version b/.php-version index 2983cad..cf02201 100644 --- a/.php-version +++ b/.php-version @@ -1 +1 @@ -8.2 +8.3 diff --git a/README.md b/README.md index e4fef84..b2f73c6 100644 --- a/README.md +++ b/README.md @@ -14,22 +14,20 @@ ### Subscribe to get a Notification when a product return in stock -![Subscription process for configurable product](subscriprion_process.gif) - -![Subscription for simple product](simple_product.png) +![Subscription for simple product](docs/product.png) ### View your subscriptions in the apposite section of your account -![See the apposite section in the my account](my_account_section.png) +![See the apposite section in the my account](docs/my_account_section.png) ### View your client subscriptions in the apposite admin section -![See the apposite section in the admin account](admin_account_section.png) +![See the apposite section in the admin account](docs/admin_account_section.png) ## Requirements -* PHP `^8.1` -* Sylius `^1.14` +* PHP `^8.2` +* Sylius `^2.0` ## Installation @@ -63,29 +61,7 @@ bin/console assets:install bin/console sylius:theme:assets:install ``` -6. Install the plugin JS assets by adding the source to your webpack configuration: - -```js -// Shop config -Encore.setOutputPath('public/build/shop/') - .setPublicPath('/build/shop') - .addEntry('shop-entry', './vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/private/entry.js') - .addEntry('webgriffe-sylius-back-in-stock-notification-entry', './vendor/webgriffe/sylius-back-in-stock-notification-plugin/public/js/back-in-stock-notification.js') // The line to add - .disableSingleRuntimeChunk() - .cleanupOutputBeforeBuild() - .enableSourceMaps(!Encore.isProduction()) - .enableVersioning(Encore.isProduction()) - .enablePostCssLoader() - .enableSassLoader() -``` - -7. Run yarn build: - -```bash -bin/console yarn:build -``` - -8. Clear cache: +6. Clear cache: ```bash bin/console cache:clear @@ -126,17 +102,20 @@ To contribute to this plugin clone this repository, create a branch for your fea ```bash composer install -(cd tests/Application && yarn install) -(cd tests/Application && yarn build) -(cd tests/Application && APP_ENV=test bin/console assets:install public) +(cd vendor/sylius/test-application && yarn install) +(cd vendor/sylius/test-application && yarn build) +vendor/bin/console assets:install docker-compose up -d # only if you haven't mysql and mailhog installed locally -(cd tests/Application && APP_ENV=test bin/console doctrine:database:create) -(cd tests/Application && APP_ENV=test bin/console doctrine:schema:create) -``` +vendor/bin/console doctrine:database:create +vendor/bin/console doctrine:migrations:migrate -n +# Optionally load data fixtures +vendor/bin/console sylius:fixtures:load -n -To be able to setup a plugin's database, remember to configure you database credentials in `tests/Application/.env` and `tests/Application/.env.test`. +symfony server:ca:install +symfony server:start -d +``` ### Running plugin tests @@ -146,12 +125,6 @@ To be able to setup a plugin's database, remember to configure you database cred vendor/bin/phpunit ``` -#### PHPSpec - -```bash -vendor/bin/phpspec run -``` - #### Behat (non-JS scenarios) ```bash diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md new file mode 100644 index 0000000..85829b1 --- /dev/null +++ b/UPGRADE-5.0.md @@ -0,0 +1,79 @@ +# UPGRADE 4.x TO 5.0 + +## Version Support + +- Removed support for Sylius 1.12 +- Added support for Sylius 2.0 and 2.1 +- PHP 8.2+ required +- Symfony 6.4+ or 7.3+ required + +## Removed Classes + +- `src/Twig/AvailabilityExtension.php` +- `src/Twig/AvailabilityRuntime.php` + +## Removed Templates + +- `templates/_javascript.html.twig` +- `templates/_addSubscription.html.twig` +- `templates/productSubscriptionForm.html.twig` +- `templates/_configurableButton.html.twig` + +## New Classes + +- `src/Twig/Component/AddNotificationComponent.php` - LiveComponent replacing old Twig extension +- `src/Factory/SubscriptionFactory.php` +- `src/Processor/SubscriptionProcessor.php` + +## Changed Classes + +### SubscriptionController + +```diff + namespace Webgriffe\SyliusBackInStockNotificationPlugin\Controller; + + final class SubscriptionController extends AbstractController + { + public function __construct( +- private ChannelContextInterface $channelContext, + private TranslatorInterface $translator, +- private CustomerContextInterface $customerContext, +- private AvailabilityCheckerInterface $availabilityChecker, +- private ProductVariantRepositoryInterface $productVariantRepository, +- private SenderInterface $sender, +- private LocaleContextInterface $localeContext, + private SubscriptionRepositoryInterface $backInStockNotificationRepository, +- private FactoryInterface $backInStockNotificationFactory, + ) { + } +``` + +### AlertCommand + +```diff + namespace Webgriffe\SyliusBackInStockNotificationPlugin\Command; + +- use Symfony\Component\Console\Command\Command; + ++ use Symfony\Component\Console\Attribute\AsCommand; + use Symfony\Component\Console\Command\Command; + +- final class AlertCommand extends Command ++ #[AsCommand( ++ name: 'webgriffe:back-in-stock-notification:alert', ++ description: 'Send an email to the user if the product is returned in stock', ++ )] ++ final class AlertCommand extends Command + { +- protected function configure(): void +- { +- $this +- ->setName('webgriffe:back-in-stock-notification:alert') +- ->setDescription('Send an email to the user if the product is returned in stock'); +- } + } +``` + +## Asset Changes + +JavaScript file `assets/shop/back-in-stock-notification.js` has been removed. The plugin now uses LiveComponent architecture where form handling and interactions are managed directly by the `AddNotificationComponent` instead of external JavaScript files. diff --git a/admin_account_section.png b/admin_account_section.png deleted file mode 100644 index 6f0eb0a..0000000 Binary files a/admin_account_section.png and /dev/null differ diff --git a/assets/admin/controllers.json b/assets/admin/controllers.json new file mode 100644 index 0000000..a1c6e90 --- /dev/null +++ b/assets/admin/controllers.json @@ -0,0 +1,4 @@ +{ + "controllers": [], + "entrypoints": [] +} diff --git a/tests/Application/config/api_platform/.gitignore b/assets/admin/entrypoint.js similarity index 100% rename from tests/Application/config/api_platform/.gitignore rename to assets/admin/entrypoint.js diff --git a/assets/shop/controllers.json b/assets/shop/controllers.json new file mode 100644 index 0000000..a1c6e90 --- /dev/null +++ b/assets/shop/controllers.json @@ -0,0 +1,4 @@ +{ + "controllers": [], + "entrypoints": [] +} diff --git a/tests/Application/config/secrets/dev/.gitignore b/assets/shop/entrypoint.js similarity index 100% rename from tests/Application/config/secrets/dev/.gitignore rename to assets/shop/entrypoint.js diff --git a/behat.yml.dist b/behat.yml.dist index 797b67e..28d3986 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -49,9 +49,9 @@ default: show_auto: false FriendsOfBehat\SymfonyExtension: - bootstrap: tests/Application/config/bootstrap.php + bootstrap: vendor/sylius/test-application/config/bootstrap.php kernel: - class: Tests\Webgriffe\SyliusBackInStockNotificationPlugin\Application\Kernel + class: Sylius\TestApplication\Kernel FriendsOfBehat\VariadicExtension: ~ diff --git a/bin/create_node_symlink.php b/bin/create_node_symlink.php deleted file mode 100644 index 10d69b4..0000000 --- a/bin/create_node_symlink.php +++ /dev/null @@ -1,45 +0,0 @@ - `' . NODE_MODULES_FOLDER_NAME . '` already exists as a link or folder, keeping existing as may be intentional.' . PHP_EOL; - exit(0); - } else { - echo '> Invalid symlink `' . NODE_MODULES_FOLDER_NAME . '` detected, recreating...' . PHP_EOL; - if (!@unlink(NODE_MODULES_FOLDER_NAME)) { - echo '> Could not delete file `' . NODE_MODULES_FOLDER_NAME . '`.' . PHP_EOL; - exit(1); - } - } -} - -/* try to create the symlink using PHP internals... */ -$success = @symlink(PATH_TO_NODE_MODULES, NODE_MODULES_FOLDER_NAME); - -/* if case it has failed, but OS is Windows... */ -if (!$success && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - /* ...then try a different approach which does not require elevated permissions and folder to exist */ - echo '> This system is running Windows, creation of links requires elevated privileges,' . PHP_EOL; - echo '> and target path to exist. Fallback to NTFS Junction:' . PHP_EOL; - exec(sprintf('mklink /J %s %s 2> NUL', NODE_MODULES_FOLDER_NAME, PATH_TO_NODE_MODULES), $output, $returnCode); - $success = $returnCode === 0; - if (!$success) { - echo '> Failed o create the required symlink' . PHP_EOL; - exit(2); - } -} - -$path = @readlink(NODE_MODULES_FOLDER_NAME); -/* check if link points to the intended directory */ -if ($path && realpath($path) === realpath(PATH_TO_NODE_MODULES)) { - echo '> Successfully created the symlink.' . PHP_EOL; - exit(0); -} - -echo '> Failed to create the symlink to `' . NODE_MODULES_FOLDER_NAME . '`.' . PHP_EOL; -exit(3); diff --git a/docker-compose.override.sample.yml b/compose.override.sample.yaml similarity index 90% rename from docker-compose.override.sample.yml rename to compose.override.sample.yaml index 5ef2f08..12e44fd 100644 --- a/docker-compose.override.sample.yml +++ b/compose.override.sample.yaml @@ -3,7 +3,7 @@ services: ports: - 3306:3306 - mailhog: + mailpit: ports: - "8025:8025" - "1025:1025" diff --git a/docker-compose.yml b/compose.yaml similarity index 82% rename from docker-compose.yml rename to compose.yaml index 2914755..c1b9a36 100644 --- a/docker-compose.yml +++ b/compose.yaml @@ -1,4 +1,3 @@ -version: '3.4' services: db: image: 'mysql:8.0' @@ -10,8 +9,8 @@ services: volumes: - mysql_data:/var/lib/mysql:rw - mailhog: - image: 'mailhog/mailhog:latest' + mailpit: + image: 'axllent/mailpit:latest' volumes: mysql_data: diff --git a/composer.json b/composer.json index 5655a50..7670008 100644 --- a/composer.json +++ b/composer.json @@ -8,32 +8,35 @@ ], "license": "MIT", "require": { - "php": "^8.1", + "php": "^8.2", "doctrine/dbal": "^2.7 || ^3.0", "doctrine/migrations": "^3.0", "doctrine/orm": "^2.13", - "psr/log": "^2.0", - "sylius/mailer-bundle": "^1.8 || ^2.0", - "sylius/resource": "^1.9", - "sylius/resource-bundle": "^1.9", - "sylius/sylius": "^1.14", - "symfony/config": "^5.4 || ^6.0", - "symfony/console": "^5.4 || ^6.0", - "symfony/dependency-injection": "^5.4 || ^6.0", - "symfony/form": "^5.4 || ^6.0", - "symfony/framework-bundle": "^5.4 || ^6.0", - "symfony/http-foundation": "^5.4 || ^6.0", - "symfony/http-kernel": "^5.4 || ^6.0", - "symfony/options-resolver": "^5.4 || ^6.0", - "symfony/routing": "^5.4 || ^6.0", - "symfony/translation-contracts": "^2.0", - "symfony/validator": "^5.4 || ^6.0", - "symfony/webpack-encore-bundle": "^1.15", + "psr/log": "^3.0", + "sylius/mailer-bundle": "^2.1", + "sylius/resource": "^1.12", + "sylius/resource-bundle": "^1.12", + "sylius/sylius": "^2.0", + "sylius/twig-hooks": "^0.8", + "symfony/config": "^6.4 || ^7.3", + "symfony/console": "^6.4 || ^7.3", + "symfony/dependency-injection": "^6.4 || ^7.3", + "symfony/form": "^6.4 || ^7.3", + "symfony/framework-bundle": "^6.4 || ^7.3", + "symfony/http-foundation": "^6.4 || ^7.3", + "symfony/http-kernel": "^6.4 || ^7.3", + "symfony/options-resolver": "^6.4 || ^7.3", + "symfony/routing": "^6.4 || ^7.3", + "symfony/translation-contracts": "^3.3", + "symfony/ux-live-component": "^2.7", + "symfony/ux-twig-component": "^2.7", + "symfony/validator": "^6.4 || ^7.3", + "symfony/webpack-encore-bundle": "^2.2", "twig/twig": "^2.0 || ^3.0", "webmozart/assert": "^1.10" }, "require-dev": { - "behat/behat": "^3.6.1", + "behat/behat": "^3.14", "behat/mink-selenium2-driver": "^1.6", "dbrekelmans/bdi": "^1.1", "dmore/behat-chrome-extension": "^1.3", @@ -46,7 +49,6 @@ "friends-of-behat/suite-settings-extension": "^1.0", "friends-of-behat/symfony-extension": "^2.1", "friends-of-behat/variadic-extension": "^1.3", - "phpspec/phpspec": "^7.2", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.8.1", "phpstan/phpstan-doctrine": "1.3.37", @@ -55,16 +57,17 @@ "phpunit/phpunit": "^9.6 || ^10.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "rector/rector": "^0.15.0", - "robertfausk/behat-panther-extension": "^1.1", + "robertfausk/behat-panther-extension": "^1.2", "sylius-labs/coding-standard": "^4.2", "sylius-labs/suite-tags-extension": "^0.2", - "symfony/browser-kit": "^5.4 || ^6.0", - "symfony/debug-bundle": "^5.4 || ^6.0", - "symfony/dotenv": "^5.4 || ^6.0", + "sylius/test-application": "^2.0.0@alpha", + "symfony/browser-kit": "^6.4 || ^7.3", + "symfony/debug-bundle": "^6.4 || ^7.3", + "symfony/dotenv": "^6.4 || ^7.3", "symfony/flex": "^2.2.2", - "symfony/intl": "^5.4 || ^6.0", - "symfony/web-profiler-bundle": "^5.4 || ^6.0", - "vimeo/psalm": "^5.9" + "symfony/intl": "^6.4 || ^7.3", + "symfony/web-profiler-bundle": "^6.4 || ^7.3", + "vimeo/psalm": "^6.13" }, "conflict": { "symfony/framework-bundle": "6.2.8" @@ -73,6 +76,7 @@ "sort-packages": true, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, + "php-http/discovery": true, "phpstan/extension-installer": true, "symfony/flex": true, "symfony/runtime": true, @@ -81,10 +85,11 @@ }, "extra": { "branch-alias": { - "dev-master": "1.14-dev" + "dev-master": "2.0-dev" }, + "public-dir": "vendor/sylius/test-application/public", "symfony": { - "require": "^5.4 || ^6.0" + "require": "^7.3" } }, "autoload": { @@ -94,11 +99,9 @@ }, "autoload-dev": { "psr-4": { - "Tests\\Webgriffe\\SyliusBackInStockNotificationPlugin\\": "tests/" - }, - "classmap": [ - "tests/Application/Kernel.php" - ] + "Tests\\Webgriffe\\SyliusBackInStockNotificationPlugin\\": "tests/", + "Tests\\Webgriffe\\SyliusBackInStockNotificationPlugin\\TestApplication\\": "tests/TestApplication/src" + } }, "scripts": { "auto-scripts": { diff --git a/config/doctrine/Subscription.orm.xml b/config/doctrine/Subscription.orm.xml index 7645c27..6042d01 100644 --- a/config/doctrine/Subscription.orm.xml +++ b/config/doctrine/Subscription.orm.xml @@ -1,6 +1,7 @@ @@ -17,9 +18,12 @@ - - - + + + + + + diff --git a/config/packages.yaml b/config/packages.yaml index 6917471..753f7a6 100644 --- a/config/packages.yaml +++ b/config/packages.yaml @@ -2,4 +2,4 @@ imports: - { resource: "@WebgriffeSyliusBackInStockNotificationPlugin/config/packages/sylius_grid.yaml" } - { resource: "@WebgriffeSyliusBackInStockNotificationPlugin/config/packages/sylius_mailer.yaml" } - { resource: "@WebgriffeSyliusBackInStockNotificationPlugin/config/packages/sylius_resource.yaml" } - - { resource: "@WebgriffeSyliusBackInStockNotificationPlugin/config/packages/sylius_ui.yaml" } + - { resource: "@WebgriffeSyliusBackInStockNotificationPlugin/config/twig_hooks/**/*.yaml" } diff --git a/config/packages/sylius_grid.yaml b/config/packages/sylius_grid.yaml index 419784e..cc6727c 100644 --- a/config/packages/sylius_grid.yaml +++ b/config/packages/sylius_grid.yaml @@ -1,7 +1,7 @@ sylius_grid: templates: action: - customer_details: "@WebgriffeSyliusBackInStockNotificationPlugin/Admin/customerDetails.html.twig" + customer_details: "@WebgriffeSyliusBackInStockNotificationPlugin/admin/subscription/grid/action/customer.html.twig" grids: webgriffe_admin_notification_subscription: @@ -15,7 +15,9 @@ sylius_grid: label: sylius.ui.image path: productVariant.product options: - template: "@SyliusAdmin/Product/Grid/Field/image.html.twig" + template: "@SyliusAdmin/product/grid/field/product_image.html.twig" + vars: + th_class: "w-1" product_variant_code: type: string label: sylius.ui.code @@ -39,7 +41,7 @@ sylius_grid: type: twig label: sylius.ui.state options: - template: "@WebgriffeSyliusBackInStockNotificationPlugin/Admin/Grid/Field/notify.html.twig" + template: "@WebgriffeSyliusBackInStockNotificationPlugin/admin/subscription/grid/field/notify.html.twig" filters: email: type: string @@ -93,7 +95,7 @@ sylius_grid: label: sylius.ui.product path: productVariant options: - template: "@WebgriffeSyliusBackInStockNotificationPlugin/MyAccount/productCell.html.twig" + template: "@WebgriffeSyliusBackInStockNotificationPlugin/shop/account/subscription/grid/field/product.html.twig" product_variant_code: type: string label: sylius.ui.code @@ -102,7 +104,7 @@ sylius_grid: type: twig label: sylius.ui.state options: - template: "@WebgriffeSyliusBackInStockNotificationPlugin/MyAccount/notify.html.twig" + template: "@WebgriffeSyliusBackInStockNotificationPlugin/shop/account/subscription/grid/field/notify.html.twig" created_at: type: datetime label: sylius.ui.date @@ -113,4 +115,4 @@ sylius_grid: path: hash label: sylius.ui.action options: - template: "@WebgriffeSyliusBackInStockNotificationPlugin/MyAccount/deleteCell.html.twig" + template: "@WebgriffeSyliusBackInStockNotificationPlugin/shop/account/subscription/grid/field/delete.html.twig" diff --git a/config/packages/sylius_mailer.yaml b/config/packages/sylius_mailer.yaml index 990c318..568f667 100644 --- a/config/packages/sylius_mailer.yaml +++ b/config/packages/sylius_mailer.yaml @@ -1,6 +1,6 @@ sylius_mailer: emails: webgriffe_back_in_stock_notification_success_subscription: - template: "@WebgriffeSyliusBackInStockNotificationPlugin/Email/successSubscription.html.twig" + template: "@WebgriffeSyliusBackInStockNotificationPlugin/email/success_subscription.html.twig" webgriffe_back_in_stock_notification_alert: - template: "@WebgriffeSyliusBackInStockNotificationPlugin/Email/notificationAlert.html.twig" + template: "@WebgriffeSyliusBackInStockNotificationPlugin/email/notification_alert.html.twig" diff --git a/config/packages/sylius_resource.yaml b/config/packages/sylius_resource.yaml index 5beba1c..b28863f 100644 --- a/config/packages/sylius_resource.yaml +++ b/config/packages/sylius_resource.yaml @@ -5,3 +5,4 @@ sylius_resource: classes: model: Webgriffe\SyliusBackInStockNotificationPlugin\Entity\Subscription repository: Webgriffe\SyliusBackInStockNotificationPlugin\Repository\SubscriptionRepository + factory: Webgriffe\SyliusBackInStockNotificationPlugin\Factory\SubscriptionFactory diff --git a/config/packages/sylius_ui.yaml b/config/packages/sylius_ui.yaml deleted file mode 100644 index fcf7830..0000000 --- a/config/packages/sylius_ui.yaml +++ /dev/null @@ -1,11 +0,0 @@ -sylius_ui: - events: - sylius.shop.product.show.right_sidebar: - blocks: - webgriffe_bisn_add_subscription: '@WebgriffeSyliusBackInStockNotificationPlugin/_addSubscription.html.twig' - sylius.shop.product.show.add_to_cart_form: - blocks: - webgriffe_bisn_add_subscription: '@WebgriffeSyliusBackInStockNotificationPlugin/_configurableButton.html.twig' - sylius.shop.layout.after_body: - blocks: - webgriffe_bisn_add_javascript: '@WebgriffeSyliusBackInStockNotificationPlugin/_javascript.html.twig' diff --git a/config/routing/admin_routing.yaml b/config/routing/admin_routing.yaml index aa86ed9..ce4adbd 100644 --- a/config/routing/admin_routing.yaml +++ b/config/routing/admin_routing.yaml @@ -3,12 +3,10 @@ webgriffe_admin_notification_subscription: alias: webgriffe.back_in_stock_notification_subscription section: admin path: subscriptions - templates: "@SyliusAdmin\\Crud" + templates: "@SyliusAdmin\\shared\\crud" redirect: update grid: webgriffe_admin_notification_subscription vars: all: - subheader: webgriffe_bisn.admin.subscriptions_subtitle - index: - icon: 'bell' + hook_prefix: 'webgriffe_sylius_back_in_stock_notification_plugin.admin.notification_subscription' type: sylius.resource diff --git a/config/routing/shop_routing.yaml b/config/routing/shop_routing.yaml index a5831b6..28c5865 100644 --- a/config/routing/shop_routing.yaml +++ b/config/routing/shop_routing.yaml @@ -1,9 +1,3 @@ -webgriffe_back_in_stock_notification_add_subscription: - path: /back-in-stock-notification/add-subscription - methods: [ GET, POST ] - defaults: - _controller: Webgriffe\SyliusBackInStockNotificationPlugin\Controller\SubscriptionController::addAction - webgriffe_back_in_stock_notification_delete_subscription: path: /back-in-stock-notification/delete-subscription/{hash} methods: [ GET ] @@ -17,5 +11,5 @@ webgriffe_back_in_stock_notification_account_list_subscriptions: _controller: webgriffe.controller.back_in_stock_notification_subscription::indexAction _sylius: section: shop_account - template: "@WebgriffeSyliusBackInStockNotificationPlugin/MyAccount/index.html.twig" + template: "@WebgriffeSyliusBackInStockNotificationPlugin/shop/account/subscription/index.html.twig" grid: webgriffe_back_in_stock_notification_account_list_subscriptions diff --git a/config/services.yaml b/config/services.yaml index 15f2d17..5028695 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -4,7 +4,7 @@ services: arguments: - '@monolog.logger' - '@sylius.email_sender' - - '@sylius.availability_checker.default' + - '@sylius.checker.inventory.availability' - '@webgriffe.repository.back_in_stock_notification_subscription' - '@router' @@ -13,15 +13,8 @@ services: calls: - [ setContainer, [ '@service_container' ] ] arguments: - - '@sylius.context.channel.cached' - '@translator' - - '@sylius.context.customer' - - '@sylius.availability_checker.default' - - '@sylius.repository.product_variant' - - '@sylius.email_sender' - - '@sylius.context.locale' - '@webgriffe.repository.back_in_stock_notification_subscription' - - '@webgriffe.factory.back_in_stock_notification_subscription' Webgriffe\SyliusBackInStockNotificationPlugin\Menu\AccountMenuListener: tags: @@ -31,15 +24,6 @@ services: tags: - { name: kernel.event_listener, event: sylius.menu.admin.main, method: addAdminMenuItems } - Webgriffe\SyliusBackInStockNotificationPlugin\Twig\AvailabilityExtension: - tags: - - { name: twig.extension } - - Webgriffe\SyliusBackInStockNotificationPlugin\Twig\AvailabilityRuntime: - arguments: - - '@sylius.availability_checker.default' - tags: - - { name: twig.runtime } Webgriffe\SyliusBackInStockNotificationPlugin\Validator\SubscriptionUniqueValidator: arguments: @@ -48,3 +32,24 @@ services: - '@sylius.context.customer' tags: - { name: validator.constraint_validator } + + Webgriffe\SyliusBackInStockNotificationPlugin\Processor\SubscriptionProcessor: + arguments: + - '@webgriffe.factory.back_in_stock_notification_subscription' + - '@webgriffe.repository.back_in_stock_notification_subscription' + - '@sylius.context.channel.cached' + - '@sylius.context.locale' + - '@sylius.email_sender' + + webgriffe.processor.subscription: '@Webgriffe\SyliusBackInStockNotificationPlugin\Processor\SubscriptionProcessor' + + Webgriffe\SyliusBackInStockNotificationPlugin\Twig\Component\AddNotificationComponent: + arguments: + - '@form.factory' + - '@sylius.resolver.product_variant' + - '@sylius.context.customer' + - '@Webgriffe\SyliusBackInStockNotificationPlugin\Processor\SubscriptionProcessor' + - '@sylius.repository.product' + - '@sylius.repository.product_variant' + tags: + - { name: 'sylius.live_component.shop', key: 'webgriffe:sylius_shop:product:add_notification' } diff --git a/config/twig_hooks/shop/account/subscription/index.yaml b/config/twig_hooks/shop/account/subscription/index.yaml new file mode 100644 index 0000000..ad4ede7 --- /dev/null +++ b/config/twig_hooks/shop/account/subscription/index.yaml @@ -0,0 +1,22 @@ +sylius_twig_hooks: + hooks: + 'webgriffe_sylius_back_in_stock_notification_plugin.shop.account.subscription.index.content': + breadcrumbs: + template: '@WebgriffeSyliusBackInStockNotificationPlugin/shop/account/subscription/index/content/breadcrumbs.html.twig' + priority: 200 + menu: + template: '@SyliusShop/account/common/content/menu.html.twig' + priority: 100 + main: + template: '@SyliusShop/account/common/content/main.html.twig' + priority: 0 + + 'webgriffe_sylius_back_in_stock_notification_plugin.shop.account.subscription.index.content.main': + grid: + template: '@SyliusShop/shared/grid.html.twig' + priority: 0 + + 'webgriffe_sylius_back_in_stock_notification_plugin.shop.account.subscription.index.content.main.header': + title: + template: '@WebgriffeSyliusBackInStockNotificationPlugin/shop/account/subscription/index/content/main/header/title.html.twig' + priority: 0 diff --git a/config/twig_hooks/shop/product/show.yaml b/config/twig_hooks/shop/product/show.yaml new file mode 100644 index 0000000..42dd56c --- /dev/null +++ b/config/twig_hooks/shop/product/show.yaml @@ -0,0 +1,9 @@ +sylius_twig_hooks: + hooks: + 'sylius_shop.product.show.content.info.summary': + add_notification: + component: 'webgriffe:sylius_shop:product:add_notification' + props: + product: '@=_context.product' + template: '@WebgriffeSyliusBackInStockNotificationPlugin/shop/product/show/content/info/summary/add_notification.html.twig' + priority: 50 diff --git a/docs/admin_account_section.png b/docs/admin_account_section.png new file mode 100644 index 0000000..c23ee02 Binary files /dev/null and b/docs/admin_account_section.png differ diff --git a/docs/my_account_section.png b/docs/my_account_section.png new file mode 100644 index 0000000..2e9c87f Binary files /dev/null and b/docs/my_account_section.png differ diff --git a/docs/product.png b/docs/product.png new file mode 100644 index 0000000..621402d Binary files /dev/null and b/docs/product.png differ diff --git a/features/subscribe_to_notification_for_simple_product.feature b/features/subscribe_to_notification_for_simple_product.feature index 747a34c..fc7c190 100644 --- a/features/subscribe_to_notification_for_simple_product.feature +++ b/features/subscribe_to_notification_for_simple_product.feature @@ -9,7 +9,7 @@ Feature: Ability to get notified for a specific product when it will be back in And the store has a product "Knitted cap apple" And the product "Knitted cap apple" is out of stock - @ui + @ui @javascript Scenario: Being able to subscribe to the alert list for the out of stock product as logged customer Given there is a customer "Francis Underwood" identified by an email "francis@underwood.com" and a password "whitehouse" And I am logged in as "francis@underwood.com" @@ -18,9 +18,9 @@ Feature: Ability to get notified for a specific product when it will be back in Then I should be notified that the email is subscribed correctly And an email with a success message should be sent to "francis@underwood.com" - @ui + @ui @javascript Scenario: Being able to subscribe to the alert list for the out of stock product When I view product "Knitted cap apple" And I subscribe to the alert list for the product "Knitted cap apple" with the email "ted@example.com" Then I should be notified that the email is subscribed correctly - And an email with a success message should be sent to "ted@example.com" \ No newline at end of file + And an email with a success message should be sent to "ted@example.com" diff --git a/my_account_section.png b/my_account_section.png deleted file mode 100644 index 43463c1..0000000 Binary files a/my_account_section.png and /dev/null differ diff --git a/node_modules b/node_modules index 9270531..f802bac 120000 --- a/node_modules +++ b/node_modules @@ -1 +1 @@ -tests/Application/node_modules \ No newline at end of file +vendor/sylius/test-application/node_modules \ No newline at end of file diff --git a/phpspec.yml.dist b/phpspec.yml.dist deleted file mode 100644 index 2bc3656..0000000 --- a/phpspec.yml.dist +++ /dev/null @@ -1,4 +0,0 @@ -suites: - main: - namespace: Webgriffe\SyliusBackInStockNotificationPlugin - psr4_prefix: Webgriffe\SyliusBackInStockNotificationPlugin diff --git a/phpunit.xml.dist b/phpunit.xml.dist index dac49e5..578dbb7 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -3,7 +3,7 @@ + bootstrap="vendor/sylius/test-application/config/bootstrap.php"> tests @@ -13,9 +13,9 @@ - + diff --git a/psalm.xml b/psalm.xml index b416d15..5c4cb1f 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,7 +1,6 @@ - + - + + - - + + - + - + + + + + + + + + + + diff --git a/public/js/back-in-stock-notification.js b/public/js/back-in-stock-notification.js deleted file mode 100644 index 93241b5..0000000 --- a/public/js/back-in-stock-notification.js +++ /dev/null @@ -1,104 +0,0 @@ -document.addEventListener("DOMContentLoaded", function (event) { - function getSelectedVariantCode() { - const syliusVariantsStock = document.querySelector('#sylius-variants-stock') - const formData = new FormData(document.querySelector('#sylius-product-adding-to-cart')) - let productVariantCode = formData.get('sylius_add_to_cart[cartItem][variant]') - if (!productVariantCode) { - // handle the case variant selection -> option matching - let variants = Array.from(syliusVariantsStock.children) - for (let optionCode of JSON.parse(syliusVariantsStock.dataset.optionCode)) { - let optionValueSelected = formData.get(`sylius_add_to_cart[cartItem][variant][${optionCode}]`) - variants = variants.filter((variant) => JSON.parse(variant.dataset.optionsValue).includes(optionValueSelected)) - } - if (variants.length === 1) { - productVariantCode = variants[0].dataset.variantCode - } - } - return productVariantCode; - } - - function renderNotifyMeBtn() { - const selectedVariant = document.querySelector(`#sylius-variants-stock [data-variant-code="${getSelectedVariantCode()}"]`) - if (selectedVariant) { - const notifyMeBtn = document.querySelector('#trigger-notification-overlay'); - const addToCartBtn = document.querySelector('#sylius-product-adding-to-cart button[type="submit"]'); - if (selectedVariant.dataset.available) { - notifyMeBtn.style.display = 'none'; - addToCartBtn.style.display = 'block'; - } else { - notifyMeBtn.style.display = 'block'; - addToCartBtn.style.display = 'none'; - } - } - } - - const notificationTrigger = document.querySelector('#trigger-notification-overlay') - if (notificationTrigger) { - notificationTrigger.onclick = function () { - jQuery('#notification-overlay').modal('show') - document.querySelector('input[back-in-stock-notification-plugin-variant-code-input][type="hidden"]').value = getSelectedVariantCode() - } - } - - const addToCartBtn = document.querySelector('#sylius-product-adding-to-cart') - if (addToCartBtn) { - addToCartBtn.onchange = renderNotifyMeBtn - renderNotifyMeBtn() - } - - function subscribeToBackInStockNotification(container) { - const form = container.querySelector('form') - - const submitFormThroughAjax = e => { - e.preventDefault() - - const formAction = form.getAttribute('action') - fetch(formAction, { - method: form.getAttribute('method'), - headers: { - 'X-Requested-With': 'XMLHttpRequest', - Accept: 'text/html', - }, - body: new FormData(form), - cache: 'no-cache', - redirect: 'follow', - }) - .then(response => { - // Response has been redirected to a new URL, - // follow the redirect by changing the current browser page - if (response.redirected) { - window.location.href = response.url - } - - return response.text() - }) - .then(htmlResponse => { - container.innerHTML = htmlResponse - }) - .catch((e) => { - console.error(e, e.options) - }) - } - - form.addEventListener('submit', submitFormThroughAjax) - } - - const container = document.querySelector('[data-back-in-stock-notification-form-container]') - - const observer = new MutationObserver((mutationList, observer) => { - for (const mutation of mutationList) { - if (mutation.type === "childList") { - for (const node of mutation.addedNodes) { - if (node.nodeType === 1 && node.parentNode.getAttribute('data-back-in-stock-notification-form-container')) { - subscribeToBackInStockNotification(container) - } - } - } - } - }); - - if (container) { - observer.observe(container, { attributes: false, childList: true, subtree: true }); - subscribeToBackInStockNotification(container) - } -}) diff --git a/simple_product.png b/simple_product.png deleted file mode 100644 index 4d58bd6..0000000 Binary files a/simple_product.png and /dev/null differ diff --git a/src/Command/AlertCommand.php b/src/Command/AlertCommand.php index bcf898b..db3dacf 100644 --- a/src/Command/AlertCommand.php +++ b/src/Command/AlertCommand.php @@ -9,6 +9,7 @@ use Sylius\Component\Core\Model\ProductVariantInterface; use Sylius\Component\Inventory\Checker\AvailabilityCheckerInterface; use Sylius\Component\Mailer\Sender\SenderInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -16,10 +17,12 @@ use Webgriffe\SyliusBackInStockNotificationPlugin\Entity\SubscriptionInterface; use Webgriffe\SyliusBackInStockNotificationPlugin\Repository\SubscriptionRepositoryInterface; +#[AsCommand( + name: 'webgriffe:back-in-stock-notification:alert', + description: 'Send an email to the user if the product is returned in stock', +)] final class AlertCommand extends Command { - protected static $defaultName = 'webgriffe:back-in-stock-notification:alert'; - public function __construct( private LoggerInterface $logger, private SenderInterface $sender, @@ -34,7 +37,6 @@ public function __construct( protected function configure(): void { $this - ->setDescription('Send an email to the user if the product is returned in stock') ->setHelp('Check the stock status of the products in the webgriffe_back_in_stock_notification table and send and email to the user if the product is returned in stock') ; } @@ -76,6 +78,7 @@ private function sendEmail( ProductVariantInterface $productVariant, ChannelInterface $channel, ): void { + /** @psalm-suppress DeprecatedMethod */ $this->sender->send( 'webgriffe_back_in_stock_notification_alert', [$subscription->getEmail()], diff --git a/src/Controller/SubscriptionController.php b/src/Controller/SubscriptionController.php index a821f9e..594e2f7 100644 --- a/src/Controller/SubscriptionController.php +++ b/src/Controller/SubscriptionController.php @@ -4,92 +4,23 @@ namespace Webgriffe\SyliusBackInStockNotificationPlugin\Controller; -if (!interface_exists(\Sylius\Resource\Factory\FactoryInterface::class)) { - class_alias(\Sylius\Component\Resource\Factory\FactoryInterface::class, \Sylius\Resource\Factory\FactoryInterface::class); -} -use DateTime; -use Sylius\Component\Channel\Context\ChannelContextInterface; -use Sylius\Component\Core\Model\ProductVariantInterface; -use Sylius\Component\Core\Repository\ProductVariantRepositoryInterface; -use Sylius\Component\Customer\Context\CustomerContextInterface; -use Sylius\Component\Inventory\Checker\AvailabilityCheckerInterface; -use Sylius\Component\Locale\Context\LocaleContextInterface; -use Sylius\Component\Mailer\Sender\SenderInterface; -use Sylius\Resource\Factory\FactoryInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Contracts\Translation\TranslatorInterface; -use Webgriffe\SyliusBackInStockNotificationPlugin\Entity\SubscriptionInterface; -use Webgriffe\SyliusBackInStockNotificationPlugin\Form\SubscriptionType; use Webgriffe\SyliusBackInStockNotificationPlugin\Repository\SubscriptionRepositoryInterface; -use Webmozart\Assert\Assert; +/** + * @psalm-suppress PropertyNotSetInConstructor + */ final class SubscriptionController extends AbstractController { - /** - * @param FactoryInterface $backInStockNotificationFactory - */ public function __construct( - private ChannelContextInterface $channelContext, private TranslatorInterface $translator, - private CustomerContextInterface $customerContext, - private AvailabilityCheckerInterface $availabilityChecker, - private ProductVariantRepositoryInterface $productVariantRepository, - private SenderInterface $sender, - private LocaleContextInterface $localeContext, private SubscriptionRepositoryInterface $backInStockNotificationRepository, - private FactoryInterface $backInStockNotificationFactory, ) { } - public function addAction(Request $request): Response - { - $form = $this->createForm(SubscriptionType::class); - /** @var string|null $productVariantCode */ - $productVariantCode = $request->query->get('product_variant_code'); - if (is_string($productVariantCode)) { - $form->setData(['product_variant_code' => $productVariantCode]); - } - - $customer = $this->customerContext->getCustomer(); - if ($customer !== null && $customer->getEmail() !== null) { - $form->remove('email'); - } - - $form->handleRequest($request); - if ($form->isSubmitted() && $form->isValid()) { - /** @var array{email?: string, product_variant_code: string} $data */ - $data = $form->getData(); - $subscription = $this->createSubscriptionFromData($data); - - $this->backInStockNotificationRepository->add($subscription); - $this->sender->send( - 'webgriffe_back_in_stock_notification_success_subscription', - [$subscription->getEmail()], - [ - 'subscription' => $subscription, - 'channel' => $subscription->getChannel(), - 'localeCode' => $subscription->getLocaleCode(), - ], - [], - [], - ); - - $this->addFlash( - 'success', - $this->translator->trans('webgriffe_bisn.form_submission.subscription_successfully'), - ); - - return $this->redirect($this->getRefererUrl($request)); - } - - return $this->render( - '@WebgriffeSyliusBackInStockNotificationPlugin/productSubscriptionForm.html.twig', - ['form' => $form->createView()], - ); - } - public function deleteAction(Request $request, string $hash): Response { $subscription = $this->backInStockNotificationRepository->findOneBy(['hash' => $hash]); @@ -113,43 +44,4 @@ private function getRefererUrl(Request $request): string return $referer; } - - /** - * @param array{email?: string, product_variant_code: string} $data - */ - private function createSubscriptionFromData(array $data): SubscriptionInterface - { - $customer = $this->customerContext->getCustomer(); - $email = null; - $subscription = $this->backInStockNotificationFactory->createNew(); - if (array_key_exists('email', $data)) { - $email = $data['email']; - } - if ($customer !== null) { - $email = $customer->getEmail(); - } - Assert::stringNotEmpty($email); - $subscription->setEmail($email); - $subscription->setCustomer($customer); - - $productVariantCode = $data['product_variant_code']; - $productVariant = $this->productVariantRepository->findOneBy(['code' => $productVariantCode]); - Assert::isInstanceOf($productVariant, ProductVariantInterface::class); - Assert::false($this->availabilityChecker->isStockAvailable($productVariant), 'Product variant is in stock'); - $subscription->setProductVariant($productVariant); - - $subscription->setChannel($this->channelContext->getChannel()); - $subscription->setLocaleCode($this->localeContext->getLocaleCode()); - $now = new DateTime(); - $subscription->setCreatedAt($now); - $subscription->setUpdatedAt($now); - - //I generate a random string to handle the delete action of the subscription using a GET - //This way is easier and does not send sensible information - //see: https://paragonie.com/blog/2015/09/comprehensive-guide-url-parameter-encryption-in-php - $hash = strtr(base64_encode(random_bytes(9)), '+/', '-_'); - $subscription->setHash($hash); - - return $subscription; - } } diff --git a/src/Entity/Subscription.php b/src/Entity/Subscription.php index df500f0..42bb9f6 100644 --- a/src/Entity/Subscription.php +++ b/src/Entity/Subscription.php @@ -9,6 +9,9 @@ use Sylius\Component\Customer\Model\CustomerInterface; use Sylius\Component\Resource\Model\TimestampableTrait; +/** + * @psalm-suppress ClassMustBeFinal + */ class Subscription implements SubscriptionInterface { use TimestampableTrait; diff --git a/src/Factory/SubscriptionFactory.php b/src/Factory/SubscriptionFactory.php new file mode 100644 index 0000000..e831a97 --- /dev/null +++ b/src/Factory/SubscriptionFactory.php @@ -0,0 +1,52 @@ +className(); + Assert::isInstanceOf($subscription, SubscriptionInterface::class); + + $subscription->setChannel($channel); + $subscription->setProductVariant($productVariant); + $subscription->setEmail($email); + $subscription->setLocaleCode($localeCode); + $subscription->setCustomer($customer); + + //I generate a random string to handle the delete action of the subscription using a GET + //This way is easier and does not send sensible information + //see: https://paragonie.com/blog/2015/09/comprehensive-guide-url-parameter-encryption-in-php + $hash = strtr(base64_encode(random_bytes(9)), '+/', '-_'); + $subscription->setHash($hash); + + return $subscription; + } +} diff --git a/src/Factory/SubscriptionFactoryInterface.php b/src/Factory/SubscriptionFactoryInterface.php new file mode 100644 index 0000000..6732510 --- /dev/null +++ b/src/Factory/SubscriptionFactoryInterface.php @@ -0,0 +1,25 @@ + + */ +interface SubscriptionFactoryInterface extends FactoryInterface +{ + public function createWithData( + ChannelInterface $channel, + ProductVariantInterface $productVariant, + string $email, + string $localeCode, + ?CustomerInterface $customer, + ): SubscriptionInterface; +} diff --git a/src/Form/SubscriptionType.php b/src/Form/SubscriptionType.php index 4c60ddd..b1cc423 100644 --- a/src/Form/SubscriptionType.php +++ b/src/Form/SubscriptionType.php @@ -7,7 +7,6 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; -use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\Email; @@ -29,9 +28,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ], ]) ->add('product_variant_code', HiddenType::class) - ->add('submit', SubmitType::class, [ - 'label' => 'webgriffe_bisn.product_page.form_action', - ]) ; } diff --git a/src/Menu/AccountMenuListener.php b/src/Menu/AccountMenuListener.php index 2641a4a..5611c76 100644 --- a/src/Menu/AccountMenuListener.php +++ b/src/Menu/AccountMenuListener.php @@ -14,7 +14,7 @@ public function addMenuItems(MenuBuilderEvent $event): void ->getMenu() ->addChild('list_subscriptions', ['route' => 'webgriffe_back_in_stock_notification_account_list_subscriptions']) ->setLabel('webgriffe_bisn.my_account_section.menu_label') - ->setLabelAttribute('icon', 'bell') + ->setLabelAttribute('icon', 'tabler:bell') ; } } diff --git a/src/Menu/AdminMenuListener.php b/src/Menu/AdminMenuListener.php index eb6bd82..db89fb4 100644 --- a/src/Menu/AdminMenuListener.php +++ b/src/Menu/AdminMenuListener.php @@ -18,7 +18,7 @@ public function addAdminMenuItems(MenuBuilderEvent $event): void ['route' => 'webgriffe_admin_back_in_stock_notification_subscription_index'], ) ->setLabel('webgriffe_bisn.admin.menu_label') - ->setLabelAttribute('icon', 'bell') + ->setLabelAttribute('icon', 'tabler:bell') ; } } diff --git a/src/Processor/SubscriptionProcessor.php b/src/Processor/SubscriptionProcessor.php new file mode 100644 index 0000000..933ab21 --- /dev/null +++ b/src/Processor/SubscriptionProcessor.php @@ -0,0 +1,59 @@ +channelContext->getChannel(); + $localeCode = $this->localeContext->getLocaleCode(); + + $subscription = $this->subscriptionFactory->createWithData( + $channel, + $productVariant, + $email, + $localeCode, + $customer, + ); + + $this->backInStockNotificationRepository->add($subscription); + /** @psalm-suppress DeprecatedMethod */ + $this->sender->send( + 'webgriffe_back_in_stock_notification_success_subscription', + [$subscription->getEmail()], + [ + 'subscription' => $subscription, + 'channel' => $subscription->getChannel(), + 'localeCode' => $subscription->getLocaleCode(), + ], + [], + [], + ); + + return $subscription; + } +} diff --git a/src/Processor/SubscriptionProcessorInterface.php b/src/Processor/SubscriptionProcessorInterface.php new file mode 100644 index 0000000..452f707 --- /dev/null +++ b/src/Processor/SubscriptionProcessorInterface.php @@ -0,0 +1,17 @@ +availabilityChecker->isStockAvailable($productVariant); - } -} diff --git a/src/Twig/Component/AddNotificationComponent.php b/src/Twig/Component/AddNotificationComponent.php new file mode 100644 index 0000000..62ca8a2 --- /dev/null +++ b/src/Twig/Component/AddNotificationComponent.php @@ -0,0 +1,118 @@ +initializeProduct($productRepository); + $this->initializeProductVariant($productVariantRepository); + } + + protected function instantiateForm(): FormInterface + { + return $this->formFactory->create(SubscriptionType::class); + } + + #[PostMount] + public function postMount(): void + { + Assert::notNull($this->product); + + /** @var ProductVariantInterface|null $variant * */ + $variant = $this->productVariantResolver->getVariant($this->product); + + $this->variant = $variant; + + $customer = $this->customerContext->getCustomer(); + if ($customer !== null && $customer->getEmail() !== null) { + $this->isCustomerLoggedIn = true; + } + } + + #[LiveListener(AddToCartFormComponent::SYLIUS_SHOP_VARIANT_CHANGED)] + public function updateProductVariant(#[LiveArg] mixed $variantId): void + { + if (null === $variantId) { + $this->variant = null; + + return; + } + + $this->variant = $this->productVariantRepository->find($variantId); + } + + #[LiveAction] + public function addNotification(): void + { + $this->notificationSent = false; + $this->formValues['product_variant_code'] = $this->variant?->getCode(); + if ($this->isCustomerLoggedIn) { + $this->formValues['email'] = $this->customerContext->getCustomer()?->getEmail(); + } + $this->submitForm(); + + Assert::isInstanceOf($this->variant, ProductVariantInterface::class); + + $formData = $this->getForm()->getData(); + Assert::isArray($formData); + $email = $formData['email'] ?? null; + Assert::stringNotEmpty($email); + + $this->subscriptionProcessor->process( + $this->variant, + $email, + $this->customerContext->getCustomer(), + ); + + $this->notificationSent = true; + $this->resetForm(); + } +} diff --git a/src/Validator/SubscriptionUnique.php b/src/Validator/SubscriptionUnique.php index 482250c..19c50e4 100644 --- a/src/Validator/SubscriptionUnique.php +++ b/src/Validator/SubscriptionUnique.php @@ -13,7 +13,7 @@ final class SubscriptionUnique extends Constraint { public string $message = 'webgriffe_bisn.subscription.already_saved'; - public function getTargets(): string + public function getTargets(): string|array { return self::CLASS_CONSTRAINT; } diff --git a/subscriprion_process.gif b/subscriprion_process.gif deleted file mode 100644 index dd9b387..0000000 Binary files a/subscriprion_process.gif and /dev/null differ diff --git a/symfony.lock b/symfony.lock index 04ae53b..0ef8cfb 100644 --- a/symfony.lock +++ b/symfony.lock @@ -13,6 +13,20 @@ "src/Entity/.gitignore" ] }, + "api-platform/symfony": { + "version": "4.2", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "4.0", + "ref": "e9952e9f393c2d048f10a78f272cd35e807d972b" + }, + "files": [ + "config/packages/api_platform.yaml", + "config/routes/api_platform.yaml", + "src/ApiResource/.gitignore" + ] + }, "babdev/pagerfanta-bundle": { "version": "v3.8.0" }, @@ -128,6 +142,18 @@ "ref": "d1227d002b70d1a1f941d91845fcd7ac7fbfc929" } }, + "nelmio/alice": { + "version": "3.14", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "3.3", + "ref": "42b52d2065dc3fde27912d502c18ca1926e35ae2" + }, + "files": [ + "config/packages/nelmio_alice.yaml" + ] + }, "nyholm/psr7": { "version": "1.8", "recipe": { @@ -149,6 +175,18 @@ "ref": "518ac22defa04a8a1d82479ed362e2921487adf0" } }, + "php-http/discovery": { + "version": "1.20", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.18", + "ref": "f45b5dd173a27873ab19f5e3180b2f661c21de02" + }, + "files": [ + "config/packages/http_discovery.yaml" + ] + }, "phpstan/phpstan": { "version": "1.10", "recipe": { @@ -244,6 +282,24 @@ "sylius/theme-bundle": { "version": "v2.3.0" }, + "sylius/twig-extra": { + "version": "0.8", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "0.4", + "ref": "00e1c7f2e97de7b0d990e507e1541fd05d4cdbfe" + } + }, + "sylius/twig-hooks": { + "version": "0.8", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "0.4", + "ref": "42a2dc11276d447efefa639b95f9c7a4edd7031a" + } + }, "symfony/console": { "version": "6.0", "recipe": { @@ -280,6 +336,18 @@ ".env" ] }, + "symfony/form": { + "version": "7.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "7.2", + "ref": "7d86a6723f4a623f59e2bf966b6aad2fc461d36b" + }, + "files": [ + "config/packages/csrf.yaml" + ] + }, "symfony/framework-bundle": { "version": "6.0", "recipe": { @@ -344,6 +412,18 @@ "ref": "673836afb0eac2b0ec36c44f2ff0379e5a4b2177" } }, + "symfony/property-info": { + "version": "7.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "7.3", + "ref": "dae70df71978ae9226ae915ffd5fad817f5ca1f7" + }, + "files": [ + "config/packages/property_info.yaml" + ] + }, "symfony/routing": { "version": "6.0", "recipe": { @@ -369,6 +449,21 @@ "config/packages/security.yaml" ] }, + "symfony/stimulus-bundle": { + "version": "2.31", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "2.20", + "ref": "c30f782a8910ae9f12e7a1399db607d172d23da6" + }, + "files": [ + "assets/bootstrap.js", + "assets/controllers.json", + "assets/controllers/csrf_protection_controller.js", + "assets/controllers/hello_controller.js" + ] + }, "symfony/translation": { "version": "6.0", "recipe": { @@ -395,6 +490,63 @@ "templates/base.html.twig" ] }, + "symfony/uid": { + "version": "7.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "7.0", + "ref": "0df5844274d871b37fc3816c57a768ffc60a43a5" + } + }, + "symfony/ux-autocomplete": { + "version": "2.31", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "2.6", + "ref": "07d9602b7231ba355f484305d6cea58310c01741" + }, + "files": [ + "config/routes/ux_autocomplete.yaml" + ] + }, + "symfony/ux-icons": { + "version": "2.31", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "2.17", + "ref": "803a3bbd5893f9584969ab8670290cdfb6a0a5b5" + }, + "files": [ + "assets/icons/symfony.svg" + ] + }, + "symfony/ux-live-component": { + "version": "2.31", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "2.6", + "ref": "b7130b7b5ddc2f8994bd6149d7c093b184782f0c" + }, + "files": [ + "config/routes/ux_live_component.yaml" + ] + }, + "symfony/ux-twig-component": { + "version": "2.31", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "2.13", + "ref": "f367ae2a1faf01c503de2171f1ec22567febeead" + }, + "files": [ + "config/packages/twig_component.yaml" + ] + }, "symfony/validator": { "version": "6.0", "recipe": { @@ -451,6 +603,18 @@ "config/packages/workflow.yaml" ] }, + "theofidry/alice-data-fixtures": { + "version": "1.7", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.0", + "ref": "fe5a50faf580eb58f08ada2abe8afbd2d4941e05" + } + }, + "twig/extra-bundle": { + "version": "v3.22.0" + }, "willdurand/hateoas-bundle": { "version": "2.5", "recipe": { diff --git a/templates/Admin/Grid/Field/notify.html.twig b/templates/Admin/Grid/Field/notify.html.twig deleted file mode 100644 index 8abb18f..0000000 --- a/templates/Admin/Grid/Field/notify.html.twig +++ /dev/null @@ -1,11 +0,0 @@ -{% if data %} - - - {{ 'webgriffe_bisn.admin.notified'|trans }} - -{% else %} - - - {{ 'webgriffe_bisn.admin.not-notified'|trans }} - -{% endif %} diff --git a/templates/Admin/customerDetails.html.twig b/templates/Admin/customerDetails.html.twig deleted file mode 100644 index 1c39f98..0000000 --- a/templates/Admin/customerDetails.html.twig +++ /dev/null @@ -1,7 +0,0 @@ -{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %} - -{% if options.link.data.customer is not null %} - {% set path = path(options.link.route, {'id': options.link.data.customer.id}) %} - - {{ buttons.show(path, action.label) }} -{% endif %} diff --git a/templates/MyAccount/deleteCell.html.twig b/templates/MyAccount/deleteCell.html.twig deleted file mode 100644 index f1956b1..0000000 --- a/templates/MyAccount/deleteCell.html.twig +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file diff --git a/templates/MyAccount/index.html.twig b/templates/MyAccount/index.html.twig deleted file mode 100644 index 1ff279d..0000000 --- a/templates/MyAccount/index.html.twig +++ /dev/null @@ -1,17 +0,0 @@ -{% extends '@SyliusShop/Account/layout.html.twig' %} - -{% block title %}{{ 'webgriffe_bisn.my_account_section.title'|trans }} - {{ parent() }}{% endblock %} - -{% block breadcrumb %} - -{% endblock %} - -{% block subcontent %} - {{ sylius_grid_render(resources, '@SyliusShop/Grid/_default.html.twig') }} -{% endblock %} diff --git a/templates/MyAccount/notify.html.twig b/templates/MyAccount/notify.html.twig deleted file mode 100644 index 8abb18f..0000000 --- a/templates/MyAccount/notify.html.twig +++ /dev/null @@ -1,11 +0,0 @@ -{% if data %} - - - {{ 'webgriffe_bisn.admin.notified'|trans }} - -{% else %} - - - {{ 'webgriffe_bisn.admin.not-notified'|trans }} - -{% endif %} diff --git a/templates/_addSubscription.html.twig b/templates/_addSubscription.html.twig deleted file mode 100644 index bf3e259..0000000 --- a/templates/_addSubscription.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{# @var \Sylius\Component\Core\Model\ProductInterface product #} -{# @var \Sylius\Component\Core\Model\ProductVariantInterface variant #} - -{% set variant = product|sylius_resolve_variant %} - -{% if product.isConfigurable %} - -{% elseif not is_product_variant_available(variant) %} - {% set url = url('webgriffe_back_in_stock_notification_add_subscription', {'product_variant_code': variant.code}) %} -
- {{ render(url) }} -
-{% endif %} diff --git a/templates/_configurableButton.html.twig b/templates/_configurableButton.html.twig deleted file mode 100644 index e89fcc1..0000000 --- a/templates/_configurableButton.html.twig +++ /dev/null @@ -1,13 +0,0 @@ -{% if product.isConfigurable %} -
- {% for variant in product.variants %} -
- {% endfor %} -
- -{% endif %} diff --git a/templates/admin/subscription/grid/action/customer.html.twig b/templates/admin/subscription/grid/action/customer.html.twig new file mode 100644 index 0000000..d21e1ba --- /dev/null +++ b/templates/admin/subscription/grid/action/customer.html.twig @@ -0,0 +1,7 @@ +{% if options.link.data.customer is not null %} + {% set path = path(options.link.route, {'id': options.link.data.customer.id}) %} + + + {{ ux_icon(action.icon|default('tabler:user')) }} + +{% endif %} diff --git a/templates/admin/subscription/grid/field/notify.html.twig b/templates/admin/subscription/grid/field/notify.html.twig new file mode 100644 index 0000000..610c644 --- /dev/null +++ b/templates/admin/subscription/grid/field/notify.html.twig @@ -0,0 +1,11 @@ +{% if data %} + + {{ ux_icon('tabler:bell', {class: 'icon icon-sm'}) }} + {{ 'webgriffe_bisn.admin.notified'|trans }} + +{% else %} + + {{ ux_icon('tabler:bell', {class: 'icon icon-sm'}) }} + {{ 'webgriffe_bisn.admin.not-notified'|trans }} + +{% endif %} diff --git a/templates/Email/notificationAlert.html.twig b/templates/email/notification_alert.html.twig similarity index 95% rename from templates/Email/notificationAlert.html.twig rename to templates/email/notification_alert.html.twig index d7c29b9..afafaa9 100644 --- a/templates/Email/notificationAlert.html.twig +++ b/templates/email/notification_alert.html.twig @@ -1,4 +1,4 @@ -{% extends '@SyliusShop/Email/layout.html.twig' %} +{% extends '@SyliusShop/email/layout.html.twig' %} {% block subject %}{{ 'webgriffe_bisn.alert_email.alert_title'|trans({}, null, localeCode) }}{% endblock %} diff --git a/templates/Email/successSubscription.html.twig b/templates/email/success_subscription.html.twig similarity index 95% rename from templates/Email/successSubscription.html.twig rename to templates/email/success_subscription.html.twig index 84af477..e799cce 100644 --- a/templates/Email/successSubscription.html.twig +++ b/templates/email/success_subscription.html.twig @@ -1,4 +1,4 @@ -{% extends '@SyliusShop/Email/layout.html.twig' %} +{% extends '@SyliusShop/email/layout.html.twig' %} {% block subject %}{{ 'webgriffe_bisn.subscription_mail.subscription_title'|trans({}, null, localeCode) }}{% endblock %} diff --git a/templates/productSubscriptionForm.html.twig b/templates/productSubscriptionForm.html.twig deleted file mode 100644 index 72383d7..0000000 --- a/templates/productSubscriptionForm.html.twig +++ /dev/null @@ -1,27 +0,0 @@ -{% form_theme form '@SyliusShop/Form/theme.html.twig' %} - -
-

{{ 'webgriffe_bisn.product_page.stock_notify_title'|trans }}

- - {{ form_start(form, { - 'attr': {'class': 'ui form form-default', 'id': 'back_in_stock_not'}, - 'action': path('webgriffe_back_in_stock_notification_add_subscription') - }|merge(sylius_test_form_attribute('subscribe-to-notifications'))) }} - - {{ form_errors(form) }} - - {% if form.email is defined %} - {{ form_row(form.email, {'attr': {'data-test-fill-subscription-form-whit-my-email':''}}) }} - {% endif %} - - {{ form_row(form.product_variant_code, {'attr': { - 'back-in-stock-notification-plugin-variant-code-input':'' - }}) }} - - {{ form_row(form.submit, { - 'attr': {'class': 'ui huge primary icon labeled button'}, - }) }} - - {{ form_row(form._token) }} - {{ form_end(form, {'render_rest': false}) }} -
diff --git a/templates/shop/account/subscription/grid/field/delete.html.twig b/templates/shop/account/subscription/grid/field/delete.html.twig new file mode 100644 index 0000000..1e064ca --- /dev/null +++ b/templates/shop/account/subscription/grid/field/delete.html.twig @@ -0,0 +1,4 @@ + + {{ ux_icon('tabler:trash', {'class': 'icon icon-xs'})}} + {{ 'webgriffe_bisn.my_account_section.remove'|trans }} + diff --git a/templates/shop/account/subscription/grid/field/notify.html.twig b/templates/shop/account/subscription/grid/field/notify.html.twig new file mode 100644 index 0000000..610c644 --- /dev/null +++ b/templates/shop/account/subscription/grid/field/notify.html.twig @@ -0,0 +1,11 @@ +{% if data %} + + {{ ux_icon('tabler:bell', {class: 'icon icon-sm'}) }} + {{ 'webgriffe_bisn.admin.notified'|trans }} + +{% else %} + + {{ ux_icon('tabler:bell', {class: 'icon icon-sm'}) }} + {{ 'webgriffe_bisn.admin.not-notified'|trans }} + +{% endif %} diff --git a/templates/MyAccount/productCell.html.twig b/templates/shop/account/subscription/grid/field/product.html.twig similarity index 97% rename from templates/MyAccount/productCell.html.twig rename to templates/shop/account/subscription/grid/field/product.html.twig index 1bedf4d..fb3cd15 100644 --- a/templates/MyAccount/productCell.html.twig +++ b/templates/shop/account/subscription/grid/field/product.html.twig @@ -1,3 +1,3 @@ {{ data.product.name }} - \ No newline at end of file + diff --git a/templates/shop/account/subscription/index.html.twig b/templates/shop/account/subscription/index.html.twig new file mode 100644 index 0000000..1e2f857 --- /dev/null +++ b/templates/shop/account/subscription/index.html.twig @@ -0,0 +1,6 @@ +{% extends '@SyliusShop/account/common/index.html.twig' %} + +{% set prefixes = ['webgriffe_sylius_back_in_stock_notification_plugin.shop.account.subscription'] %} +{% set attrs = { resources } %} + +{% block title %}{{ 'webgriffe_bisn.my_account_section.title'|trans }} | {{ parent() }}{% endblock %} diff --git a/templates/shop/account/subscription/index/content/breadcrumbs.html.twig b/templates/shop/account/subscription/index/content/breadcrumbs.html.twig new file mode 100644 index 0000000..c680242 --- /dev/null +++ b/templates/shop/account/subscription/index/content/breadcrumbs.html.twig @@ -0,0 +1,9 @@ +{% from '@SyliusShop/shared/breadcrumbs.html.twig' import breadcrumbs as breadcrumbs %} + +
+ {{ breadcrumbs([ + { label: 'sylius.ui.home'|trans, path: path('sylius_shop_homepage')}, + { label: 'sylius.ui.my_account'|trans, path: path('sylius_shop_account_dashboard')}, + { label: 'webgriffe_bisn.my_account_section.title'|trans, active: true } + ]) }} +
diff --git a/templates/shop/account/subscription/index/content/main/header/title.html.twig b/templates/shop/account/subscription/index/content/main/header/title.html.twig new file mode 100644 index 0000000..f22a069 --- /dev/null +++ b/templates/shop/account/subscription/index/content/main/header/title.html.twig @@ -0,0 +1 @@ +

{{ 'webgriffe_bisn.my_account_section.title'|trans }}

diff --git a/templates/shop/product/show/content/info/summary/add_notification.html.twig b/templates/shop/product/show/content/info/summary/add_notification.html.twig new file mode 100644 index 0000000..83176f3 --- /dev/null +++ b/templates/shop/product/show/content/info/summary/add_notification.html.twig @@ -0,0 +1,27 @@ +{% import '@SyliusShop/shared/buttons.html.twig' as buttons %} +{% form_theme form '@SyliusShop/form/theme.html.twig' %} + +
+ {% if not sylius_inventory_is_available(variant) %} +
+
{{ 'webgriffe_bisn.product_page.stock_notify_title'|trans }}:
+ {% if notificationSent %} +
{{ 'webgriffe_bisn.form_submission.subscription_successfully'|trans }}
+ {% endif %} + {{ form_start(form, {'attr': {'data-action': 'live#action:prevent live#$render', 'data-live-action-param': 'addNotification'}}) }} + + {{ form_errors(form) }} + + {% if not isCustomerLoggedIn %} + {{ form_widget(form.email, sylius_test_form_attribute('email')|sylius_merge_recursive({'attr': {'placeholder': 'sylius.ui.email'|trans ~ '...'}})) }} + {% endif %} + + {{ form_row(form.product_variant_code) }} + + {{ buttons.submit('webgriffe_bisn.product_page.form_action'|trans, 'add-notification', 'tabler:bell', 'btn-primary mt-2') }} + + {{ form_row(form._token) }} + {{ form_end(form, {'render_rest': false}) }} +
+ {% endif %} +
diff --git a/tests/Application/.env b/tests/Application/.env deleted file mode 100644 index 841276d..0000000 --- a/tests/Application/.env +++ /dev/null @@ -1,41 +0,0 @@ -# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file -# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production. -# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration - -###> symfony/framework-bundle ### -APP_ENV=dev -APP_DEBUG=1 -APP_SECRET=EDITME -###< symfony/framework-bundle ### - -###> doctrine/doctrine-bundle ### -# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url -# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db" -# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls -DATABASE_URL=mysql://root:root@127.0.0.1/webgriffe_sylius_back_in_stock_notification_plugin_%kernel.environment% -###< doctrine/doctrine-bundle ### - -###> lexik/jwt-authentication-bundle ### -JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem -JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem -JWT_PASSPHRASE=acme_plugin_development -###< lexik/jwt-authentication-bundle ### - -###> symfony/mailer ### -MAILER_DSN=smtp://127.0.0.1:1025 -###< symfony/mailer ### - -###> webgriffe/sylius-back-in-stock-notification-plugin ### -ROUTER_REQUEST_CONTEXT_HOST=www.example.com -ROUTER_REQUEST_CONTEXT_SCHEME=https -###> webgriffe/sylius-back-in-stock-notification-plugin ### - -###> symfony/messenger ### -# Choose one of the transports below -# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages -SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=doctrine://default -SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=doctrine://default -SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=doctrine://default -SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=doctrine://default -# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages -###< symfony/messenger ### diff --git a/tests/Application/.env.test b/tests/Application/.env.test deleted file mode 100644 index 42882c6..0000000 --- a/tests/Application/.env.test +++ /dev/null @@ -1,15 +0,0 @@ -APP_SECRET='ch4mb3r0f5ecr3ts' - -KERNEL_CLASS='Tests\Webgriffe\SyliusBackInStockNotificationPlugin\Application\Kernel' - -###> symfony/messenger ### -# Sync transport turned for testing env for the ease of testing -SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=sync:// -SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=sync:// -SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=sync:// -SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=sync:// -###< symfony/messenger ### - -###> symfony/mailer ### -MAILER_DSN=null://null -###< symfony/mailer ### diff --git a/tests/Application/.eslintrc.js b/tests/Application/.eslintrc.js deleted file mode 100644 index 92c4cee..0000000 --- a/tests/Application/.eslintrc.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - extends: 'airbnb-base', - env: { - node: true, - }, - rules: { - 'object-shorthand': ['error', 'always', { - avoidQuotes: true, - avoidExplicitReturnArrows: true, - }], - 'function-paren-newline': ['error', 'consistent'], - 'max-len': ['warn', 120, 2, { - ignoreUrls: true, - ignoreComments: false, - ignoreRegExpLiterals: true, - ignoreStrings: true, - ignoreTemplateLiterals: true, - }], - }, -}; diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore deleted file mode 100644 index bc600a8..0000000 --- a/tests/Application/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -/public/assets -/public/build -/public/css -/public/js -/public/media/* -!/public/media/image/ -/public/media/image/* -!/public/media/image/.gitignore - -/node_modules - -###> symfony/framework-bundle ### -/.env.*.local -/.env.local -/.env.local.php -/public/bundles -/var/ -/vendor/ -###< symfony/framework-bundle ### - -###> symfony/web-server-bundle ### -/.web-server-pid -###< symfony/web-server-bundle ### diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php deleted file mode 100644 index 3cb2c3f..0000000 --- a/tests/Application/Kernel.php +++ /dev/null @@ -1,97 +0,0 @@ -getProjectDir() . '/var/cache/' . $this->environment; - } - - public function getLogDir(): string - { - return $this->getProjectDir() . '/var/log'; - } - - public function registerBundles(): iterable - { - foreach ($this->getConfigurationDirectories() as $confDir) { - $bundlesFile = $confDir . '/bundles.php'; - if (false === is_file($bundlesFile)) { - continue; - } - yield from $this->registerBundlesFromFile($bundlesFile); - } - } - - protected function configureRoutes(RoutingConfigurator $routes): void - { - foreach ($this->getConfigurationDirectories() as $confDir) { - $this->loadRoutesConfiguration($routes, $confDir); - } - } - - protected function getContainerBaseClass(): string - { - if ($this->isTestEnvironment() && class_exists(MockerContainer::class)) { - return MockerContainer::class; - } - - return parent::getContainerBaseClass(); - } - - private function isTestEnvironment(): bool - { - return 0 === strpos($this->getEnvironment(), 'test'); - } - - private function loadRoutesConfiguration(RoutingConfigurator $routes, string $confDir): void - { - $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS); - $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS); - $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS); - } - - /** - * @return BundleInterface[] - */ - private function registerBundlesFromFile(string $bundlesFile): iterable - { - $contents = require $bundlesFile; - foreach ($contents as $class => $envs) { - if (isset($envs['all']) || isset($envs[$this->environment])) { - yield new $class(); - } - } - } - - /** - * @return string[] - */ - private function getConfigurationDirectories(): iterable - { - yield $this->getProjectDir() . '/config'; - $syliusConfigDir = $this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION; - if (is_dir($syliusConfigDir)) { - yield $syliusConfigDir; - } - $symfonyConfigDir = $this->getProjectDir() . '/config/symfony/' . BaseKernel::MAJOR_VERSION . '.' . BaseKernel::MINOR_VERSION; - if (is_dir($symfonyConfigDir)) { - yield $symfonyConfigDir; - } - } -} diff --git a/tests/Application/assets/admin/entry.js b/tests/Application/assets/admin/entry.js deleted file mode 100644 index 635f5ac..0000000 --- a/tests/Application/assets/admin/entry.js +++ /dev/null @@ -1 +0,0 @@ -import 'sylius/bundle/AdminBundle/Resources/private/entry'; diff --git a/tests/Application/assets/shop/entry.js b/tests/Application/assets/shop/entry.js deleted file mode 100644 index aadc317..0000000 --- a/tests/Application/assets/shop/entry.js +++ /dev/null @@ -1 +0,0 @@ -import 'sylius/bundle/ShopBundle/Resources/private/entry'; diff --git a/tests/Application/bin/console b/tests/Application/bin/console deleted file mode 100755 index a241689..0000000 --- a/tests/Application/bin/console +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env php -getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); -} - -if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); -} - -require dirname(__DIR__).'/config/bootstrap.php'; - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists(Debug::class)) { - Debug::enable(); - } -} - -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$application = new Application($kernel); -$application->run($input); diff --git a/tests/Application/composer.json b/tests/Application/composer.json deleted file mode 100644 index 326735f..0000000 --- a/tests/Application/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "sylius/plugin-skeleton-test-application", - "description": "Sylius application for plugin testing purposes (composer.json needed for project dir resolving)", - "license": "MIT" -} diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php deleted file mode 100644 index c9951a7..0000000 --- a/tests/Application/config/bootstrap.php +++ /dev/null @@ -1,27 +0,0 @@ -=1.2) -if (is_array($env = @include dirname(__DIR__) . '/.env.local.php')) { - $_SERVER += $env; - $_ENV += $env; -} elseif (!class_exists(Dotenv::class)) { - throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); -} elseif (method_exists(Dotenv::class, 'bootEnv')) { - (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); - - return; -} else { - // load all the .env files - (new Dotenv(true))->loadEnv(dirname(__DIR__) . '/.env'); -} - -$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; -$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; -$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php deleted file mode 100644 index c5d6d4b..0000000 --- a/tests/Application/config/bundles.php +++ /dev/null @@ -1,66 +0,0 @@ - ['all' => true], - Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], - Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], - Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], - Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], - Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true], - Sylius\Bundle\MoneyBundle\SyliusMoneyBundle::class => ['all' => true], - Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle::class => ['all' => true], - Sylius\Bundle\LocaleBundle\SyliusLocaleBundle::class => ['all' => true], - Sylius\Bundle\ProductBundle\SyliusProductBundle::class => ['all' => true], - Sylius\Bundle\ChannelBundle\SyliusChannelBundle::class => ['all' => true], - Sylius\Bundle\AttributeBundle\SyliusAttributeBundle::class => ['all' => true], - Sylius\Bundle\TaxationBundle\SyliusTaxationBundle::class => ['all' => true], - Sylius\Bundle\ShippingBundle\SyliusShippingBundle::class => ['all' => true], - Sylius\Bundle\PaymentBundle\SyliusPaymentBundle::class => ['all' => true], - Sylius\Bundle\MailerBundle\SyliusMailerBundle::class => ['all' => true], - Sylius\Bundle\PromotionBundle\SyliusPromotionBundle::class => ['all' => true], - Sylius\Bundle\AddressingBundle\SyliusAddressingBundle::class => ['all' => true], - Sylius\Bundle\InventoryBundle\SyliusInventoryBundle::class => ['all' => true], - Sylius\Bundle\TaxonomyBundle\SyliusTaxonomyBundle::class => ['all' => true], - Sylius\Bundle\UserBundle\SyliusUserBundle::class => ['all' => true], - Sylius\Bundle\CustomerBundle\SyliusCustomerBundle::class => ['all' => true], - Sylius\Bundle\UiBundle\SyliusUiBundle::class => ['all' => true], - Sylius\Bundle\ReviewBundle\SyliusReviewBundle::class => ['all' => true], - Sylius\Bundle\CoreBundle\SyliusCoreBundle::class => ['all' => true], - Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true], - Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], - winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true], - Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true], - Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true], - JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true], - FOS\RestBundle\FOSRestBundle::class => ['all' => true], - Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true], - Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true], - Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true], - Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true], - Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], - Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], - Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true], - Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true], - Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true], - Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true], - Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true], - Webgriffe\SyliusBackInStockNotificationPlugin\WebgriffeSyliusBackInStockNotificationPlugin::class => ['all' => true], - Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], - Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], - FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], - Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true], - ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], - Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], - Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], - SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], - BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], - Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], - League\FlysystemBundle\FlysystemBundle::class => ['all' => true], -]; -if (class_exists(Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class)) { - $bundles[Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class] = ['all' => true]; -} - -return $bundles; diff --git a/tests/Application/config/jwt/private.pem b/tests/Application/config/jwt/private.pem deleted file mode 100644 index 2bcf023..0000000 --- a/tests/Application/config/jwt/private.pem +++ /dev/null @@ -1,54 +0,0 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIJrTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIDbthk+aF5EACAggA -MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBA3DYfh2mXByUxFNke/Wf5SBIIJ -UBckIgXeXBWPLQAAq07pN8uNFMUcUirFuEvbmxVe1PupCCAqriNxi1DqeSu/M7c1 -h66y0BqKZu/0G9SVTg63iCKDEiRAM3hLyD2CsjYg8h2LAaqQ9dFYGV0cHRhCXagZ -Sdt9YTfn2rarRbxauMSt0z9zwCaiUrBU4JwSM3g+tD7W0lxAm9TeaqBZek5DIX+j -3Gom5tPYQe8jvfGMGdMPuanoEwH4WbWzGcqypWriy4JwaggwKCQ4ituWfa9kqMMC -8HRmBBDg0gtafmQP910RZh18JL2ewF5Pl7GDsLtOj5gNLNuAiQxDCcYRnD4/Cdsl -bH91btmGX1nUVIFViUTW93eBsjBgdgqOMRVxUKkSSX6CmIZWlE3AazgwSbvOvNrN -JGa8X21UwfuS/JHLmfRmgdti0YxRjJkBYLPpcd3ILsi+MMhSHy0uycAM/dB80Q1B -vkW1UXGbCw/PzA5yHrzULzAl69E3Tt5nTVMIIcBGxw2rf+ej+AVjsuOl7etwecdC -gnA90ViNlGOACLVnhsjd4WVF9Oircosf0UYoblwcT6gw1GSVF9pWuu7k5hy/7Pt/ -o1BvonUgz/4VHG+K58qvtnlto+JE0XWzPvukNUyggtekTLyoQCI3ZKge6ui3qLax -N6whHpzFnFVF3GJAisTk5naHFawHNvH7t85pmc+UnjNUUmyl9RStl9LMYDSBKNlR -LzPlJK27E5SLhhyJCni4+UYjH6PdlJuKXJ0365fufJ+5ajHRatwt039xLnK0W+oa -L35NxCuXrn8YxOgJIomt7IrkV3AuxoWxcx4lRFoM0WCdn9SWZVtfFFiyX/Xr1qDg -dUysw3/bePEkOKr5JWx09hT0OKDpkwLFo2Ljtvjln4EMXYEvvVqFciKw0kqF73Dw -NyoSubwR4qs6FQclKW1TAP6UW4B6ffq1iagKOCTZ5bBtsPBZk8UGCJb57q4fUj4P -nJy0hnSdlOH4Am+US4HF4ayOGuaV1Be1taurdJnt5cNnUYRah0wg4nG+wVdG5HJk -f4dJ4nih9d6WA/8LfxdpB7NCwdR+KK6lky+GgLSdhmIT9lzjj2GDsU4lBf29TkBn -lyt98/LWGrgCQgZAQ/obxLT8CZtY+tNejGoMppY+ub8DIaLBFID+fcz13kgA9x7a -TeVB8RPok+S3yHXP9a4WSFe9DGjjN+m7EnRtte7MEjyMoekXVnT04gNbTMoGAjNb -lrR4g3ICygZtsoGSB2VEu7o3azAspXNBMOuJfRCuC0LDXcjH3TbvjX0da5wHBoK9 -clRxu+CDo9A849HMkmSje8wED7ysZnkvSX0OdPjXahVd4t1tDRI6jSlzFo9fGcjp -S8Ikm9iMrHXaWcDdtcq4C63CjSynIBr4mNIxe/f2e9nynm3AIv+aOan891RWHqrd -DdpSSPShtzATI9PbB+b+S0Gw58Y8fpO7yoZ87VW1BMpadmFZ87YY78jdB7BwInNI -JqtnivinM6qCsvbdMoGinUyL6PUcfQGiEAibouKr3zNRDC4aesBZZmj7w0dnf+HK -YC905aR0cddlc6DBo/ed3o9krMcZ6oY/vruemPTc5G7Cg3t4H3mInRgURw22X1wo -FsioU1yOdkK+MYxvmGsQvQuSJhp7h1Uz37t/olkPRafZgy2nEtw6DQO0Dm4UfSsD -nysq6dn1WeZPkOipGBRgQmY1FTRzwPoCxi7+/EuHhD8hr962rHOglSuNqPG89J8r -wdbTDr8kgXj2A9p+jI3TVKEX+h6FEhrCHW9SHUqATOZ7RiNL6hKld9j0U4D9gQwZ -dflA0TxpVsHXm7pd1idkr46jIFgw7HA89Erm0Ty7RolfHkqlRca805AVmsKkviIz -sbF5uv4WzIE3ViO8P1KMUhCyElm72mpyNTXBhkxkup9hJ4fQieaN6pET6dQ2xyjs -SBIvQoXI0JQKpespcyAdoh88ULQjRUXEOaNFfN7q+itTcocwmPZfzW2nXORJT2p8 -SXLqSE73nYZdqzSYFq1hLcnlubJ7yPBYYG1fI0IydjSGKfnjtB0DReR32OToRZ7m -laduZ8O+IaBUY4Sp6QdYcVbGGpG/wsPmTQyScc/O2bfSI7AiPnL9EnwebI9sPSWQ -R0t0QMXZOSSqNY6jkYjsOCxeekRIdY6havo2Y52Ywti0QNrkT4BQ+175VVTmRMdy -LNaMFeEq6ehSEdaHaozvjHvP50HQT43tCK+RJiL+Gf9FqawoQRt693yO5LFbQsuw -QsUSMi41txpINMa+HEc2K5FvGoPr7FmajLK7X2fr+3c/yZ4fahoMKEAVFWl5kRYx -Fe1smlw1Vxl/qNQ32LFWsBIK+XnYBteYmlpVyYrTgXyjnp1rK2zz0118DPFuYiAP -O0r6nnBz0NbwnSKb7S4CjxBKDvDbWTzP35Q5L/vySnO2zRbM64Gw7sjeLiJittWS -gQfbFpEk9k8KVndKM4H50Jp0WznmYpm1Tman8hUOiCvmq0qdI3bJ5Bnj0K+q2zFV -+noGpMFdq1+8WaUFLQFGCPM+yJgCqDgT1RAgfsGcomckGcmenDtHaTbcSFabEdpM -Tsa2qLdg/Kju+7JyGrkmobXl/azuyjYTHfRvSZrvO5WUDFzhChrJpIL4nA3ZGRlS -gvy+OzyyBh4sRyHwLItwUwE81aya3W4llAkhQ7OycmqniJgjtJzLwnxv2RQsB8bF -pyoqQdKVxkqHdbUFeh9igI4ffRAK+8xDER5J+RUoZ4mO8qJebxar54XTb6I/Lepc -g8ITX8bJ/GH+M6JdP7tLCikDTSGS+i1ReMQXE5XuEajYOVbzQdyWU5jleZIx0f6X -mTa4WvMEGNyNxKZZXsy9FAaBkZqrNzEv8k0uFgFMNWQcMMtiqbei86yACdqe+jiW -HqHv8wfoBHR+eIARub2itOJ/cI+oKv96d4it4FqQ9Lml8RUFFZj7Hrd6EjDb6Nq4 -P9ti7eku/xZvS0saBNChvv44GhP6FZJS0i/gidVffLna7Wua98tPZEAXp57k+XUL -PzsRJ4a+hFuQjkyXFoz/v8YuUdyCFUSVVr9ArVu0v4+4euFWpQLav5sXv0Gh9X58 -Ek1KIf7Z/tZAJnSjTjFuSbDX/AoTMTxpRBKKnFW6zY0Nw2pjTVMtTVDkv9xkBpBK -wod7FPD5f0T7y9YOARVZnBxVRSkkcYpEJFy5pLNeadg9 ------END ENCRYPTED PRIVATE KEY----- diff --git a/tests/Application/config/jwt/public.pem b/tests/Application/config/jwt/public.pem deleted file mode 100644 index cb4e13d..0000000 --- a/tests/Application/config/jwt/public.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA6QkmF/Xi5nAYb8Kzr7qC -d63V2K+d/nCXbpDUKKDPJAqOtTlMoQSuJRLNnhhp7z1i/Cp4Bhifr20Pu2dq8JYg -6pRT4ctqvYb/MXxAaPZc3EcBC0S6AhgKO/fDvR3LcqYqGJmQQOXZvxTsgqongdvV -4XbqFBMMgngyayoBk0VKTaI/s+LQhIce+1QaxbAI0+/zbR0hZ1hWT73orJi3do+1 -TBzQol+V7WGa8LlJfmgM56qO3BmVkeTDMBc27pGp6g3+Oufk/l29jEGJlUT9yu7Q -BRhaQTWNVASa2aD+AKjVBzJh53O2zD8slAbjF1M9U7bbWN28Sv+xC/dUz0q9HnPu -RsY2tnwryqTyYn/Hf2xyP3/KvjJ6oslAwemu5JirdJkO7KVQAthWG42gLuhZg3ks -cSZhCLZH7nO2UDsf+2ZZgdbhpYZwR4gDRfNt7GKWXnWZOz9Uw1yVCPgylyZRZwg8 -l0y9aABdj3379I22icrwpMZbAgkyxNSV6UNJuxZksLUoP3i9OvXYgPYU9E4tU/Ul -Dm/T1rGSReGoPkU1YQnI50bq7p1byIoUu2scTflvpTVI5a7zULkS1tg60xk7vBRC -aBc7nr4UEtA235N6uLtcGxH11WBMwsKX69sSU0sQdC4Sk25zXM2gc8R1XV9K3qz2 -wQorQRlCwrkG44VRDgbFH+8CAwEAAQ== ------END PUBLIC KEY----- diff --git a/tests/Application/config/packages/_sylius.yaml b/tests/Application/config/packages/_sylius.yaml deleted file mode 100644 index 18acdd4..0000000 --- a/tests/Application/config/packages/_sylius.yaml +++ /dev/null @@ -1,18 +0,0 @@ -imports: - - { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" } - - - { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" } - - - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" } - - - { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" } - -parameters: - sylius_core.public_dir: '%kernel.project_dir%/public' - -sylius_shop: - product_grid: - include_all_descendants: true - -sylius_api: - enabled: true diff --git a/tests/Application/config/packages/api_platform.yaml b/tests/Application/config/packages/api_platform.yaml deleted file mode 100644 index cfeb991..0000000 --- a/tests/Application/config/packages/api_platform.yaml +++ /dev/null @@ -1,10 +0,0 @@ -api_platform: - mapping: - paths: - - '%kernel.project_dir%/../../vendor/sylius/sylius/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources' - - '%kernel.project_dir%/config/api_platform' - - '%kernel.project_dir%/src/Entity' - patch_formats: - json: ['application/merge-patch+json'] - swagger: - versions: [3] diff --git a/tests/Application/config/packages/assets.yaml b/tests/Application/config/packages/assets.yaml deleted file mode 100644 index 2468901..0000000 --- a/tests/Application/config/packages/assets.yaml +++ /dev/null @@ -1,7 +0,0 @@ -framework: - assets: - packages: - shop: - json_manifest_path: '%kernel.project_dir%/public/build/shop/manifest.json' - admin: - json_manifest_path: '%kernel.project_dir%/public/build/admin/manifest.json' diff --git a/tests/Application/config/packages/dev/framework.yaml b/tests/Application/config/packages/dev/framework.yaml deleted file mode 100644 index 4b116de..0000000 --- a/tests/Application/config/packages/dev/framework.yaml +++ /dev/null @@ -1,2 +0,0 @@ -framework: - profiler: { only_exceptions: false } diff --git a/tests/Application/config/packages/dev/jms_serializer.yaml b/tests/Application/config/packages/dev/jms_serializer.yaml deleted file mode 100644 index 2f32a9b..0000000 --- a/tests/Application/config/packages/dev/jms_serializer.yaml +++ /dev/null @@ -1,12 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/packages/dev/monolog.yaml b/tests/Application/config/packages/dev/monolog.yaml deleted file mode 100644 index da2b092..0000000 --- a/tests/Application/config/packages/dev/monolog.yaml +++ /dev/null @@ -1,9 +0,0 @@ -monolog: - handlers: - main: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug - firephp: - type: firephp - level: info diff --git a/tests/Application/config/packages/dev/routing.yaml b/tests/Application/config/packages/dev/routing.yaml deleted file mode 100644 index 4116679..0000000 --- a/tests/Application/config/packages/dev/routing.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - router: - strict_requirements: true diff --git a/tests/Application/config/packages/dev/web_profiler.yaml b/tests/Application/config/packages/dev/web_profiler.yaml deleted file mode 100644 index 1f1cb2b..0000000 --- a/tests/Application/config/packages/dev/web_profiler.yaml +++ /dev/null @@ -1,3 +0,0 @@ -web_profiler: - toolbar: true - intercept_redirects: false diff --git a/tests/Application/config/packages/doctrine.yaml b/tests/Application/config/packages/doctrine.yaml deleted file mode 100644 index f51ba5a..0000000 --- a/tests/Application/config/packages/doctrine.yaml +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - # Adds a fallback DATABASE_URL if the env var is not set. - # This allows you to run cache:warmup even if your - # environment variables are not available yet. - # You should not need to change this value. - env(DATABASE_URL): '' - -doctrine: - dbal: - driver: 'pdo_mysql' - server_version: '5.7' - charset: UTF8 - - url: '%env(resolve:DATABASE_URL)%' diff --git a/tests/Application/config/packages/doctrine_migrations.yaml b/tests/Application/config/packages/doctrine_migrations.yaml deleted file mode 100644 index cdbc01a..0000000 --- a/tests/Application/config/packages/doctrine_migrations.yaml +++ /dev/null @@ -1,4 +0,0 @@ -doctrine_migrations: - storage: - table_storage: - table_name: sylius_migrations diff --git a/tests/Application/config/packages/fos_rest.yaml b/tests/Application/config/packages/fos_rest.yaml deleted file mode 100644 index 930ee96..0000000 --- a/tests/Application/config/packages/fos_rest.yaml +++ /dev/null @@ -1,11 +0,0 @@ -fos_rest: - exception: true - view: - formats: - json: true - xml: true - empty_content: 204 - format_listener: - rules: - - { path: '^/api/v1/.*', priorities: [ 'json', 'xml' ], fallback_format: json, prefer_extension: true } - - { path: '^/', stop: true } diff --git a/tests/Application/config/packages/framework.yaml b/tests/Application/config/packages/framework.yaml deleted file mode 100644 index 8be076b..0000000 --- a/tests/Application/config/packages/framework.yaml +++ /dev/null @@ -1,9 +0,0 @@ -framework: - secret: '%env(APP_SECRET)%' - form: true - csrf_protection: true - session: - handler_id: ~ - serializer: - mapping: - paths: [ '%kernel.project_dir%/config/serialization' ] diff --git a/tests/Application/config/packages/jms_serializer.yaml b/tests/Application/config/packages/jms_serializer.yaml deleted file mode 100644 index 654116f..0000000 --- a/tests/Application/config/packages/jms_serializer.yaml +++ /dev/null @@ -1,10 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION \ No newline at end of file diff --git a/tests/Application/config/packages/lexik_jwt_authentication.yaml b/tests/Application/config/packages/lexik_jwt_authentication.yaml deleted file mode 100644 index edfb69d..0000000 --- a/tests/Application/config/packages/lexik_jwt_authentication.yaml +++ /dev/null @@ -1,4 +0,0 @@ -lexik_jwt_authentication: - secret_key: '%env(resolve:JWT_SECRET_KEY)%' - public_key: '%env(resolve:JWT_PUBLIC_KEY)%' - pass_phrase: '%env(JWT_PASSPHRASE)%' diff --git a/tests/Application/config/packages/liip_imagine.yaml b/tests/Application/config/packages/liip_imagine.yaml deleted file mode 100644 index bb2e7ce..0000000 --- a/tests/Application/config/packages/liip_imagine.yaml +++ /dev/null @@ -1,6 +0,0 @@ -liip_imagine: - resolvers: - default: - web_path: - web_root: "%kernel.project_dir%/public" - cache_prefix: "media/cache" diff --git a/tests/Application/config/packages/mailer.yaml b/tests/Application/config/packages/mailer.yaml deleted file mode 100644 index 56a650d..0000000 --- a/tests/Application/config/packages/mailer.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - mailer: - dsn: '%env(MAILER_DSN)%' diff --git a/tests/Application/config/packages/prod/doctrine.yaml b/tests/Application/config/packages/prod/doctrine.yaml deleted file mode 100644 index 2f16f0f..0000000 --- a/tests/Application/config/packages/prod/doctrine.yaml +++ /dev/null @@ -1,31 +0,0 @@ -doctrine: - orm: - metadata_cache_driver: - type: service - id: doctrine.system_cache_provider - query_cache_driver: - type: service - id: doctrine.system_cache_provider - result_cache_driver: - type: service - id: doctrine.result_cache_provider - -services: - doctrine.result_cache_provider: - class: Symfony\Component\Cache\DoctrineProvider - public: false - arguments: - - '@doctrine.result_cache_pool' - doctrine.system_cache_provider: - class: Symfony\Component\Cache\DoctrineProvider - public: false - arguments: - - '@doctrine.system_cache_pool' - -framework: - cache: - pools: - doctrine.result_cache_pool: - adapter: cache.app - doctrine.system_cache_pool: - adapter: cache.system diff --git a/tests/Application/config/packages/prod/monolog.yaml b/tests/Application/config/packages/prod/monolog.yaml deleted file mode 100644 index 6461211..0000000 --- a/tests/Application/config/packages/prod/monolog.yaml +++ /dev/null @@ -1,10 +0,0 @@ -monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug diff --git a/tests/Application/config/packages/routing.yaml b/tests/Application/config/packages/routing.yaml deleted file mode 100644 index 368bc7f..0000000 --- a/tests/Application/config/packages/routing.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - router: - strict_requirements: ~ diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/packages/security.yaml deleted file mode 100644 index 4ed342f..0000000 --- a/tests/Application/config/packages/security.yaml +++ /dev/null @@ -1,124 +0,0 @@ -security: - enable_authenticator_manager: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - - password_hashers: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - - new_api_admin_user: - pattern: "%sylius.security.new_api_admin_regex%/.*" - provider: sylius_api_admin_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_admin_route%/authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - new_api_shop_user: - pattern: "%sylius.security.new_api_shop_regex%/.*" - provider: sylius_api_shop_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_shop_route%/authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_homepage - invalidate_session: false - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - image_resolver: - pattern: ^/media/cache/resolve - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } - - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/packages/staging/monolog.yaml b/tests/Application/config/packages/staging/monolog.yaml deleted file mode 100644 index 6461211..0000000 --- a/tests/Application/config/packages/staging/monolog.yaml +++ /dev/null @@ -1,10 +0,0 @@ -monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug diff --git a/tests/Application/config/packages/stof_doctrine_extensions.yaml b/tests/Application/config/packages/stof_doctrine_extensions.yaml deleted file mode 100644 index 7770f74..0000000 --- a/tests/Application/config/packages/stof_doctrine_extensions.yaml +++ /dev/null @@ -1,4 +0,0 @@ -# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html -# See the official DoctrineExtensions documentation for more details: https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/ -stof_doctrine_extensions: - default_locale: '%locale%' diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml deleted file mode 100644 index fc1d3c1..0000000 --- a/tests/Application/config/packages/test/framework.yaml +++ /dev/null @@ -1,4 +0,0 @@ -framework: - test: ~ - session: - storage_factory_id: session.storage.factory.mock_file diff --git a/tests/Application/config/packages/test/mailer.yaml b/tests/Application/config/packages/test/mailer.yaml deleted file mode 100644 index 52610d6..0000000 --- a/tests/Application/config/packages/test/mailer.yaml +++ /dev/null @@ -1,5 +0,0 @@ -framework: - cache: - pools: - test.mailer_pool: - adapter: cache.adapter.filesystem diff --git a/tests/Application/config/packages/test/monolog.yaml b/tests/Application/config/packages/test/monolog.yaml deleted file mode 100644 index 7e2b9e3..0000000 --- a/tests/Application/config/packages/test/monolog.yaml +++ /dev/null @@ -1,6 +0,0 @@ -monolog: - handlers: - main: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: error diff --git a/tests/Application/config/packages/test/security.yaml b/tests/Application/config/packages/test/security.yaml deleted file mode 100644 index 4071d31..0000000 --- a/tests/Application/config/packages/test/security.yaml +++ /dev/null @@ -1,6 +0,0 @@ -security: - password_hashers: - Sylius\Component\User\Model\UserInterface: - algorithm: argon2i - time_cost: 3 - memory_cost: 10 diff --git a/tests/Application/config/packages/test/sylius_theme.yaml b/tests/Application/config/packages/test/sylius_theme.yaml deleted file mode 100644 index 4d34199..0000000 --- a/tests/Application/config/packages/test/sylius_theme.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_theme: - sources: - test: ~ diff --git a/tests/Application/config/packages/test/sylius_uploader.yaml b/tests/Application/config/packages/test/sylius_uploader.yaml deleted file mode 100644 index ab9d6ca..0000000 --- a/tests/Application/config/packages/test/sylius_uploader.yaml +++ /dev/null @@ -1,3 +0,0 @@ -services: - Sylius\Component\Core\Generator\ImagePathGeneratorInterface: - class: Sylius\Behat\Service\Generator\UploadedImagePathGenerator diff --git a/tests/Application/config/packages/test/web_profiler.yaml b/tests/Application/config/packages/test/web_profiler.yaml deleted file mode 100644 index 03752de..0000000 --- a/tests/Application/config/packages/test/web_profiler.yaml +++ /dev/null @@ -1,6 +0,0 @@ -web_profiler: - toolbar: false - intercept_redirects: false - -framework: - profiler: { collect: false } diff --git a/tests/Application/config/packages/test_cached/doctrine.yaml b/tests/Application/config/packages/test_cached/doctrine.yaml deleted file mode 100644 index 4952860..0000000 --- a/tests/Application/config/packages/test_cached/doctrine.yaml +++ /dev/null @@ -1,16 +0,0 @@ -doctrine: - orm: - entity_managers: - default: - result_cache_driver: - type: memcached - host: localhost - port: 11211 - query_cache_driver: - type: memcached - host: localhost - port: 11211 - metadata_cache_driver: - type: memcached - host: localhost - port: 11211 diff --git a/tests/Application/config/packages/test_cached/fos_rest.yaml b/tests/Application/config/packages/test_cached/fos_rest.yaml deleted file mode 100644 index 2b4189d..0000000 --- a/tests/Application/config/packages/test_cached/fos_rest.yaml +++ /dev/null @@ -1,3 +0,0 @@ -fos_rest: - exception: - debug: true diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml deleted file mode 100644 index e9dd6ee..0000000 --- a/tests/Application/config/packages/test_cached/framework.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: ../test/framework.yaml } diff --git a/tests/Application/config/packages/test_cached/mailer.yaml b/tests/Application/config/packages/test_cached/mailer.yaml deleted file mode 100644 index 16f3170..0000000 --- a/tests/Application/config/packages/test_cached/mailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test/mailer.yaml" } diff --git a/tests/Application/config/packages/test_cached/monolog.yaml b/tests/Application/config/packages/test_cached/monolog.yaml deleted file mode 100644 index 7e2b9e3..0000000 --- a/tests/Application/config/packages/test_cached/monolog.yaml +++ /dev/null @@ -1,6 +0,0 @@ -monolog: - handlers: - main: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: error diff --git a/tests/Application/config/packages/test_cached/security.yaml b/tests/Application/config/packages/test_cached/security.yaml deleted file mode 100644 index 76e9273..0000000 --- a/tests/Application/config/packages/test_cached/security.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: ../test/security.yaml } diff --git a/tests/Application/config/packages/test_cached/sylius_channel.yaml b/tests/Application/config/packages/test_cached/sylius_channel.yaml deleted file mode 100644 index bab83ef..0000000 --- a/tests/Application/config/packages/test_cached/sylius_channel.yaml +++ /dev/null @@ -1,2 +0,0 @@ -sylius_channel: - debug: true diff --git a/tests/Application/config/packages/test_cached/sylius_theme.yaml b/tests/Application/config/packages/test_cached/sylius_theme.yaml deleted file mode 100644 index 4d34199..0000000 --- a/tests/Application/config/packages/test_cached/sylius_theme.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_theme: - sources: - test: ~ diff --git a/tests/Application/config/packages/test_cached/sylius_uploader.yaml b/tests/Application/config/packages/test_cached/sylius_uploader.yaml deleted file mode 100644 index cfa727e..0000000 --- a/tests/Application/config/packages/test_cached/sylius_uploader.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test/sylius_uploader.yaml" } diff --git a/tests/Application/config/packages/test_cached/twig.yaml b/tests/Application/config/packages/test_cached/twig.yaml deleted file mode 100644 index 8c6e0b4..0000000 --- a/tests/Application/config/packages/test_cached/twig.yaml +++ /dev/null @@ -1,2 +0,0 @@ -twig: - strict_variables: true diff --git a/tests/Application/config/packages/translation.yaml b/tests/Application/config/packages/translation.yaml deleted file mode 100644 index 1f4f966..0000000 --- a/tests/Application/config/packages/translation.yaml +++ /dev/null @@ -1,8 +0,0 @@ -framework: - default_locale: '%locale%' - translator: - paths: - - '%kernel.project_dir%/translations' - fallbacks: - - '%locale%' - - 'en' diff --git a/tests/Application/config/packages/twig.yaml b/tests/Application/config/packages/twig.yaml deleted file mode 100644 index 8545473..0000000 --- a/tests/Application/config/packages/twig.yaml +++ /dev/null @@ -1,12 +0,0 @@ -twig: - paths: ['%kernel.project_dir%/templates'] - debug: '%kernel.debug%' - strict_variables: '%kernel.debug%' - -services: - _defaults: - public: false - autowire: true - autoconfigure: true - - Twig\Extra\Intl\IntlExtension: ~ diff --git a/tests/Application/config/packages/validator.yaml b/tests/Application/config/packages/validator.yaml deleted file mode 100644 index 61807db..0000000 --- a/tests/Application/config/packages/validator.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - validation: - enable_annotations: true diff --git a/tests/Application/config/packages/webpack_encore.yaml b/tests/Application/config/packages/webpack_encore.yaml deleted file mode 100644 index 9bee248..0000000 --- a/tests/Application/config/packages/webpack_encore.yaml +++ /dev/null @@ -1,5 +0,0 @@ -webpack_encore: - output_path: '%kernel.project_dir%/public/build/default' - builds: - shop: '%kernel.project_dir%/public/build/shop' - admin: '%kernel.project_dir%/public/build/admin' diff --git a/tests/Application/config/routes/dev/web_profiler.yaml b/tests/Application/config/routes/dev/web_profiler.yaml deleted file mode 100644 index 3e79dc2..0000000 --- a/tests/Application/config/routes/dev/web_profiler.yaml +++ /dev/null @@ -1,7 +0,0 @@ -_wdt: - resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" - prefix: /_wdt - -_profiler: - resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" - prefix: /_profiler diff --git a/tests/Application/config/routes/liip_imagine.yaml b/tests/Application/config/routes/liip_imagine.yaml deleted file mode 100644 index 201cbd5..0000000 --- a/tests/Application/config/routes/liip_imagine.yaml +++ /dev/null @@ -1,2 +0,0 @@ -_liip_imagine: - resource: "@LiipImagineBundle/Resources/config/routing.yaml" diff --git a/tests/Application/config/routes/sylius_admin.yaml b/tests/Application/config/routes/sylius_admin.yaml deleted file mode 100644 index 1ba48d6..0000000 --- a/tests/Application/config/routes/sylius_admin.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_admin: - resource: "@SyliusAdminBundle/Resources/config/routing.yml" - prefix: /admin diff --git a/tests/Application/config/routes/sylius_api.yaml b/tests/Application/config/routes/sylius_api.yaml deleted file mode 100644 index ae01ffc..0000000 --- a/tests/Application/config/routes/sylius_api.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_api: - resource: "@SyliusApiBundle/Resources/config/routing.yml" - prefix: "%sylius.security.new_api_route%" diff --git a/tests/Application/config/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml deleted file mode 100644 index fae46cb..0000000 --- a/tests/Application/config/routes/sylius_shop.yaml +++ /dev/null @@ -1,14 +0,0 @@ -sylius_shop: - resource: "@SyliusShopBundle/Resources/config/routing.yml" - prefix: /{_locale} - requirements: - _locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$ - -sylius_shop_payum: - resource: "@SyliusShopBundle/Resources/config/routing/payum.yml" - -sylius_shop_default_locale: - path: / - methods: [GET] - defaults: - _controller: sylius.controller.shop.locale_switch::switchAction diff --git a/tests/Application/config/routes/test/routing.yaml b/tests/Application/config/routes/test/routing.yaml deleted file mode 100644 index 0ca57d9..0000000 --- a/tests/Application/config/routes/test/routing.yaml +++ /dev/null @@ -1,5 +0,0 @@ -sylius_test_plugin_main: - path: /test/main - controller: FrameworkBundle:Template:template - defaults: - template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/routes/test/sylius_test_plugin.yaml b/tests/Application/config/routes/test/sylius_test_plugin.yaml deleted file mode 100644 index 0ca57d9..0000000 --- a/tests/Application/config/routes/test/sylius_test_plugin.yaml +++ /dev/null @@ -1,5 +0,0 @@ -sylius_test_plugin_main: - path: /test/main - controller: FrameworkBundle:Template:template - defaults: - template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/routes/test_cached/routing.yaml b/tests/Application/config/routes/test_cached/routing.yaml deleted file mode 100644 index 0ca57d9..0000000 --- a/tests/Application/config/routes/test_cached/routing.yaml +++ /dev/null @@ -1,5 +0,0 @@ -sylius_test_plugin_main: - path: /test/main - controller: FrameworkBundle:Template:template - defaults: - template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/routes/test_cached/sylius_test_plugin.yaml b/tests/Application/config/routes/test_cached/sylius_test_plugin.yaml deleted file mode 100644 index 0ca57d9..0000000 --- a/tests/Application/config/routes/test_cached/sylius_test_plugin.yaml +++ /dev/null @@ -1,5 +0,0 @@ -sylius_test_plugin_main: - path: /test/main - controller: FrameworkBundle:Template:template - defaults: - template: "@SyliusTestPlugin/main.html.twig" diff --git a/tests/Application/config/secrets/prod/.gitignore b/tests/Application/config/secrets/prod/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Application/config/secrets/test/.gitignore b/tests/Application/config/secrets/test/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Application/config/secrets/test_cached/.gitignore b/tests/Application/config/secrets/test_cached/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Application/config/serialization/.gitignore b/tests/Application/config/serialization/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Application/config/services.yaml b/tests/Application/config/services.yaml deleted file mode 100644 index 187d745..0000000 --- a/tests/Application/config/services.yaml +++ /dev/null @@ -1,6 +0,0 @@ -# Put parameters here that don't need to change on each machine where the app is deployed -# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration -parameters: - locale: en_US - router.request_context.host: '%env(resolve:ROUTER_REQUEST_CONTEXT_HOST)%' - router.request_context.scheme: '%env(resolve:ROUTER_REQUEST_CONTEXT_SCHEME)%' diff --git a/tests/Application/config/services_test.yaml b/tests/Application/config/services_test.yaml deleted file mode 100644 index 07999f1..0000000 --- a/tests/Application/config/services_test.yaml +++ /dev/null @@ -1,8 +0,0 @@ -imports: - - { resource: "../../Behat/Resources/services.yaml" } - - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } - -# workaround needed for strange "test.client.history" problem -# see https://github.com/FriendsOfBehat/SymfonyExtension/issues/88 -services: - Symfony\Component\BrowserKit\AbstractBrowser: '@test.client' diff --git a/tests/Application/config/services_test_cached.yaml b/tests/Application/config/services_test_cached.yaml deleted file mode 100644 index 0de380e..0000000 --- a/tests/Application/config/services_test_cached.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "services_test.yaml" } diff --git a/tests/Application/package.json b/tests/Application/package.json deleted file mode 100644 index b428c24..0000000 --- a/tests/Application/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "license": "UNLICENSED", - "scripts": { - "build": "encore dev", - "build:prod": "encore production", - "postinstall": "semantic-ui-css-patch", - "lint": "yarn lint:js", - "watch": "encore dev --watch" - }, - "devDependencies": { - "@sylius-ui/frontend": "^1.0" - } -} diff --git a/tests/Application/public/.htaccess b/tests/Application/public/.htaccess deleted file mode 100644 index 99ed00d..0000000 --- a/tests/Application/public/.htaccess +++ /dev/null @@ -1,25 +0,0 @@ -DirectoryIndex app.php - - - RewriteEngine On - - RewriteCond %{HTTP:Authorization} ^(.*) - RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] - - RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ - RewriteRule ^(.*) - [E=BASE:%1] - - RewriteCond %{ENV:REDIRECT_STATUS} ^$ - RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] - - RewriteCond %{REQUEST_FILENAME} -f - RewriteRule .? - [L] - - RewriteRule .? %{ENV:BASE}/index.php [L] - - - - - RedirectMatch 302 ^/$ /index.php/ - - diff --git a/tests/Application/public/favicon.ico b/tests/Application/public/favicon.ico deleted file mode 100644 index 592f7a8..0000000 Binary files a/tests/Application/public/favicon.ico and /dev/null differ diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php deleted file mode 100644 index 07ae359..0000000 --- a/tests/Application/public/index.php +++ /dev/null @@ -1,29 +0,0 @@ -handle($request); -$response->send(); -$kernel->terminate($request, $response); diff --git a/tests/Application/public/robots.txt b/tests/Application/public/robots.txt deleted file mode 100644 index 214e411..0000000 --- a/tests/Application/public/robots.txt +++ /dev/null @@ -1,4 +0,0 @@ -# www.robotstxt.org/ -# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 - -User-agent: * diff --git a/tests/Application/src/Entity/.gitignore b/tests/Application/src/Entity/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Application/templates/.gitignore b/tests/Application/templates/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig deleted file mode 100644 index 1d9fa7d..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/Layout/_logo.html.twig +++ /dev/null @@ -1,5 +0,0 @@ - -
- -
-
diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/Security/_content.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/Security/_content.html.twig deleted file mode 100644 index ce17621..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/Security/_content.html.twig +++ /dev/null @@ -1,6 +0,0 @@ -{% include '@SyliusUi/Security/_login.html.twig' - with { - 'action': path('sylius_admin_login_check'), - 'paths': {'logo': asset('build/admin/images/logo.png', 'admin')} -} -%} diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig deleted file mode 100644 index f5f9835..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_script_tags('admin-entry', null, 'admin') }} diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig deleted file mode 100644 index a96144c..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_link_tags('admin-entry', null, 'admin') }} diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig deleted file mode 100644 index 8486493..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -
-
- {{ 'sylius.homepage.banner_content'|trans }} -
-
-
{{ 'sylius.homepage.banner_content'|trans }}
- {{ 'sylius.homepage.banner_button'|trans }} -
-
diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig deleted file mode 100644 index 84b8df5..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig deleted file mode 100644 index d1655bb..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_script_tags('shop-entry', null, 'shop') }} diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig deleted file mode 100644 index fd2c7cb..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_link_tags('shop-entry', null, 'shop') }} diff --git a/tests/Application/translations/.gitignore b/tests/Application/translations/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js deleted file mode 100644 index 4c80445..0000000 --- a/tests/Application/webpack.config.js +++ /dev/null @@ -1,50 +0,0 @@ -const path = require('path'); -const Encore = require('@symfony/webpack-encore'); - -const syliusBundles = path.resolve(__dirname, '../../vendor/sylius/sylius/src/Sylius/Bundle/'); -const uiBundleScripts = path.resolve(syliusBundles, 'UiBundle/Resources/private/js/'); -const uiBundleResources = path.resolve(syliusBundles, 'UiBundle/Resources/private/'); - -// Shop config -Encore - .setOutputPath('public/build/shop/') - .setPublicPath('/build/shop') - .addEntry('shop-entry', '../../vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/private/entry.js') - .addEntry('webgriffe-sylius-back-in-stock-notification-entry', '../../public/js/back-in-stock-notification.js') - .disableSingleRuntimeChunk() - .cleanupOutputBeforeBuild() - .enableSourceMaps(!Encore.isProduction()) - .enableVersioning(Encore.isProduction()) - .enableSassLoader(); - -const shopConfig = Encore.getWebpackConfig(); - -shopConfig.resolve.alias['sylius/ui'] = uiBundleScripts; -shopConfig.resolve.alias['sylius/ui-resources'] = uiBundleResources; -shopConfig.resolve.alias['sylius/bundle'] = syliusBundles; -shopConfig.resolve.alias['chart.js/dist/Chart.min'] = path.resolve(__dirname, 'node_modules/chart.js/dist/chart.min.js'); -shopConfig.name = 'shop'; - -Encore.reset(); - -// Admin config -Encore - .setOutputPath('public/build/admin/') - .setPublicPath('/build/admin') - .addEntry('admin-entry', '../../vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/Resources/private/entry.js') - .disableSingleRuntimeChunk() - .cleanupOutputBeforeBuild() - .enableSourceMaps(!Encore.isProduction()) - .enableVersioning(Encore.isProduction()) - .enableSassLoader(); - -const adminConfig = Encore.getWebpackConfig(); - -adminConfig.resolve.alias['sylius/ui'] = uiBundleScripts; -adminConfig.resolve.alias['sylius/ui-resources'] = uiBundleResources; -adminConfig.resolve.alias['sylius/bundle'] = syliusBundles; -adminConfig.resolve.alias['chart.js/dist/Chart.min'] = path.resolve(__dirname, 'node_modules/chart.js/dist/chart.min.js'); -adminConfig.externals = Object.assign({}, adminConfig.externals, { window: 'window', document: 'document' }); -adminConfig.name = 'admin'; - -module.exports = [shopConfig, adminConfig]; diff --git a/tests/Behat/Context/Ui/Shop/ProductInventoryContext.php b/tests/Behat/Context/Ui/Shop/ProductInventoryContext.php index 1c67a1f..eb54f67 100644 --- a/tests/Behat/Context/Ui/Shop/ProductInventoryContext.php +++ b/tests/Behat/Context/Ui/Shop/ProductInventoryContext.php @@ -30,9 +30,7 @@ public function iSubscribeToTheAlertListForThisProduct(ProductInterface $product if ($productCode === null) { throw new RuntimeException('Could not load the product properly'); } - if ($product->isConfigurable()) { - $this->subscriptionFormElement->openOverlayForConfigurableProduct(); - } + if ($email !== null) { $this->subscriptionFormElement->submitFormAsAGuest($productCode, $email); } else { diff --git a/tests/Behat/Element/Product/ShowPage/SubscriptionFormElement.php b/tests/Behat/Element/Product/ShowPage/SubscriptionFormElement.php index 553488c..47cb22d 100644 --- a/tests/Behat/Element/Product/ShowPage/SubscriptionFormElement.php +++ b/tests/Behat/Element/Product/ShowPage/SubscriptionFormElement.php @@ -4,59 +4,40 @@ namespace Tests\Webgriffe\SyliusBackInStockNotificationPlugin\Behat\Element\Product\ShowPage; -use Behat\Mink\Session; use FriendsOfBehat\PageObjectExtension\Element\Element; -use Sylius\Behat\Page\Shop\Product\ShowPageInterface; -use Sylius\Behat\Service\DriverHelper; -use Sylius\Behat\Service\JQueryHelper; final class SubscriptionFormElement extends Element implements SubscriptionFormElementInterface { - /** - * @param mixed[]|\ArrayAccess $minkParameters - */ - public function __construct( - Session $session, - $minkParameters, - private ShowPageInterface $productPage, - ) { - parent::__construct($session, $minkParameters); - } - public function submitFormAsAGuest(string $variant, string $email): void { $this->getElement('add_email')->setValue($email); - $this->getElement('submit_form')->submit(); + $this->getElement('submit_form')->click(); $this->waitForProductPageRefresh(); } public function submitFormAsALoggedCustomer(string $variant): void { - $this->getElement('submit_form')->submit(); + $this->getElement('submit_form')->click(); $this->waitForProductPageRefresh(); } - public function openOverlayForConfigurableProduct(): void - { - $this->getElement('open_overlay')->click(); - } - protected function getDefinedElements(): array { return array_merge(parent::getDefinedElements(), [ 'open_overlay' => '#trigger-notification-overlay', - 'add_email' => '[data-test-fill-subscription-form-whit-my-email]', - 'submit_form' => '[data-test-subscribe-to-notifications]', + 'add_email' => '[data-live-name-value="webgriffe:sylius_shop:product:add_notification"] [data-test-email]', + 'form' => '[data-live-name-value="webgriffe:sylius_shop:product:add_notification"]', + 'submit_form' => '[data-test-button="add-notification"]', ]); } private function waitForProductPageRefresh(): void { - if (DriverHelper::isJavascript($this->getDriver())) { - JQueryHelper::waitForAsynchronousActionsToFinish($this->getSession()); - $this->getDocument()->waitFor(3, fn (): bool => $this->productPage->isOpen()); - } + $form = $this->getElement('form'); + + usleep(500000); + $form->waitFor(1500, fn () => !$form->hasAttribute('busy')); } } diff --git a/tests/Behat/Element/Product/ShowPage/SubscriptionFormElementInterface.php b/tests/Behat/Element/Product/ShowPage/SubscriptionFormElementInterface.php index 3102050..7f79d25 100644 --- a/tests/Behat/Element/Product/ShowPage/SubscriptionFormElementInterface.php +++ b/tests/Behat/Element/Product/ShowPage/SubscriptionFormElementInterface.php @@ -6,8 +6,6 @@ interface SubscriptionFormElementInterface { - public function openOverlayForConfigurableProduct(): void; - public function submitFormAsAGuest(string $variant, string $email): void; public function submitFormAsALoggedCustomer(string $variant): void; diff --git a/tests/Behat/Page/Shop/Account/Subscription/IndexPage.php b/tests/Behat/Page/Shop/Account/Subscription/IndexPage.php index aa2bd4b..51ef6b5 100644 --- a/tests/Behat/Page/Shop/Account/Subscription/IndexPage.php +++ b/tests/Behat/Page/Shop/Account/Subscription/IndexPage.php @@ -40,7 +40,7 @@ protected function getDefinedElements(): array { return array_merge(parent::getDefinedElements(), [ 'customer_subscriptions' => '[data-test-grid-table]', - 'first_subscription' => '[data-test-grid-table-body] [data-test-row]:first-child [data-test-delete-button]', + 'first_subscription' => '[data-test-grid-table-body] [data-test-row]:first-child [data-test-button-delete]', 'table' => '[data-test-grid-table-body]', ]); } diff --git a/tests/Behat/Resources/services.yaml b/tests/Behat/Resources/services.yaml index e0601b7..1127f0d 100644 --- a/tests/Behat/Resources/services.yaml +++ b/tests/Behat/Resources/services.yaml @@ -4,7 +4,7 @@ services: Tests\Webgriffe\SyliusBackInStockNotificationPlugin\Behat\Context\Ui\Shop\ProductInventoryContext: arguments: - - '@sylius.behat.notification_checker' + - '@sylius.behat.notification_checker.shop' - '@sylius.behat.email_checker' - '@translator.data_collector' - '@Tests\Webgriffe\SyliusBackInStockNotificationPlugin\Behat\Element\Product\ShowPage\SubscriptionFormElement' @@ -12,8 +12,6 @@ services: Tests\Webgriffe\SyliusBackInStockNotificationPlugin\Behat\Element\Product\ShowPage\SubscriptionFormElement: parent: 'sylius.behat.element' public: false - arguments: - - '@sylius.behat.page.shop.product.show' Tests\Webgriffe\SyliusBackInStockNotificationPlugin\Behat\Page\Shop\Account\Subscription\IndexPage: parent: 'sylius.behat.symfony_page' @@ -24,4 +22,4 @@ services: Tests\Webgriffe\SyliusBackInStockNotificationPlugin\Behat\Context\Ui\Shop\AccountContext: arguments: - '@Tests\Webgriffe\SyliusBackInStockNotificationPlugin\Behat\Page\Shop\Account\Subscription\IndexPage' - - '@sylius.behat.notification_checker' + - '@sylius.behat.notification_checker.shop' diff --git a/tests/TestApplication/.env b/tests/TestApplication/.env new file mode 100644 index 0000000..d495f34 --- /dev/null +++ b/tests/TestApplication/.env @@ -0,0 +1,9 @@ +###> sylius/test-application ### +SYLIUS_TEST_APP_CONFIGS_TO_IMPORT="@WebgriffeSyliusBackInStockNotificationPlugin/tests/TestApplication/config/config.yaml" +SYLIUS_TEST_APP_ROUTES_TO_IMPORT="@WebgriffeSyliusBackInStockNotificationPlugin/tests/TestApplication/config/routes.yaml" +SYLIUS_TEST_APP_BUNDLES_PATH="tests/TestApplication/config/bundles.php" +###< sylius/test-application ### + +###> doctrine/doctrine-bundle ### +DATABASE_URL="mysql://root:root@127.0.0.1:3306/webgriffe_back_in_stock_%kernel.environment%?serverVersion=8.0" +###< doctrine/doctrine-bundle ### diff --git a/tests/TestApplication/.env.test b/tests/TestApplication/.env.test new file mode 100644 index 0000000..f8d0166 --- /dev/null +++ b/tests/TestApplication/.env.test @@ -0,0 +1,9 @@ +###> sylius/test-application ### +SYLIUS_TEST_APP_CONFIGS_TO_IMPORT="@WebgriffeSyliusBackInStockNotificationPlugin/tests/TestApplication/config/config.yaml" +SYLIUS_TEST_APP_ROUTES_TO_IMPORT="@WebgriffeSyliusBackInStockNotificationPlugin/tests/TestApplication/config/routes.yaml" +SYLIUS_TEST_APP_BUNDLES_PATH="tests/TestApplication/config/bundles.php" +###< sylius/test-application ### + +###> doctrine/doctrine-bundle ### +DATABASE_URL="mysql://root:root@127.0.0.1:8091/webgriffe_back_in_stock_notification_%kernel.environment%?serverVersion=8.0" +###< doctrine/doctrine-bundle ### diff --git a/tests/TestApplication/config/bundles.php b/tests/TestApplication/config/bundles.php new file mode 100644 index 0000000..104c606 --- /dev/null +++ b/tests/TestApplication/config/bundles.php @@ -0,0 +1,9 @@ + ['all' => true], +]; + +return $bundles; diff --git a/tests/Application/config/packages/webgriffe_sylius_back_in_stock_notification_plugin.yaml b/tests/TestApplication/config/config.yaml similarity index 71% rename from tests/Application/config/packages/webgriffe_sylius_back_in_stock_notification_plugin.yaml rename to tests/TestApplication/config/config.yaml index 7c4ebf3..89c0140 100644 --- a/tests/Application/config/packages/webgriffe_sylius_back_in_stock_notification_plugin.yaml +++ b/tests/TestApplication/config/config.yaml @@ -1,2 +1,3 @@ imports: - { resource: "@WebgriffeSyliusBackInStockNotificationPlugin/config/packages.yaml" } + - { resource: "services_test.php" } diff --git a/tests/Application/config/routes/webgriffe_sylius_back_in_stock_notification_plugin.yaml b/tests/TestApplication/config/routes.yaml similarity index 100% rename from tests/Application/config/routes/webgriffe_sylius_back_in_stock_notification_plugin.yaml rename to tests/TestApplication/config/routes.yaml diff --git a/tests/TestApplication/config/services_test.php b/tests/TestApplication/config/services_test.php new file mode 100644 index 0000000..0173a3b --- /dev/null +++ b/tests/TestApplication/config/services_test.php @@ -0,0 +1,14 @@ +import('../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml'); + $container->import('../../Behat/Resources/services.yaml'); + } +}; diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 609be70..9e55178 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -1,3 +1,7 @@ +webgriffe: + ui: + back_in_stock_notification_subscriptions: 'Products notification' + webgriffe_bisn: form_submission: subscription_successfully: 'Successfully subscribed, check your email!' diff --git a/translations/messages.es.yaml b/translations/messages.es.yaml index e59d101..64f9a9c 100644 --- a/translations/messages.es.yaml +++ b/translations/messages.es.yaml @@ -1,3 +1,7 @@ +webgriffe: + ui: + back_in_stock_notification_subscriptions: 'Notificación de productos' + webgriffe_bisn: form_submission: subscription_successfully: 'Inscripción realizada con éxito, ¡verifica tu correo electrónico!' diff --git a/translations/messages.fr.yaml b/translations/messages.fr.yaml index c3378d7..58835c1 100644 --- a/translations/messages.fr.yaml +++ b/translations/messages.fr.yaml @@ -1,3 +1,7 @@ +webgriffe: + ui: + back_in_stock_notification_subscriptions: 'Notification de produits' + webgriffe_bisn: form_submission: subscription_successfully: 'Inscription réussie, vérifiez votre e-mail !' diff --git a/translations/messages.it.yaml b/translations/messages.it.yaml index 307f4fc..98fe0cf 100644 --- a/translations/messages.it.yaml +++ b/translations/messages.it.yaml @@ -1,3 +1,7 @@ +webgriffe: + ui: + back_in_stock_notification_subscriptions: 'Notifiche prodotti non disponibili' + webgriffe_bisn: form_submission: subscription_successfully: 'Iscritto correttamente, verifica la tua email!'