diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1204b3c..7b34813 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,22 +15,17 @@ jobs: tests: runs-on: ubuntu-latest - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, - MySQL ${{ matrix.mysql }}" + 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.21", "^6.4"] - sylius: ["~1.13.0", "~1.14.0"] - node: ["^20.x"] + php: ["8.2", "8.3"] + symfony: ["^6.4", "^7.2"] + sylius: ["~2.0.0", "~2.1.0"] + node: ["22.x"] mysql: ["8.0"] - exclude: - - sylius: "~1.14.0" - symfony: ^5.4 - env: APP_ENV: test DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" @@ -66,11 +61,6 @@ jobs: - name: Install certificates run: symfony server:ca:install - - name: Run Chrome Headless - run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & - - - name: Run webserver - run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) - name: Get Composer cache directory id: composer-cache @@ -83,12 +73,14 @@ jobs: key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} restore-keys: | ${{ runner.os }}-php-${{ matrix.php }}-composer- + - name: Restrict Symfony version if: matrix.symfony != '' run: | composer global config --no-plugins allow-plugins.symfony/flex true composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" composer config extra.symfony.require "${{ matrix.symfony }}" + - name: Restrict Sylius version if: matrix.sylius != '' run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction @@ -107,28 +99,31 @@ 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:schema:create -vvv + - name: Prepare test application assets run: | - (cd tests/Application && bin/console assets:install public -vvv) - (cd tests/Application && yarn encore dev) + vendor/bin/console assets:install -vvv + yarn --cwd vendor/sylius/test-application encore 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: Validate composer.json run: composer validate --ansi --strict - 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 -c phpstan.neon -l 8 src/ @@ -139,6 +134,12 @@ jobs: - name: Run PHPSpec run: vendor/bin/phpspec run --ansi -f progress --no-interaction + - name: Run Chrome Headless + run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & + + - name: Run webserver + run: symfony server:start --port=8080 --daemon && symfony -V + - 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 38b0eca..8a90fc8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/var/ /vendor/ /node_modules/ /composer.lock @@ -15,3 +16,8 @@ /public/build /tests/Application/public/build /tests/Application/public/banner + +# TestApplication local files +/tests/TestApplication/.env.local +/tests/TestApplication/.env.test.local +/tests/TestApplication/.env.*.local diff --git a/assets/admin/controllers.json b/assets/admin/controllers.json new file mode 100644 index 0000000..e2ce9b5 --- /dev/null +++ b/assets/admin/controllers.json @@ -0,0 +1,4 @@ +{ + "controllers": [], + "entrypoints": [] +} diff --git a/src/Resources/assets/admin/js/index.js b/assets/admin/entrypoint.js similarity index 100% rename from src/Resources/assets/admin/js/index.js rename to assets/admin/entrypoint.js diff --git a/assets/shop/controllers.json b/assets/shop/controllers.json new file mode 100644 index 0000000..e2ce9b5 --- /dev/null +++ b/assets/shop/controllers.json @@ -0,0 +1,4 @@ +{ + "controllers": [], + "entrypoints": [] +} diff --git a/assets/shop/entrypoint.js b/assets/shop/entrypoint.js new file mode 100644 index 0000000..54a2de9 --- /dev/null +++ b/assets/shop/entrypoint.js @@ -0,0 +1 @@ +import './js'; diff --git a/assets/shop/js/index.js b/assets/shop/js/index.js new file mode 100644 index 0000000..309096b --- /dev/null +++ b/assets/shop/js/index.js @@ -0,0 +1,28 @@ +import Swiper from 'swiper'; +import { Navigation, Autoplay } from 'swiper/modules'; + +import 'swiper/css'; + +const bannersCarousels = document.querySelectorAll('.banners-carousel') + +for (let i= 0; i < bannersCarousels.length; i++ ) { + + bannersCarousels[i].classList.add(`banners-carousel-${i}`); + + const swiper = new Swiper(`.banners-carousel-${i}`, { + autoplay: { + delay: 5000, + }, + loop: true, + modules: [Navigation, Autoplay], + navigation: { + nextEl: `.banners-carousel-${i} .swiper-button-next`, + prevEl: `.banners-carousel-${i} .swiper-button-prev`, + }, + observeParents: true, + observer: true, + slidesPerView: 1, + spaceBetween: 32, + speed: 400, + }); +} diff --git a/behat.yml.dist b/behat.yml.dist index af6c70a..a5ef914 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -18,37 +18,22 @@ default: Behat\MinkExtension: files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/" - base_url: "http://127.0.0.1:8080/" + base_url: "https://127.0.0.1:8080/" default_session: symfony - javascript_session: chrome_headless + javascript_session: chrome sessions: symfony: symfony: ~ - chrome_headless: + chrome: chrome: socket_timeout: 120 api_url: http://127.0.0.1:9222 validate_certificate: false - chrome: - selenium2: - browser: chrome - capabilities: - browserName: chrome - browser: chrome - version: "" - marionette: null # https://github.com/Behat/MinkExtension/pull/311 - chrome: - switches: - - "start-fullscreen" - - "start-maximized" - - "no-sandbox" - extra_capabilities: - unexpectedAlertBehaviour: accept FriendsOfBehat\SymfonyExtension: - bootstrap: tests/Application/config/bootstrap.php + bootstrap: vendor/sylius/test-application/config/bootstrap.php kernel: - class: Tests\BitBag\SyliusBannerPlugin\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/composer.json b/composer.json index b214a4f..59fe385 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,8 @@ ], "license": "MIT", "require": { - "php": "^8.1", - "sylius/sylius": "^1.13" + "php": "^8.2", + "sylius/sylius": "^2.0" }, "require-dev": { "behat/behat": "^3.6.1", @@ -28,19 +28,20 @@ "friends-of-behat/variadic-extension": "^1.3", "phpspec/phpspec": "^7.0", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "1.4", + "phpstan/phpstan": "^1.4", "phpstan/phpstan-doctrine": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", "phpstan/phpstan-webmozart-assert": "^1.0", "phpunit/phpunit": "^9.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "sylius-labs/coding-standard": "^4.0", - "symfony/browser-kit": "^5.4 || ^6.4", - "symfony/debug-bundle": "^5.4 || ^6.4", - "symfony/dotenv": "^5.4 || ^6.4", - "symfony/intl": "^5.4 || ^6.4", - "symfony/web-profiler-bundle": "^5.4 || ^6.4", - "symfony/webpack-encore-bundle": "^1.14", + "sylius/test-application": "^2.0.0@alpha", + "symfony/browser-kit": "^6.4 || ^7.2", + "symfony/debug-bundle": "^6.4 || ^7.2", + "symfony/dotenv": "^6.4 || ^7.2", + "symfony/intl": "^6.4 || ^7.2", + "symfony/web-profiler-bundle": "^6.4 || ^7.2", + "symfony/webpack-encore-bundle": "^2.2", "doctrine/persistence": "^3.0" }, "conflict": { @@ -52,13 +53,16 @@ "dealerdirect/phpcodesniffer-composer-installer": true, "phpstan/extension-installer": true, "symfony/flex": true, - "symfony/thanks": true + "symfony/runtime": false, + "symfony/thanks": true, + "php-http/discovery": false } }, "extra": { "branch-alias": { - "dev-master": "1.10-dev" - } + "dev-master": "2.2-dev" + }, + "public-dir": "vendor/sylius/test-application/public" }, "autoload": { "psr-4": { @@ -67,17 +71,11 @@ } }, "autoload-dev": { - "classmap": ["tests/Application/Kernel.php"] - }, - "scripts": { - "post-install-cmd": [ - "php bin/create_node_symlink.php" - ], - "post-update-cmd": [ - "php bin/create_node_symlink.php" - ], - "post-create-project-cmd": [ - "php bin/create_node_symlink.php" - ] + "psr-4": { + "Tests\\BitBag\\SyliusBannerPlugin\\": [ + "tests/TestApplication/src", + "tests/Behat" + ] + } } } diff --git a/src/Resources/config/Resources/ad.yaml b/config/Resources/ad.yaml similarity index 100% rename from src/Resources/config/Resources/ad.yaml rename to config/Resources/ad.yaml diff --git a/src/Resources/config/Resources/banner.yaml b/config/Resources/banner.yaml similarity index 100% rename from src/Resources/config/Resources/banner.yaml rename to config/Resources/banner.yaml diff --git a/src/Resources/config/Resources/section.yaml b/config/Resources/section.yaml similarity index 100% rename from src/Resources/config/Resources/section.yaml rename to config/Resources/section.yaml diff --git a/config/api_resources/properties/Ad.xml b/config/api_resources/properties/Ad.xml new file mode 100644 index 0000000..f41a904 --- /dev/null +++ b/config/api_resources/properties/Ad.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/api_resources/properties/Banner.xml b/config/api_resources/properties/Banner.xml new file mode 100644 index 0000000..e05fd3a --- /dev/null +++ b/config/api_resources/properties/Banner.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/api_resources/properties/Section.xml b/config/api_resources/properties/Section.xml new file mode 100644 index 0000000..1ccb3f8 --- /dev/null +++ b/config/api_resources/properties/Section.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/config/api_resources/resources/shop/Ad.xml b/config/api_resources/resources/shop/Ad.xml new file mode 100644 index 0000000..a3d2cc3 --- /dev/null +++ b/config/api_resources/resources/shop/Ad.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + bitbag_sylius_banner:shop:ad:show + + + + + + + + diff --git a/config/api_resources/resources/shop/Banner.xml b/config/api_resources/resources/shop/Banner.xml new file mode 100644 index 0000000..00be45d --- /dev/null +++ b/config/api_resources/resources/shop/Banner.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + bitbag_sylius_banner:shop:banner:show + + + + + + + + + + + + bitbag_sylius_banner:shop:banner:index + + + + + + + + + + + + + + + + diff --git a/config/api_resources/resources/shop/Section.xml b/config/api_resources/resources/shop/Section.xml new file mode 100644 index 0000000..2a876a0 --- /dev/null +++ b/config/api_resources/resources/shop/Section.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + bitbag_sylius_banner:shop:section:show + + + + + + + + diff --git a/config/config.yaml b/config/config.yaml new file mode 100644 index 0000000..37c3595 --- /dev/null +++ b/config/config.yaml @@ -0,0 +1,18 @@ +imports: + - { resource: "services.xml" } + - { resource: "resources.yaml" } + - { resource: "grids/*.yaml" } + - { resource: "twig_hooks/**/*.yaml" } + +parameters: + bitbag_sylius_banner_plugin.uploader.filesystem: bitbag_sylius_banner_plugin_banner + bitbag_sylius_banner_plugin.images_dir: "%sylius_core.images_dir%" + + +flysystem: + storages: + bitbag_sylius_banner_plugin.image.storage: + adapter: 'local' + options: + directory: '%bitbag_sylius_banner_plugin.images_dir%' + directory_visibility: 'public' diff --git a/src/Resources/config/doctrine/Ad.orm.xml b/config/doctrine/Ad.orm.xml similarity index 100% rename from src/Resources/config/doctrine/Ad.orm.xml rename to config/doctrine/Ad.orm.xml diff --git a/src/Resources/config/doctrine/Banner.orm.xml b/config/doctrine/Banner.orm.xml similarity index 100% rename from src/Resources/config/doctrine/Banner.orm.xml rename to config/doctrine/Banner.orm.xml diff --git a/src/Resources/config/doctrine/Section.orm.xml b/config/doctrine/Section.orm.xml similarity index 100% rename from src/Resources/config/doctrine/Section.orm.xml rename to config/doctrine/Section.orm.xml diff --git a/config/grids/admin.yaml b/config/grids/admin.yaml new file mode 100644 index 0000000..ac44f01 --- /dev/null +++ b/config/grids/admin.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "admin/*.yaml" } diff --git a/src/Resources/config/grids/admin/ad.yaml b/config/grids/admin/ad.yaml similarity index 96% rename from src/Resources/config/grids/admin/ad.yaml rename to config/grids/admin/ad.yaml index 1b42f2a..3f3d841 100644 --- a/src/Resources/config/grids/admin/ad.yaml +++ b/config/grids/admin/ad.yaml @@ -29,7 +29,7 @@ sylius_grid: label: sylius.ui.enabled sortable: ~ options: - template: "@SyliusUi/Grid/Field/enabled.html.twig" + template: "@SyliusUi/grid/field/enabled.html.twig" actions: main: create: diff --git a/src/Resources/config/grids/admin/banner.yaml b/config/grids/admin/banner.yaml similarity index 100% rename from src/Resources/config/grids/admin/banner.yaml rename to config/grids/admin/banner.yaml diff --git a/src/Resources/config/grids/admin/section.yaml b/config/grids/admin/section.yaml similarity index 100% rename from src/Resources/config/grids/admin/section.yaml rename to config/grids/admin/section.yaml diff --git a/src/Resources/config/resources.yaml b/config/resources.yaml similarity index 100% rename from src/Resources/config/resources.yaml rename to config/resources.yaml diff --git a/src/Resources/config/routing.yaml b/config/routing.yaml similarity index 52% rename from src/Resources/config/routing.yaml rename to config/routing.yaml index b8ee591..ded5324 100644 --- a/src/Resources/config/routing.yaml +++ b/config/routing.yaml @@ -1,8 +1,8 @@ bitbag_admin: - resource: "@BitBagSyliusBannerPlugin/Resources/config/routing/admin.yaml" + resource: "@BitBagSyliusBannerPlugin/config/routing/admin.yaml" prefix: /admin app_shop: - resource: "@BitBagSyliusBannerPlugin/Resources/config/routing/shop.yaml" + resource: "@BitBagSyliusBannerPlugin/config/routing/shop.yaml" prefix: /{_locale} requirements: _locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$ diff --git a/src/Resources/config/routing/admin.yaml b/config/routing/admin.yaml similarity index 59% rename from src/Resources/config/routing/admin.yaml rename to config/routing/admin.yaml index 53878ab..6977549 100644 --- a/src/Resources/config/routing/admin.yaml +++ b/config/routing/admin.yaml @@ -4,15 +4,11 @@ bitbag_sylius_banner_plugin_ad: section: admin path: /banner/ad permission: true - only: [show, update, delete, create, index] - templates: "@SyliusAdmin\\Crud" + only: [update, delete, create, index] + templates: "@SyliusAdmin\\shared\\crud" redirect: update grid: bitbag_sylius_banner_plugin_ad - vars: - all: - subheader: bitbag_sylius_banner_plugin.ui.ad - index: - icon: 'tags' + type: sylius.resource bitbag_sylius_banner_plugin_banner: @@ -21,15 +17,13 @@ bitbag_sylius_banner_plugin_banner: section: admin path: /banner/banner permission: true - only: [show, update, delete, create, index] - templates: "@SyliusAdmin\\Crud" + only: [update, delete, create, index] + templates: "@SyliusAdmin\\shared\\crud" redirect: update grid: bitbag_sylius_banner_plugin_banner vars: all: subheader: bitbag_sylius_banner_plugin.ui.banner - templates: - form: "@BitBagSyliusBannerPlugin/Admin/Banner/_form.html.twig" index: icon: 'tags' type: sylius.resource @@ -40,13 +34,8 @@ bitbag_sylius_banner_plugin_section: section: admin path: /banner/section permission: true - only: [show, update, delete, create, index] - templates: "@SyliusAdmin\\Crud" + only: [update, delete, create, index] + templates: "@SyliusAdmin\\shared\\crud" redirect: update grid: bitbag_sylius_banner_plugin_section - vars: - all: - subheader: bitbag_sylius_banner_plugin.ui.section - index: - icon: 'tags' type: sylius.resource diff --git a/src/Resources/config/routing/shop.yaml b/config/routing/shop.yaml similarity index 100% rename from src/Resources/config/routing/shop.yaml rename to config/routing/shop.yaml diff --git a/config/serialization/Ad.xml b/config/serialization/Ad.xml new file mode 100644 index 0000000..4e50407 --- /dev/null +++ b/config/serialization/Ad.xml @@ -0,0 +1,30 @@ + + + + + + bitbag_sylius_banner:shop:ad:show + + + bitbag_sylius_banner:shop:ad:show + + + bitbag_sylius_banner:shop:ad:show + + + bitbag_sylius_banner:shop:ad:show + + + bitbag_sylius_banner:shop:ad:show + + + bitbag_sylius_banner:shop:ad:show + + + bitbag_sylius_banner:shop:ad:show + + + diff --git a/config/serialization/Banner.xml b/config/serialization/Banner.xml new file mode 100644 index 0000000..ece5585 --- /dev/null +++ b/config/serialization/Banner.xml @@ -0,0 +1,45 @@ + + + + + + bitbag_sylius_banner:shop:banner:index + bitbag_sylius_banner:shop:banner:show + + + bitbag_sylius_banner:shop:banner:index + bitbag_sylius_banner:shop:banner:show + + + bitbag_sylius_banner:shop:banner:index + bitbag_sylius_banner:shop:banner:show + + + bitbag_sylius_banner:shop:banner:index + bitbag_sylius_banner:shop:banner:show + + + bitbag_sylius_banner:shop:banner:index + bitbag_sylius_banner:shop:banner:show + + + bitbag_sylius_banner:shop:banner:index + bitbag_sylius_banner:shop:banner:show + + + bitbag_sylius_banner:shop:banner:index + bitbag_sylius_banner:shop:banner:show + + + bitbag_sylius_banner:shop:banner:index + bitbag_sylius_banner:shop:banner:show + + + bitbag_sylius_banner:shop:banner:index + bitbag_sylius_banner:shop:banner:show + + + diff --git a/src/Resources/config/serialization/Section.xml b/config/serialization/Section.xml similarity index 51% rename from src/Resources/config/serialization/Section.xml rename to config/serialization/Section.xml index e721be2..9c49dfb 100644 --- a/src/Resources/config/serialization/Section.xml +++ b/config/serialization/Section.xml @@ -2,24 +2,23 @@ - + - shop:adsBanners:read + bitbag_sylius_banner:shop:section:show - shop:adsBanners:read + bitbag_sylius_banner:shop:section:show - shop:adsBanners:read + bitbag_sylius_banner:shop:section:show - shop:adsBanners:read + bitbag_sylius_banner:shop:section:show - shop:adsBanners:read + bitbag_sylius_banner:shop:section:show diff --git a/src/Resources/config/services.xml b/config/services.xml similarity index 54% rename from src/Resources/config/services.xml rename to config/services.xml index 19dfda3..566ba28 100644 --- a/src/Resources/config/services.xml +++ b/config/services.xml @@ -5,8 +5,10 @@ - - - + + + + + diff --git a/src/Resources/config/services/EventListener/Banner.xml b/config/services/EventListener/Banner.xml similarity index 100% rename from src/Resources/config/services/EventListener/Banner.xml rename to config/services/EventListener/Banner.xml diff --git a/src/Resources/config/services/controller/action.xml b/config/services/controller/action.xml similarity index 100% rename from src/Resources/config/services/controller/action.xml rename to config/services/controller/action.xml diff --git a/src/Resources/config/services/dataProvider/dataProvider.xml b/config/services/dataProvider/dataProvider.xml similarity index 62% rename from src/Resources/config/services/dataProvider/dataProvider.xml rename to config/services/dataProvider/dataProvider.xml index c5a47b4..33a0777 100644 --- a/src/Resources/config/services/dataProvider/dataProvider.xml +++ b/config/services/dataProvider/dataProvider.xml @@ -6,13 +6,13 @@ http://symfony.com/schema/dic/services/services-1.0.xsd" > - - %bitbag_sylius_banner_plugin.model.banner.class% - + + diff --git a/src/Resources/config/services/form/form.xml b/config/services/form/form.xml similarity index 100% rename from src/Resources/config/services/form/form.xml rename to config/services/form/form.xml diff --git a/src/Resources/config/services/generator/generator.xml b/config/services/generator/generator.xml similarity index 100% rename from src/Resources/config/services/generator/generator.xml rename to config/services/generator/generator.xml diff --git a/src/Resources/config/services/menu/adminMenu.xml b/config/services/menu/adminMenu.xml similarity index 100% rename from src/Resources/config/services/menu/adminMenu.xml rename to config/services/menu/adminMenu.xml diff --git a/src/Resources/config/services/operator/operator.xml b/config/services/operator/operator.xml similarity index 100% rename from src/Resources/config/services/operator/operator.xml rename to config/services/operator/operator.xml diff --git a/src/Resources/config/services/provider/provider.xml b/config/services/provider/provider.xml similarity index 100% rename from src/Resources/config/services/provider/provider.xml rename to config/services/provider/provider.xml diff --git a/src/Resources/config/services/serializer/serializer.xml b/config/services/serializer/serializer.xml similarity index 100% rename from src/Resources/config/services/serializer/serializer.xml rename to config/services/serializer/serializer.xml diff --git a/src/Resources/config/services/twig/extension.xml b/config/services/twig/extension.xml similarity index 100% rename from src/Resources/config/services/twig/extension.xml rename to config/services/twig/extension.xml diff --git a/src/Resources/config/services/uploader/banner.xml b/config/services/uploader/banner.xml similarity index 75% rename from src/Resources/config/services/uploader/banner.xml rename to config/services/uploader/banner.xml index d96832d..38cf4b1 100644 --- a/src/Resources/config/services/uploader/banner.xml +++ b/config/services/uploader/banner.xml @@ -16,12 +16,8 @@ - - + + diff --git a/src/Resources/config/services/validator/ad.xml b/config/services/validator/ad.xml similarity index 100% rename from src/Resources/config/services/validator/ad.xml rename to config/services/validator/ad.xml diff --git a/src/Resources/config/services/validator/banner.xml b/config/services/validator/banner.xml similarity index 100% rename from src/Resources/config/services/validator/banner.xml rename to config/services/validator/banner.xml diff --git a/config/twig_hooks/admin/banner/create.yaml b/config/twig_hooks/admin/banner/create.yaml new file mode 100644 index 0000000..c9a3e77 --- /dev/null +++ b/config/twig_hooks/admin/banner/create.yaml @@ -0,0 +1,44 @@ +sylius_twig_hooks: + hooks: + 'sylius_admin.banner.create.content.form.sections': + general: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/general.html.twig' + priority: 100 + media: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media.html.twig' + priority: 0 + + 'sylius_admin.banner.create.content.form.sections.general': + default: + enabled: false + locale: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/general/locale.html.twig' + priority: 300 + section: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/general/section.html.twig' + priority: 200 + priority: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/general/priority.html.twig' + priority: 100 + ads: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/general/ads.html.twig' + priority: 0 + + 'sylius_admin.banner.create.content.form.sections.media': + preview: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media/preview.html.twig' + priority: 200 + upload: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media/upload.html.twig' + priority: 100 + fields: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media/fields.html.twig' + priority: 0 + + 'sylius_admin.banner.create.content.form.sections.media.fields': + link: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media/fields/link.html.twig' + priority: 100 + alt: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media/fields/alt.html.twig' + priority: 0 diff --git a/config/twig_hooks/admin/banner/update.yaml b/config/twig_hooks/admin/banner/update.yaml new file mode 100644 index 0000000..ee06422 --- /dev/null +++ b/config/twig_hooks/admin/banner/update.yaml @@ -0,0 +1,44 @@ +sylius_twig_hooks: + hooks: + 'sylius_admin.banner.update.content.form.sections': + general: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/general.html.twig' + priority: 100 + media: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media.html.twig' + priority: 0 + + 'sylius_admin.banner.update.content.form.sections.general': + default: + enabled: false + locale: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/general/locale.html.twig' + priority: 300 + section: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/general/section.html.twig' + priority: 200 + priority: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/general/priority.html.twig' + priority: 100 + ads: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/general/ads.html.twig' + priority: 0 + + 'sylius_admin.banner.update.content.form.sections.media': + preview: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media/preview.html.twig' + priority: 200 + upload: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media/upload.html.twig' + priority: 100 + fields: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media/fields.html.twig' + priority: 0 + + 'sylius_admin.banner.update.content.form.sections.media.fields': + link: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media/fields/link.html.twig' + priority: 100 + alt: + template: '@BitBagSyliusBannerPlugin/admin/banner/form/sections/media/fields/alt.html.twig' + priority: 0 diff --git a/src/Resources/config/validation/ad.xml b/config/validation/ad.xml similarity index 100% rename from src/Resources/config/validation/ad.xml rename to config/validation/ad.xml diff --git a/src/Resources/config/validation/banner.xml b/config/validation/banner.xml similarity index 100% rename from src/Resources/config/validation/banner.xml rename to config/validation/banner.xml diff --git a/src/Resources/config/validation/section.xml b/config/validation/section.xml similarity index 100% rename from src/Resources/config/validation/section.xml rename to config/validation/section.xml diff --git a/doc/installation.md b/doc/installation.md index 1ffc942..7132109 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -69,6 +69,25 @@ bin/console doctrine:migrations:migrate ``` **Note:** If you are running it on production, add the `-e prod` flag to this command. +### Install assets: + +Add the following line to your `assets/admin/entrypoint.js` file: + +``` +import '../../vendor/bitbag/banner-plugin/assets/admin/entrypoint'; +``` + +And the following line to your `assets/shop/entrypoint.js` file: + +``` +import '../../vendor/bitbag/banner-plugin/assets/shop/entrypoint'; +``` + +Then, run the following commands to install assets: +```bash +Run yarn encore dev or yarn encore production +``` + ### Clear application cache by using command: ```bash bin/console cache:clear 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/phpstan.neon b/phpstan.neon index f7eee75..602f990 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,15 +1,12 @@ parameters: reportUnmatchedIgnoredErrors: false - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false - excludes_analyse: + excludePaths: # Makes PHPStan crash - 'src/DependencyInjection/Configuration.php' # Test dependencies - - 'tests/Application/app/**.php' - - 'tests/Application/src/**.php' + - 'tests/TestApplication/src/**.php' ignoreErrors: - '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./' diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5545957..4f520ff 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,7 @@ - - - + diff --git a/spec/Uploader/BannerUploaderSpec.php b/spec/Uploader/BannerUploaderSpec.php index 31ecc7a..12f4c9f 100644 --- a/spec/Uploader/BannerUploaderSpec.php +++ b/spec/Uploader/BannerUploaderSpec.php @@ -15,23 +15,21 @@ use BitBag\SyliusBannerPlugin\Generator\BannerPathGeneratorInterface; use BitBag\SyliusBannerPlugin\Uploader\BannerUploader; use BitBag\SyliusBannerPlugin\Uploader\BannerUploaderInterface; -use Gaufrette\Filesystem; use PhpSpec\ObjectBehavior; -use Prophecy\Argument; -use Sylius\Component\Channel\Context\ChannelContextInterface; +use Sylius\Component\Core\Filesystem\Adapter\FilesystemAdapterInterface; use Symfony\Component\HttpFoundation\File\File; final class BannerUploaderSpec extends ObjectBehavior { public function let( - Filesystem $filesystem, + FilesystemAdapterInterface $filesystem, BannerInterface $banner, BannerPathGeneratorInterface $bannerPathGenerator ): void { $file = new File(__FILE__); $banner->getFile()->willReturn($file); - $this->beConstructedWith($filesystem,$bannerPathGenerator); + $this->beConstructedWith($filesystem, $bannerPathGenerator); } public function it_is_initializable(): void @@ -40,12 +38,8 @@ public function it_is_initializable(): void $this->shouldImplement(BannerUploaderInterface::class); } - public function it_removes_an_image_if_exists(Filesystem $filesystem): void + public function it_removes_an_image_if_exists(FilesystemAdapterInterface $filesystem): void { - $filesystem->has('path/to/img')->willReturn(true); - $filesystem->delete('path/to/img')->willReturn(true); - - $filesystem->has('path/to/img')->shouldBeCalled(); $filesystem->delete('path/to/img')->shouldBeCalled(); $this->remove('path/to/img'); diff --git a/src/BitBagSyliusBannerPlugin.php b/src/BitBagSyliusBannerPlugin.php index cd0ac9b..6799bf5 100644 --- a/src/BitBagSyliusBannerPlugin.php +++ b/src/BitBagSyliusBannerPlugin.php @@ -17,4 +17,9 @@ final class BitBagSyliusBannerPlugin extends Bundle { use SyliusPluginTrait; + + public function getPath(): string + { + return \dirname(__DIR__); + } } diff --git a/src/DependencyInjection/BitBagSyliusBannerExtension.php b/src/DependencyInjection/BitBagSyliusBannerExtension.php index 5c9be22..d8ca5ff 100644 --- a/src/DependencyInjection/BitBagSyliusBannerExtension.php +++ b/src/DependencyInjection/BitBagSyliusBannerExtension.php @@ -11,7 +11,6 @@ namespace BitBag\SyliusBannerPlugin\DependencyInjection; -use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; @@ -25,13 +24,8 @@ final class BitBagSyliusBannerExtension extends Extension public function load(array $configs, ContainerBuilder $container): void { $config = $this->processConfiguration($this->getConfiguration([], $container), $configs); - $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); + $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config')); $loader->load('services.xml'); } - - public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface - { - return new Configuration(); - } } diff --git a/src/Menu/AdminMenuListener.php b/src/Menu/AdminMenuListener.php index ff3b483..437fcec 100644 --- a/src/Menu/AdminMenuListener.php +++ b/src/Menu/AdminMenuListener.php @@ -22,31 +22,52 @@ public function buildMenu(MenuBuilderEvent $event): void $newSubmenu = $menu ->addChild('bitbag_sylius_banner_plugin') ->setLabel('bitbag_sylius_banner_plugin.ui.banners') - ->setLabelAttribute('icon', 'images outline') + ->setLabelAttribute('icon', 'tabler:photo') ; $newSubmenu ->addChild('ads', [ 'route' => 'bitbag_sylius_banner_plugin_admin_ad_index', + 'extras' => [ + 'routes' => [ + ['route' => 'bitbag_sylius_banner_plugin_admin_ad_create'], + ['route' => 'bitbag_sylius_banner_plugin_admin_ad_update'], + ['route' => 'bitbag_sylius_banner_plugin_admin_ad_show'], + ], + ], ]) ->setLabel('bitbag_sylius_banner_plugin.ui.ad') - ->setLabelAttribute('icon', 'adversal') + ->setLabelAttribute('icon', 'tabler:ad') ; $newSubmenu ->addChild('banners', [ 'route' => 'bitbag_sylius_banner_plugin_admin_banner_index', + 'extras' => [ + 'routes' => [ + ['route' => 'bitbag_sylius_banner_plugin_admin_banner_create'], + ['route' => 'bitbag_sylius_banner_plugin_admin_banner_update'], + ['route' => 'bitbag_sylius_banner_plugin_admin_banner_show'], + ], + ], ]) ->setLabel('bitbag_sylius_banner_plugin.ui.banner') - ->setLabelAttribute('icon', 'file image outline') + ->setLabelAttribute('icon', 'tabler:photo') ; $newSubmenu ->addChild('section', [ 'route' => 'bitbag_sylius_banner_plugin_admin_section_index', + 'extras' => [ + 'routes' => [ + ['route' => 'bitbag_sylius_banner_plugin_admin_section_create'], + ['route' => 'bitbag_sylius_banner_plugin_admin_section_update'], + ['route' => 'bitbag_sylius_banner_plugin_admin_section_show'], + ], + ], ]) ->setLabel('bitbag_sylius_banner_plugin.ui.section') - ->setLabelAttribute('icon', 'external alternate') + ->setLabelAttribute('icon', 'tabler:layout-grid') ; } } diff --git a/src/Operator/BannersOperatorInterface.php b/src/Operator/BannersOperatorInterface.php index 57cd3ef..5033f4a 100644 --- a/src/Operator/BannersOperatorInterface.php +++ b/src/Operator/BannersOperatorInterface.php @@ -12,9 +12,11 @@ namespace BitBag\SyliusBannerPlugin\Operator; use BitBag\SyliusBannerPlugin\Entity\AdInterface; +use BitBag\SyliusBannerPlugin\Entity\BannerInterface; interface BannersOperatorInterface { + /** @return array|null */ public function operate( AdInterface $ad, string $sectionCode, diff --git a/src/Provider/BannersProviderInterface.php b/src/Provider/BannersProviderInterface.php index 9640ce3..40a182c 100644 --- a/src/Provider/BannersProviderInterface.php +++ b/src/Provider/BannersProviderInterface.php @@ -12,15 +12,22 @@ namespace BitBag\SyliusBannerPlugin\Provider; use BitBag\SyliusBannerPlugin\Entity\AdInterface; +use BitBag\SyliusBannerPlugin\Entity\BannerInterface; interface BannersProviderInterface { + /** + * @param array $ads + * + * @return array|null + */ public function getAdsBanners( array $ads, string $sectionCode, string $localeCode, ): ?array; + /** @return array|null */ public function getAdBanners( AdInterface $ad, string $sectionCode, diff --git a/src/Repository/AdRepositoryInterface.php b/src/Repository/AdRepositoryInterface.php index 65936e1..fff79a4 100644 --- a/src/Repository/AdRepositoryInterface.php +++ b/src/Repository/AdRepositoryInterface.php @@ -15,6 +15,7 @@ interface AdRepositoryInterface { + /** @return array */ public function findAllActiveAds(): array; public function findActiveAdByCode(string $code): ?AdInterface; diff --git a/src/Repository/BannerRepository.php b/src/Repository/BannerRepository.php index c35fcdc..856cef2 100644 --- a/src/Repository/BannerRepository.php +++ b/src/Repository/BannerRepository.php @@ -29,10 +29,8 @@ public function findAdBannersByLocaleAndSection(string $sectionCode, string $loc ->innerJoin('b.section', 's') ->andWhere('s.code = :sectionCode') ->andWhere('l.code = :localeCode') - ->setParameters([ - 'sectionCode' => $sectionCode, - 'localeCode' => $localeCode, - ]) + ->setParameter('sectionCode', $sectionCode) + ->setParameter('localeCode', $localeCode) ->addOrderBy('b.priority', 'DESC') ->getQuery() ->getResult(); diff --git a/src/Repository/BannerRepositoryInterface.php b/src/Repository/BannerRepositoryInterface.php index 443cbf4..9ceba91 100644 --- a/src/Repository/BannerRepositoryInterface.php +++ b/src/Repository/BannerRepositoryInterface.php @@ -11,6 +11,7 @@ namespace BitBag\SyliusBannerPlugin\Repository; +use BitBag\SyliusBannerPlugin\Entity\BannerInterface; use Doctrine\ORM\QueryBuilder; use Sylius\Component\Resource\Repository\RepositoryInterface; @@ -18,5 +19,6 @@ interface BannerRepositoryInterface extends RepositoryInterface { public function createBuilder(): QueryBuilder; + /** @return array */ public function findAdBannersByLocaleAndSection(string $sectionCode, string $localeCode): array; } diff --git a/src/Resources/assets/admin/entry.js b/src/Resources/assets/admin/entry.js deleted file mode 100644 index 03d46d7..0000000 --- a/src/Resources/assets/admin/entry.js +++ /dev/null @@ -1,4 +0,0 @@ -import './scss/main.scss' - -import './js' -import './js/previewBannerImage' diff --git a/src/Resources/assets/admin/js/previewBannerImage.js b/src/Resources/assets/admin/js/previewBannerImage.js deleted file mode 100644 index 0e0ce1d..0000000 --- a/src/Resources/assets/admin/js/previewBannerImage.js +++ /dev/null @@ -1,49 +0,0 @@ -(function ( $ ) { - 'use strict'; - - $.fn.extend({ - previewUploadedImage: function (root) { - $(root + ' input[type="file"]').each(function() { - $(this).change(function() { - displayUploadedImage(this); - }); - }); - - $(root + ' [data-form-collection="add"]').on('click', function() { - var self = $(this); - - setTimeout(function() { - self.parent().find('.column:last-child input[type="file"]').on('change', function() { - displayUploadedImage(this); - }); - }, 500); - }); - } - }); - - function displayUploadedImage(input) { - if (input.files && input.files[0]) { - var reader = new FileReader(); - - reader.onload = function (e) { - var image = $(input).parent().siblings('.image'); - - if (image.length > 0) { - image.attr('src', e.target.result); - } else { - var img = $(''); - img.attr('src', e.target.result); - $(input).parent().before(img); - } - }; - - reader.readAsDataURL(input.files[0]); - } - } -})( jQuery ); - -(function($) { - $(document).ready(function () { - $(document).previewUploadedImage('#bitbag-banner-image') - }); -})(jQuery); diff --git a/src/Resources/assets/shop/entry.js b/src/Resources/assets/shop/entry.js deleted file mode 100644 index 981af38..0000000 --- a/src/Resources/assets/shop/entry.js +++ /dev/null @@ -1,3 +0,0 @@ -import './scss/main.scss' - -import './js' diff --git a/src/Resources/assets/shop/js/bannerCarousel.js b/src/Resources/assets/shop/js/bannerCarousel.js deleted file mode 100644 index fd66dbf..0000000 --- a/src/Resources/assets/shop/js/bannerCarousel.js +++ /dev/null @@ -1,11 +0,0 @@ -import 'slick-carousel'; - -$('.js-banners-carousel').slick({ - infinite: true, - slidesToShow: 1, - slidesToScroll: 1, - prevArrow: $('.js-banners-nav-left'), - nextArrow: $('.js-banners-nav-right'), - appendArrows: false -}); - diff --git a/src/Resources/assets/shop/js/index.js b/src/Resources/assets/shop/js/index.js deleted file mode 100644 index 26b8dab..0000000 --- a/src/Resources/assets/shop/js/index.js +++ /dev/null @@ -1 +0,0 @@ -import './bannerCarousel'; diff --git a/src/Resources/assets/shop/scss/components/_banners-carousel.scss b/src/Resources/assets/shop/scss/components/_banners-carousel.scss deleted file mode 100644 index 6d0bbfe..0000000 --- a/src/Resources/assets/shop/scss/components/_banners-carousel.scss +++ /dev/null @@ -1,48 +0,0 @@ -.banners-wrapper { - position: relative; - width: 100%; - height: 600px; - margin-bottom: 45px; -} - -.banners-carousel { - width: 100%; - height: 100%; - - .slick-list, - .slick-track, - .slick-slide > div { - height: 100%; - } -} - -.banners-slide { - height: 100%; - overflow: hidden; -} - -.banners-item { - display: block; - height: 100%; - - img { - width: 100%; - height: 100%; - object-fit: cover; - } -} - -.banners-nav-left, -.banners-nav-right { - position: absolute; - top: 50%; - transform: translateY(-50%); -} - -.banners-nav-left { - left: 30px; -} - -.banners-nav-right { - right: 30px; -} diff --git a/src/Resources/assets/shop/scss/components/main.scss b/src/Resources/assets/shop/scss/components/main.scss deleted file mode 100644 index a9bab67..0000000 --- a/src/Resources/assets/shop/scss/components/main.scss +++ /dev/null @@ -1 +0,0 @@ -@import './banners-carousel'; diff --git a/src/Resources/assets/shop/scss/main.scss b/src/Resources/assets/shop/scss/main.scss deleted file mode 100644 index e5aeb0e..0000000 --- a/src/Resources/assets/shop/scss/main.scss +++ /dev/null @@ -1 +0,0 @@ -@import './components/main.scss'; diff --git a/src/Resources/config/api_resources/Ad.xml b/src/Resources/config/api_resources/Ad.xml deleted file mode 100644 index 0a85689..0000000 --- a/src/Resources/config/api_resources/Ad.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - sylius - - - - - - - - - - diff --git a/src/Resources/config/api_resources/Banner.xml b/src/Resources/config/api_resources/Banner.xml deleted file mode 100644 index 3e458f6..0000000 --- a/src/Resources/config/api_resources/Banner.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - sylius - - - - GET - /shop/ads/banners - - - GET - /shop/ad/banners - - - - - - - - - - - - - - diff --git a/src/Resources/config/api_resources/Section.xml b/src/Resources/config/api_resources/Section.xml deleted file mode 100644 index 481fab2..0000000 --- a/src/Resources/config/api_resources/Section.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - sylius - - - - - - - - - diff --git a/src/Resources/config/config.yaml b/src/Resources/config/config.yaml deleted file mode 100644 index 6f01f2a..0000000 --- a/src/Resources/config/config.yaml +++ /dev/null @@ -1,31 +0,0 @@ -imports: - - { resource: "@BitBagSyliusBannerPlugin/Resources/config/services.xml" } - - { resource: "@BitBagSyliusBannerPlugin/Resources/config/resources.yaml" } - - { resource: "@BitBagSyliusBannerPlugin/Resources/config/grids/*.yaml" } - -parameters: - bitbag_sylius_banner_plugin.uploader.filesystem: bitbag_sylius_banner_plugin_banner - -knp_gaufrette: - adapters: - bitbag_sylius_banner_plugin_banner: - local: - directory: "%sylius_core.public_dir%" - create: true - filesystems: - bitbag_sylius_banner_plugin_banner: - adapter: "%bitbag_sylius_banner_plugin.uploader.filesystem%" - -liip_imagine: - loaders: - default: - filesystem: - data_root: - - "%kernel.project_dir%/public" -sylius_ui: - events: - sylius.shop.homepage: - blocks: - banner: - template: "@BitBagSyliusBannerPlugin/Shop/Homepage/_banner.html.twig" - priority: 60 diff --git a/src/Resources/config/grids/admin.yaml b/src/Resources/config/grids/admin.yaml deleted file mode 100644 index b2da156..0000000 --- a/src/Resources/config/grids/admin.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "@BitBagSyliusBannerPlugin/Resources/config/grids/admin/*.yaml" } diff --git a/src/Resources/config/serialization/Banner.xml b/src/Resources/config/serialization/Banner.xml deleted file mode 100644 index 206cf1a..0000000 --- a/src/Resources/config/serialization/Banner.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - shop:adsBanners:read - - - shop:adsBanners:read - - - shop:adsBanners:read - - - shop:adsBanners:read - - - shop:adsBanners:read - - - shop:adsBanners:read - - - shop:adsBanners:read - - - - - - - diff --git a/src/Resources/public/entrypoints.json b/src/Resources/public/entrypoints.json deleted file mode 100644 index 7fa1b37..0000000 --- a/src/Resources/public/entrypoints.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "entrypoints": { - "bitbag-syliusBannerPlugin-shop": { - "css": [ - "/public/bitbag-syliusBannerPlugin-shop.css" - ], - "js": [ - "/public/bitbag-syliusBannerPlugin-shop.js" - ] - }, - "bitbag-syliusBannerPlugin-admin": { - "css": [ - "/public/bitbag-syliusBannerPlugin-admin.css" - ], - "js": [ - "/public/bitbag-syliusBannerPlugin-admin.js" - ] - } - } -} diff --git a/src/Resources/public/manifest.json b/src/Resources/public/manifest.json deleted file mode 100644 index c284615..0000000 --- a/src/Resources/public/manifest.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "public/bitbag-syliusBannerPlugin-shop.css": "/public/bitbag-syliusBannerPlugin-shop.css", - "public/bitbag-syliusBannerPlugin-shop.js": "/public/bitbag-syliusBannerPlugin-shop.js", - "public/bitbag-syliusBannerPlugin-admin.css": "/public/bitbag-syliusBannerPlugin-admin.css", - "public/bitbag-syliusBannerPlugin-admin.js": "/public/bitbag-syliusBannerPlugin-admin.js" -} diff --git a/src/Resources/views/Admin/Banner/_form.html.twig b/src/Resources/views/Admin/Banner/_form.html.twig deleted file mode 100644 index 9dc5a43..0000000 --- a/src/Resources/views/Admin/Banner/_form.html.twig +++ /dev/null @@ -1,44 +0,0 @@ -{% form_theme form '@SyliusUi/Form/imagesTheme.html.twig' %} - -
- {{ form_errors(form) }} -
-
-

{{ 'sylius.ui.general_info'|trans }}

-
- {{ form_row(form.locale) }} -
-
- {{ form_row(form.section) }} -
-
- {{ form_row(form.priority) }} -
-
- {{ form_row(form.ads) }} -
-
-
-

{{ 'bitbag_sylius_banner_plugin.ui.banner'|trans }}

- {% if form.vars.value.path|default(null) is not null %} - {{ form.vars.value.alt }} - {% endif %} - -
- -
-
- {{- form_errors(form.file) -}} -
-
- {{ form_row(form.link) }} -
-
- {{ form_row(form.alt) }} -
-
-
- -
diff --git a/src/Resources/views/Shop/Homepage/_banner.html.twig b/src/Resources/views/Shop/Homepage/_banner.html.twig deleted file mode 100644 index 27c8e9d..0000000 --- a/src/Resources/views/Shop/Homepage/_banner.html.twig +++ /dev/null @@ -1,32 +0,0 @@ -{% set banners = getActiveAdsBanners('TEST', sylius.localeCode) %} - -{% if banners and banners|length %} -
- - - - - -
-{% endif %} diff --git a/src/DataProvider/GetAdsBannersDataProvider.php b/src/StateProvider/Shop/Banner/CollectionProvider.php similarity index 56% rename from src/DataProvider/GetAdsBannersDataProvider.php rename to src/StateProvider/Shop/Banner/CollectionProvider.php index a61991d..a0653ab 100644 --- a/src/DataProvider/GetAdsBannersDataProvider.php +++ b/src/StateProvider/Shop/Banner/CollectionProvider.php @@ -9,35 +9,34 @@ declare(strict_types=1); -namespace BitBag\SyliusBannerPlugin\DataProvider; +namespace BitBag\SyliusBannerPlugin\StateProvider\Shop\Banner; -use ApiPlatform\Core\DataProvider\ContextAwareCollectionDataProviderInterface; -use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface; +use ApiPlatform\Metadata\GetCollection; +use ApiPlatform\Metadata\Operation; +use ApiPlatform\State\ProviderInterface; +use BitBag\SyliusBannerPlugin\Entity\BannerInterface; use BitBag\SyliusBannerPlugin\Provider\BannersProviderInterface; use BitBag\SyliusBannerPlugin\Repository\AdRepositoryInterface; +use Sylius\Bundle\ApiBundle\SectionResolver\ShopApiSection; +use Sylius\Bundle\CoreBundle\SectionResolver\SectionProviderInterface; +use Webmozart\Assert\Assert; -final class GetAdsBannersDataProvider implements ContextAwareCollectionDataProviderInterface, RestrictedDataProviderInterface +/** @implements ProviderInterface */ +final class CollectionProvider implements ProviderInterface { public function __construct( - private AdRepositoryInterface $adRepository, - private BannersProviderInterface $bannersProvider, - private string $class, + private readonly AdRepositoryInterface $adRepository, + private readonly BannersProviderInterface $bannersProvider, + private readonly SectionProviderInterface $sectionProvider, ) { } - public function supports( - string $resourceClass, - string $operationName = null, - array $context = [], - ): bool { - return $this->class === $resourceClass; - } + public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + Assert::true(is_a((string) $operation->getClass(), BannerInterface::class, true)); + Assert::isInstanceOf($operation, GetCollection::class); + Assert::isInstanceOf($this->sectionProvider->getSection(), ShopApiSection::class); - public function getCollection( - string $resourceClass, - string $operationName = null, - array $context = [], - ): iterable { $localeCode = $context['filters']['locale_code'] ?? null; $sectionCode = $context['filters']['section_code'] ?? null; $adCode = $context['filters']['ad_code'] ?? null; diff --git a/src/Twig/Extension/BannerExtension.php b/src/Twig/Extension/BannerExtension.php index 6e9cae8..b2c5f8f 100644 --- a/src/Twig/Extension/BannerExtension.php +++ b/src/Twig/Extension/BannerExtension.php @@ -11,6 +11,7 @@ namespace BitBag\SyliusBannerPlugin\Twig\Extension; +use BitBag\SyliusBannerPlugin\Entity\BannerInterface; use BitBag\SyliusBannerPlugin\Provider\BannersProviderInterface; use BitBag\SyliusBannerPlugin\Repository\AdRepositoryInterface; use Twig\Extension\AbstractExtension; @@ -36,6 +37,7 @@ public function getFunctions(): array ]; } + /** @return array|null */ public function getActiveAdsBannersBySectionAndLocale( string $sectionCode, string $localeCode, @@ -49,6 +51,7 @@ public function getActiveAdsBannersBySectionAndLocale( return $this->bannersProvider->getAdsBanners($ads, $sectionCode, $localeCode); } + /** @return array|null */ public function getActiveAdBannersByCodeSectionAndLocale( string $adCode, string $sectionCode, diff --git a/src/Uploader/BannerUploader.php b/src/Uploader/BannerUploader.php index c8d087a..d0a4738 100644 --- a/src/Uploader/BannerUploader.php +++ b/src/Uploader/BannerUploader.php @@ -13,19 +13,16 @@ use BitBag\SyliusBannerPlugin\Entity\BannerInterface; use BitBag\SyliusBannerPlugin\Generator\BannerPathGeneratorInterface; -use Gaufrette\Filesystem; +use Sylius\Component\Core\Filesystem\Adapter\FilesystemAdapterInterface; +use Sylius\Component\Core\Filesystem\Exception\FileNotFoundException; use Webmozart\Assert\Assert; final class BannerUploader implements BannerUploaderInterface { - private Filesystem $filesystem; - - private BannerPathGeneratorInterface $bannerPathGenerator; - - public function __construct(Filesystem $filesystem, BannerPathGeneratorInterface $bannerPathGenerator) - { - $this->filesystem = $filesystem; - $this->bannerPathGenerator = $bannerPathGenerator; + public function __construct( + private readonly FilesystemAdapterInterface $filesystem, + private readonly BannerPathGeneratorInterface $bannerPathGenerator, + ) { } public function upload(BannerInterface $banner): void @@ -59,11 +56,13 @@ public function upload(BannerInterface $banner): void public function remove(string $path): bool { - if ($this->filesystem->has($path)) { - return $this->filesystem->delete($path); + try { + $this->filesystem->delete($path); + } catch (FileNotFoundException) { + return false; } - return false; + return true; } private function has(string $path): bool diff --git a/src/Validator/Ad.php b/src/Validator/Ad.php index a4d017f..9e4bf80 100644 --- a/src/Validator/Ad.php +++ b/src/Validator/Ad.php @@ -22,7 +22,7 @@ public function validatedBy(): string return 'bitbag_sylius_banner_plugin_validator_ad_validator'; } - public function getTargets(): string + public function getTargets(): string|array { return self::CLASS_CONSTRAINT; } diff --git a/src/Validator/Banner.php b/src/Validator/Banner.php index 7817089..4b09c08 100644 --- a/src/Validator/Banner.php +++ b/src/Validator/Banner.php @@ -22,7 +22,7 @@ public function validatedBy(): string return 'bitbag_sylius_banner_plugin_validator_banner_validator'; } - public function getTargets(): string + public function getTargets(): string|array { return self::CLASS_CONSTRAINT; } diff --git a/templates/admin/banner/form/sections/general.html.twig b/templates/admin/banner/form/sections/general.html.twig new file mode 100644 index 0000000..7d031cb --- /dev/null +++ b/templates/admin/banner/form/sections/general.html.twig @@ -0,0 +1,12 @@ +
+
+
+ {{ 'sylius.ui.general'|trans }} +
+
+
+
+ {% hook 'general' %} +
+
+
diff --git a/templates/admin/banner/form/sections/general/ads.html.twig b/templates/admin/banner/form/sections/general/ads.html.twig new file mode 100644 index 0000000..f33f51f --- /dev/null +++ b/templates/admin/banner/form/sections/general/ads.html.twig @@ -0,0 +1,3 @@ +
+ {{ form_row(hookable_metadata.context.form.ads, sylius_test_form_attribute('ads')) }} +
\ No newline at end of file diff --git a/templates/admin/banner/form/sections/general/locale.html.twig b/templates/admin/banner/form/sections/general/locale.html.twig new file mode 100644 index 0000000..0581573 --- /dev/null +++ b/templates/admin/banner/form/sections/general/locale.html.twig @@ -0,0 +1,3 @@ +
+ {{ form_row(hookable_metadata.context.form.locale, sylius_test_form_attribute('locale')) }} +
\ No newline at end of file diff --git a/templates/admin/banner/form/sections/general/priority.html.twig b/templates/admin/banner/form/sections/general/priority.html.twig new file mode 100644 index 0000000..f76b87e --- /dev/null +++ b/templates/admin/banner/form/sections/general/priority.html.twig @@ -0,0 +1,3 @@ +
+ {{ form_row(hookable_metadata.context.form.priority, sylius_test_form_attribute('priority')) }} +
\ No newline at end of file diff --git a/templates/admin/banner/form/sections/general/section.html.twig b/templates/admin/banner/form/sections/general/section.html.twig new file mode 100644 index 0000000..4f93096 --- /dev/null +++ b/templates/admin/banner/form/sections/general/section.html.twig @@ -0,0 +1,3 @@ +
+ {{ form_row(hookable_metadata.context.form.section, sylius_test_form_attribute('section')) }} +
\ No newline at end of file diff --git a/templates/admin/banner/form/sections/media.html.twig b/templates/admin/banner/form/sections/media.html.twig new file mode 100644 index 0000000..e8a9442 --- /dev/null +++ b/templates/admin/banner/form/sections/media.html.twig @@ -0,0 +1,10 @@ +
+
+
+ {{ 'bitbag_sylius_banner_plugin.ui.banner'|trans }} +
+
+
+ {% hook 'media' %} +
+
diff --git a/templates/admin/banner/form/sections/media/fields.html.twig b/templates/admin/banner/form/sections/media/fields.html.twig new file mode 100644 index 0000000..3859f5a --- /dev/null +++ b/templates/admin/banner/form/sections/media/fields.html.twig @@ -0,0 +1,3 @@ +
+ {% hook 'fields' %} +
\ No newline at end of file diff --git a/templates/admin/banner/form/sections/media/fields/alt.html.twig b/templates/admin/banner/form/sections/media/fields/alt.html.twig new file mode 100644 index 0000000..64b72e9 --- /dev/null +++ b/templates/admin/banner/form/sections/media/fields/alt.html.twig @@ -0,0 +1,3 @@ +
+ {{ form_row(hookable_metadata.context.form.alt, sylius_test_form_attribute('alt')) }} +
\ No newline at end of file diff --git a/templates/admin/banner/form/sections/media/fields/link.html.twig b/templates/admin/banner/form/sections/media/fields/link.html.twig new file mode 100644 index 0000000..5745872 --- /dev/null +++ b/templates/admin/banner/form/sections/media/fields/link.html.twig @@ -0,0 +1,3 @@ +
+ {{ form_row(hookable_metadata.context.form.link, sylius_test_form_attribute('link')) }} +
\ No newline at end of file diff --git a/templates/admin/banner/form/sections/media/preview.html.twig b/templates/admin/banner/form/sections/media/preview.html.twig new file mode 100644 index 0000000..708fc09 --- /dev/null +++ b/templates/admin/banner/form/sections/media/preview.html.twig @@ -0,0 +1,7 @@ +{% set form = hookable_metadata.context.form %} + +{% if form.vars.value.path|default(null) is not null %} +
+ {{ form.vars.value.alt }} +
+{% endif %} diff --git a/templates/admin/banner/form/sections/media/upload.html.twig b/templates/admin/banner/form/sections/media/upload.html.twig new file mode 100644 index 0000000..9787fb2 --- /dev/null +++ b/templates/admin/banner/form/sections/media/upload.html.twig @@ -0,0 +1,12 @@ +{% set form = hookable_metadata.context.form %} + +
+
+ {{ form_widget(form.file) }} +
+ + {{ form_errors(form.file) }} +
diff --git a/templates/shop/common/banner.html.twig b/templates/shop/common/banner.html.twig new file mode 100644 index 0000000..3d690c6 --- /dev/null +++ b/templates/shop/common/banner.html.twig @@ -0,0 +1,37 @@ +{% set banners = getActiveAdsBanners( + hookable_metadata.configuration.section_code|default(), + hookable_metadata.configuration.locale_code|default(sylius.localeCode), +) %} + +{% if banners and banners|length %} +
+ +
+{% endif %} diff --git a/tests/Application/.babelrc b/tests/Application/.babelrc deleted file mode 100644 index e563a62..0000000 --- a/tests/Application/.babelrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - ["env", { - "targets": { - "node": "6" - }, - "useBuiltIns": true - }] - ], - "plugins": [ - ["transform-object-rest-spread", { - "useBuiltIns": true - }] - ] -} diff --git a/tests/Application/.env b/tests/Application/.env deleted file mode 100644 index f00d7c9..0000000 --- a/tests/Application/.env +++ /dev/null @@ -1,36 +0,0 @@ -# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file -# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production. -# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration - -###> symfony/framework-bundle ### -APP_ENV=dev -APP_DEBUG=1 -APP_SECRET=EDITME -###< symfony/framework-bundle ### - -###> doctrine/doctrine-bundle ### -# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url -# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db" -# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls -DATABASE_URL=mysql://root@127.0.0.1/sylius_banner_plugin_%kernel.environment%?serverVersion=8.0 -###< 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=YOUR_SECRET_PASSPHRASE -###< lexik/jwt-authentication-bundle ### - -###> symfony/swiftmailer-bundle ### -# For Gmail as a transport, use: "gmail://username:password@localhost" -# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" -# Delivery is disabled by default via "null://localhost" -MAILER_URL=smtp://localhost -###< symfony/swiftmailer-bundle ### - -###> symfony/messenger ### -# Choose one of the transports below -# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages -MESSENGER_TRANSPORT_DSN=doctrine://default -# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages -###< symfony/messenger ### diff --git a/tests/Application/.env.test b/tests/Application/.env.test deleted file mode 100644 index ac3953d..0000000 --- a/tests/Application/.env.test +++ /dev/null @@ -1,3 +0,0 @@ -APP_SECRET='ch4mb3r0f5ecr3ts' - -KERNEL_CLASS='Tests\BitBag\SyliusBannerPlugin\Application\Kernel' diff --git a/tests/Application/.eslintrc.js b/tests/Application/.eslintrc.js deleted file mode 100644 index 92c4cee..0000000 --- a/tests/Application/.eslintrc.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - extends: 'airbnb-base', - env: { - node: true, - }, - rules: { - 'object-shorthand': ['error', 'always', { - avoidQuotes: true, - avoidExplicitReturnArrows: true, - }], - 'function-paren-newline': ['error', 'consistent'], - 'max-len': ['warn', 120, 2, { - ignoreUrls: true, - ignoreComments: false, - ignoreRegExpLiterals: true, - ignoreStrings: true, - ignoreTemplateLiterals: true, - }], - }, -}; diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore deleted file mode 100644 index 8ad1225..0000000 --- a/tests/Application/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -/public/assets -/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 8907dc7..0000000 --- a/tests/Application/Kernel.php +++ /dev/null @@ -1,131 +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 configureContainer(ContainerBuilder $container, LoaderInterface $loader): void - { - foreach ($this->getConfigurationDirectories() as $confDir) { - $bundlesFile = $confDir . '/bundles.php'; - if (false === is_file($bundlesFile)) { - continue; - } - $container->addResource(new FileResource($bundlesFile)); - } - - $container->setParameter('container.dumper.inline_class_loader', true); - - foreach ($this->getConfigurationDirectories() as $confDir) { - $this->loadContainerConfiguration($loader, $confDir); - } - } - - protected function configureRoutes(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 loadContainerConfiguration(LoaderInterface $loader, string $confDir): void - { - $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob'); - $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob'); - $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob'); - $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); - } - - private function loadRoutesConfiguration(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 f4e600e..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/api_platform/.gitignore b/tests/Application/config/api_platform/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php deleted file mode 100644 index 2291ab4..0000000 --- a/tests/Application/config/bootstrap.php +++ /dev/null @@ -1,23 +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.'); -} else { - // load all the .env files - (new Dotenv())->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 2bb980f..0000000 --- a/tests/Application/config/bundles.php +++ /dev/null @@ -1,70 +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], - BitBag\SyliusBannerPlugin\BitBagSyliusBannerPlugin::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], - Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], - League\FlysystemBundle\FlysystemBundle::class => ['all' => true], - BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], -]; 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/assets.yaml b/tests/Application/config/packages/assets.yaml deleted file mode 100644 index 9b0f951..0000000 --- a/tests/Application/config/packages/assets.yaml +++ /dev/null @@ -1,11 +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' - banner_plugin_shop: - json_manifest_path: '%kernel.project_dir%/public/build/bitbag/syliusBannerPlugin/shop/manifest.json' - banner_plugin_admin: - json_manifest_path: '%kernel.project_dir%/public/build/bitbag/syliusBannerPlugin/admin/manifest.json' diff --git a/tests/Application/config/packages/bitbag_sylius_banner_plugin.yaml b/tests/Application/config/packages/bitbag_sylius_banner_plugin.yaml deleted file mode 100644 index 5ab4bfc..0000000 --- a/tests/Application/config/packages/bitbag_sylius_banner_plugin.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "@BitBagSyliusBannerPlugin/Resources/config/config.yaml" } 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/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 a72eef7..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/.*', 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 9b44501..0000000 --- a/tests/Application/config/packages/framework.yaml +++ /dev/null @@ -1,6 +0,0 @@ -framework: - secret: '%env(APP_SECRET)%' - form: true - csrf_protection: true - session: - handler_id: ~ 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/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/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 b9c1cab..0000000 --- a/tests/Application/config/packages/test/framework.yaml +++ /dev/null @@ -1,4 +0,0 @@ -framework: - test: ~ - session: - handler_id: ~ diff --git a/tests/Application/config/packages/test/mailer.yaml b/tests/Application/config/packages/test/mailer.yaml deleted file mode 100644 index 2badcbe..0000000 --- a/tests/Application/config/packages/test/mailer.yaml +++ /dev/null @@ -1,7 +0,0 @@ -framework: - mailer: - dsn: '%env(MAILER_DSN)%' - 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/sylius_block_event.yaml b/tests/Application/config/packages/test/sylius_block_event.yaml deleted file mode 100644 index a3d4e0a..0000000 --- a/tests/Application/config/packages/test/sylius_block_event.yaml +++ /dev/null @@ -1,7 +0,0 @@ -sylius_ui: - events: - sylius.shop.homepage: - blocks: - banner: - template: "@SyliusShop/Homepage/_banner.html.twig" - priority: 60 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 daf04d4..0000000 --- a/tests/Application/config/packages/test_cached/framework.yaml +++ /dev/null @@ -1,4 +0,0 @@ -framework: - test: ~ - session: - handler_id: ~ 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/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 3fa33df..0000000 --- a/tests/Application/config/packages/webpack_encore.yaml +++ /dev/null @@ -1,7 +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' - banner_plugin_shop: '%kernel.project_dir%/public/build/bitbag/syliusBannerPlugin/shop' - banner_plugin_admin: '%kernel.project_dir%/public/build/bitbag/syliusBannerPlugin/admin' diff --git a/tests/Application/config/routes.yaml b/tests/Application/config/routes.yaml deleted file mode 100644 index ddd2f96..0000000 --- a/tests/Application/config/routes.yaml +++ /dev/null @@ -1,2 +0,0 @@ -bitbag_sylius_banner_plugin: - resource: "@BitBagSyliusBannerPlugin/Resources/config/routing.yaml" 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/dev/.gitignore b/tests/Application/config/secrets/dev/.gitignore deleted file mode 100644 index e69de29..0000000 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/services.yaml b/tests/Application/config/services.yaml deleted file mode 100644 index 615506e..0000000 --- a/tests/Application/config/services.yaml +++ /dev/null @@ -1,4 +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 diff --git a/tests/Application/config/services_test.yaml b/tests/Application/config/services_test.yaml deleted file mode 100644 index af40901..0000000 --- a/tests/Application/config/services_test.yaml +++ /dev/null @@ -1,8 +0,0 @@ -imports: - - { resource: "../../Behat/Resources/services.xml" } - - { 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/config/sylius/1.12/packages/security.yaml b/tests/Application/config/sylius/1.12/packages/security.yaml deleted file mode 100644 index 842b093..0000000 --- a/tests/Application/config/sylius/1.12/packages/security.yaml +++ /dev/null @@ -1,124 +0,0 @@ -security: - enable_authenticator_manager: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - - password_hashers: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - - new_api_admin_user: - pattern: "%sylius.security.new_api_admin_regex%/.*" - provider: sylius_api_admin_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_admin_route%/authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - new_api_shop_user: - pattern: "%sylius.security.new_api_shop_regex%/.*" - provider: sylius_api_shop_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_shop_route%/authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_homepage - invalidate_session: false - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - image_resolver: - pattern: ^/media/cache/resolve - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } - - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.13/bundles.php b/tests/Application/config/sylius/1.13/bundles.php deleted file mode 100644 index a266a2f..0000000 --- a/tests/Application/config/sylius/1.13/bundles.php +++ /dev/null @@ -1,5 +0,0 @@ - ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.13/packages/_sylius.yaml b/tests/Application/config/sylius/1.13/packages/_sylius.yaml deleted file mode 100644 index 259552d..0000000 --- a/tests/Application/config/sylius/1.13/packages/_sylius.yaml +++ /dev/null @@ -1,7 +0,0 @@ -parameters: - test_default_state_machine_adapter: 'symfony_workflow' - test_sylius_state_machine_adapter: '%env(string:default:test_default_state_machine_adapter:TEST_SYLIUS_STATE_MACHINE_ADAPTER)%' - -sylius_state_machine_abstraction: - graphs_to_adapters_mapping: - sylius_refund_refund_payment: '%test_sylius_state_machine_adapter%' diff --git a/tests/Application/config/sylius/1.13/packages/security.yaml b/tests/Application/config/sylius/1.13/packages/security.yaml deleted file mode 100644 index 7458c77..0000000 --- a/tests/Application/config/sylius/1.13/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%/administrators/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%/customers/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%/administrators/reset-password", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_admin_route%/administrators/token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } - - { path: "%sylius.security.new_api_shop_route%/customers/token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.13/packages/test_cached/security.yaml b/tests/Application/config/sylius/1.13/packages/test_cached/security.yaml deleted file mode 100644 index e6c3df6..0000000 --- a/tests/Application/config/sylius/1.13/packages/test_cached/security.yaml +++ /dev/null @@ -1,3 +0,0 @@ -security: - encoders: - sha512: sha512 diff --git a/tests/Application/config/sylius/1.14/bundles.php b/tests/Application/config/sylius/1.14/bundles.php deleted file mode 100644 index a266a2f..0000000 --- a/tests/Application/config/sylius/1.14/bundles.php +++ /dev/null @@ -1,5 +0,0 @@ - ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.14/packages/_sylius.yaml b/tests/Application/config/sylius/1.14/packages/_sylius.yaml deleted file mode 100644 index 259552d..0000000 --- a/tests/Application/config/sylius/1.14/packages/_sylius.yaml +++ /dev/null @@ -1,7 +0,0 @@ -parameters: - test_default_state_machine_adapter: 'symfony_workflow' - test_sylius_state_machine_adapter: '%env(string:default:test_default_state_machine_adapter:TEST_SYLIUS_STATE_MACHINE_ADAPTER)%' - -sylius_state_machine_abstraction: - graphs_to_adapters_mapping: - sylius_refund_refund_payment: '%test_sylius_state_machine_adapter%' diff --git a/tests/Application/config/sylius/1.14/packages/security.yaml b/tests/Application/config/sylius/1.14/packages/security.yaml deleted file mode 100644 index 7458c77..0000000 --- a/tests/Application/config/sylius/1.14/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%/administrators/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%/customers/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%/administrators/reset-password", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_admin_route%/administrators/token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } - - { path: "%sylius.security.new_api_shop_route%/customers/token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.14/packages/test_cached/security.yaml b/tests/Application/config/sylius/1.14/packages/test_cached/security.yaml deleted file mode 100644 index e6c3df6..0000000 --- a/tests/Application/config/sylius/1.14/packages/test_cached/security.yaml +++ /dev/null @@ -1,3 +0,0 @@ -security: - encoders: - sha512: sha512 diff --git a/tests/Application/package.json b/tests/Application/package.json deleted file mode 100644 index e56f4f0..0000000 --- a/tests/Application/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "dependencies": { - "babel-polyfill": "^6.26.0", - "jquery": "^3.4.0", - "jquery.dirtyforms": "^2.0.0", - "lightbox2": "^2.9.0", - "semantic-ui-css": "^2.2.0", - "slick-carousel": "^1.8.1", - "chart.js": "^3.7.1" - }, - "devDependencies": { - "@symfony/webpack-encore": "^1.6.1", - "babel-core": "^6.26.3", - "babel-plugin-external-helpers": "^6.22.0", - "babel-plugin-module-resolver": "^3.1.1", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-preset-env": "^1.7.0", - "babel-register": "^6.26.0", - "dedent": "^0.7.0", - "eslint": "^4.19.1", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-import-resolver-babel-module": "^4.0.0", - "eslint-plugin-import": "^2.11.0", - "fast-async": "^6.3.7", - "merge-stream": "^1.0.0", - "sass": "^1.50.0", - "sass-loader": "^7.0.1", - "upath": "^1.1.0", - "webpack": "^5.76.1", - "yargs": "^6.4.0" - }, - "scripts": { - "dev": "yarn encore dev", - "watch": "yarn encore dev --watch", - "prod": "yarn encore prod", - "lint": "yarn lint:js", - "lint:js": "eslint gulpfile.babel.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Sylius/Sylius.git" - }, - "author": "Paweł Jędrzejewski", - "license": "MIT" -} diff --git a/tests/Application/public/.htaccess b/tests/Application/public/.htaccess deleted file mode 100644 index 99ed00d..0000000 --- a/tests/Application/public/.htaccess +++ /dev/null @@ -1,25 +0,0 @@ -DirectoryIndex app.php - - - RewriteEngine On - - RewriteCond %{HTTP:Authorization} ^(.*) - RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] - - RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ - RewriteRule ^(.*) - [E=BASE:%1] - - RewriteCond %{ENV:REDIRECT_STATUS} ^$ - RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] - - RewriteCond %{REQUEST_FILENAME} -f - RewriteRule .? - [L] - - RewriteRule .? %{ENV:BASE}/index.php [L] - - - - - RedirectMatch 302 ^/$ /index.php/ - - diff --git a/tests/Application/public/favicon.ico b/tests/Application/public/favicon.ico deleted file mode 100644 index 592f7a8..0000000 Binary files a/tests/Application/public/favicon.ico and /dev/null differ diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php deleted file mode 100644 index 59c1213..0000000 --- a/tests/Application/public/index.php +++ /dev/null @@ -1,29 +0,0 @@ -handle($request); -$response->send(); -$kernel->terminate($request, $response); diff --git a/tests/Application/public/robots.txt b/tests/Application/public/robots.txt deleted file mode 100644 index 214e411..0000000 --- a/tests/Application/public/robots.txt +++ /dev/null @@ -1,4 +0,0 @@ -# www.robotstxt.org/ -# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 - -User-agent: * diff --git a/tests/Application/templates/.gitignore b/tests/Application/templates/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/_logo.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/_logo.html.twig deleted file mode 100644 index 1d9fa7d..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/_logo.html.twig +++ /dev/null @@ -1,5 +0,0 @@ - -
- -
-
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 d5918c6..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -{{ encore_entry_script_tags('admin-entry', null, 'admin') }} -{{ encore_entry_script_tags('bitbag-syliusBannerPlugin-admin', null, 'banner_plugin_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 4dbf4ff..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -{{ encore_entry_link_tags('admin-entry', null, 'admin') }} -{{ encore_entry_link_tags('bitbag-syliusBannerPlugin-admin', null, 'banner_plugin_admin') }} 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 2500131..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -{{ encore_entry_script_tags('shop-entry', null, 'shop') }} -{{ encore_entry_script_tags('bitbag-syliusBannerPlugin-shop', null, 'banner_plugin_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 0ef21f0..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -{{ encore_entry_link_tags('shop-entry', null, 'shop') }} -{{ encore_entry_link_tags('bitbag-syliusBannerPlugin-shop', null, 'banner_plugin_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/var/.gitignore b/tests/Application/var/.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 dcbe979..0000000 --- a/tests/Application/webpack.config.js +++ /dev/null @@ -1,51 +0,0 @@ -const path = require('path'); -const Encore = require('@symfony/webpack-encore'); -const [syliusBannerPluginShop, syliusBannerPluginAdmin] = require('../../webpack.config.js'); - -const syliusBundles = path.resolve(__dirname, '../../vendor/sylius/sylius/src/Sylius/Bundle/'); -const uiBundleScripts = path.resolve(syliusBundles, 'UiBundle/Resources/private/js/'); -const uiBundleResources = path.resolve(syliusBundles, 'UiBundle/Resources/private/'); - -// Shop config -Encore - .setOutputPath('public/build/shop/') - .setPublicPath('/build/shop') - .addEntry('shop-entry', './assets/shop/entry.js') - .addEntry('bitbag-shop-entry', '../../src/Resources/assets/shop/entry.js') - .disableSingleRuntimeChunk() - .cleanupOutputBeforeBuild() - .enableSourceMaps(!Encore.isProduction()) - .enableVersioning(Encore.isProduction()) - .enableSassLoader(); - -const shopConfig = Encore.getWebpackConfig(); - -shopConfig.resolve.alias['sylius/ui'] = uiBundleScripts; -shopConfig.resolve.alias['sylius/ui-resources'] = uiBundleResources; -shopConfig.resolve.alias['sylius/bundle'] = syliusBundles; -shopConfig.name = 'shop'; - -Encore.reset(); - -// Admin config -Encore - .setOutputPath('public/build/admin/') - .setPublicPath('/build/admin') - .addEntry('admin-entry', './assets/admin/entry.js') - .addEntry('bitbag-admin-entry', '../../src/Resources/assets/admin/entry.js') - .disableSingleRuntimeChunk() - .cleanupOutputBeforeBuild() - .enableSourceMaps(!Encore.isProduction()) - .enableVersioning(Encore.isProduction()) - .enableSassLoader(); - -const adminConfig = Encore.getWebpackConfig(); - -adminConfig.resolve.alias['sylius/ui'] = uiBundleScripts; -adminConfig.resolve.alias['sylius/ui-resources'] = uiBundleResources; -adminConfig.resolve.alias['sylius/bundle'] = syliusBundles; -adminConfig.resolve.alias['chart.js/dist/Chart.min'] = path.resolve(__dirname, 'node_modules/chart.js/dist/chart.min.js'); -adminConfig.externals = Object.assign({}, adminConfig.externals, { window: 'window', document: 'document' }); -adminConfig.name = 'admin'; - -module.exports = [shopConfig, adminConfig, syliusBannerPluginShop, syliusBannerPluginAdmin]; diff --git a/tests/Behat/Context/Ui/Admin/AdContext.php b/tests/Behat/Context/Ui/Admin/AdContext.php index b735f92..9688f1a 100644 --- a/tests/Behat/Context/Ui/Admin/AdContext.php +++ b/tests/Behat/Context/Ui/Admin/AdContext.php @@ -59,7 +59,7 @@ public function iCreateANewAdWithData( */ public function iShouldSeeErrorAboutNotUniqueCode() { - $this->adPage->findFormError(NotificationType::failure()); + $this->adPage->findFormError(NotificationType::error()); $this->adPage->findValidationError('Ad code must be unique'); } @@ -68,7 +68,7 @@ public function iShouldSeeErrorAboutNotUniqueCode() */ public function iShouldSeeErrorAboutWrongDate() { - $this->adPage->findFormError(NotificationType::failure()); + $this->adPage->findFormError(NotificationType::error()); $this->adPage->findValidationError('End date must be bigger than start date'); } diff --git a/tests/Behat/Context/Ui/Admin/SectionContext.php b/tests/Behat/Context/Ui/Admin/SectionContext.php index 0a457fd..1194f4d 100644 --- a/tests/Behat/Context/Ui/Admin/SectionContext.php +++ b/tests/Behat/Context/Ui/Admin/SectionContext.php @@ -50,7 +50,7 @@ public function iAmOnNewSectionPage() */ public function iShouldSeeErrorAboutNotUniqueCode() { - $this->sectionPage->findFormError(NotificationType::failure()); + $this->sectionPage->findFormError(NotificationType::error()); $this->sectionPage->findValidationError('Section code must be unique'); } } diff --git a/tests/Behat/Page/Admin/AdPage.php b/tests/Behat/Page/Admin/AdPage.php index effff80..01c1bae 100644 --- a/tests/Behat/Page/Admin/AdPage.php +++ b/tests/Behat/Page/Admin/AdPage.php @@ -41,14 +41,14 @@ public function submitForm(): void public function findFormError(NotificationType $type) { - $errorMessage = $this->getDocument()->find('css', '.ui.icon.negative.message')->getText(); + $errorMessage = $this->getDocument()->find('css', '[data-test-form-error-alert]')->getText(); Assert::contains($errorMessage, 'This form contains errors'); } public function findValidationError(string $string) { - $this->getDocument()->find('css', 'form .sylius-validation-error')->getText($string); + $this->getDocument()->find('css', 'form .invalid-feedback')->getText($string); } public function setAdFormData( diff --git a/tests/Behat/Page/Admin/SectionPage.php b/tests/Behat/Page/Admin/SectionPage.php index c350d7d..26eb5c9 100644 --- a/tests/Behat/Page/Admin/SectionPage.php +++ b/tests/Behat/Page/Admin/SectionPage.php @@ -56,14 +56,14 @@ public function submitForm(): void public function findFormError(NotificationType $type) { - $errorMessage = $this->getDocument()->find('css', '.ui.icon.negative.message')->getText(); + $errorMessage = $this->getDocument()->find('css', '[data-test-form-error-alert]')->getText(); Assert::contains($errorMessage, 'This form contains errors'); } public function findValidationError(string $string) { - $this->getDocument()->find('css', 'form .sylius-validation-error')->getText($string); + $this->getDocument()->find('css', 'form .invalid-feedback')->getText($string); } protected function getDefinedElements(): array diff --git a/tests/Behat/Resources/services/page.xml b/tests/Behat/Resources/services/page.xml index 0481273..0ca75d5 100644 --- a/tests/Behat/Resources/services/page.xml +++ b/tests/Behat/Resources/services/page.xml @@ -12,7 +12,7 @@ parent="sylius.behat.symfony_page" > diff --git a/tests/TestApplication/.env b/tests/TestApplication/.env new file mode 100644 index 0000000..ba59385 --- /dev/null +++ b/tests/TestApplication/.env @@ -0,0 +1,7 @@ +###> sylius/test-application ### +SYLIUS_TEST_APP_CONFIGS_TO_IMPORT="@BitBagSyliusBannerPlugin/tests/TestApplication/config/config.yaml" +SYLIUS_TEST_APP_ROUTES_TO_IMPORT="@BitBagSyliusBannerPlugin/tests/TestApplication/config/routes.yaml" +SYLIUS_TEST_APP_BUNDLES_PATH="tests/TestApplication/config/bundles.php" +###< sylius/test-application ### + +DATABASE_URL=mysql://root:root@127.0.0.1:3306/bitbag_sylius_banner_plugin_%kernel.environment%?serverVersion=8.0 diff --git a/tests/TestApplication/.env.test b/tests/TestApplication/.env.test new file mode 100644 index 0000000..4930a36 --- /dev/null +++ b/tests/TestApplication/.env.test @@ -0,0 +1,5 @@ +###> sylius/test-application ### +SYLIUS_TEST_APP_CONFIGS_TO_IMPORT="@BitBagSyliusBannerPlugin/tests/TestApplication/config/config.yaml" +SYLIUS_TEST_APP_ROUTES_TO_IMPORT="@BitBagSyliusBannerPlugin/tests/TestApplication/config/routes.yaml" +SYLIUS_TEST_APP_BUNDLES_PATH="tests/TestApplication/config/bundles.php" +###< sylius/test-application ### diff --git a/tests/TestApplication/config/bundles.php b/tests/TestApplication/config/bundles.php new file mode 100644 index 0000000..a77ace5 --- /dev/null +++ b/tests/TestApplication/config/bundles.php @@ -0,0 +1,9 @@ + ['all' => true], +]; + +return $bundles; diff --git a/tests/TestApplication/config/config.yaml b/tests/TestApplication/config/config.yaml new file mode 100644 index 0000000..9494988 --- /dev/null +++ b/tests/TestApplication/config/config.yaml @@ -0,0 +1,8 @@ +imports: + - { resource: "@BitBagSyliusBannerPlugin/config/config.yaml" } + - { resource: "sylius_twig_hooks.yaml" } + - { resource: "config_test.php" } + +twig: + paths: + '%kernel.project_dir%/../../../tests/TestApplication/templates': ~ diff --git a/tests/TestApplication/config/config_test.php b/tests/TestApplication/config/config_test.php new file mode 100644 index 0000000..7bd70b2 --- /dev/null +++ b/tests/TestApplication/config/config_test.php @@ -0,0 +1,30 @@ +import('services_test.yaml'); + + $container->extension('sylius_twig_hooks', [ + 'hooks' => [ + 'sylius_shop.homepage.index' => [ + 'banner' => [ + 'template' => 'shop/homepage/banner.html.twig', + ], + ], + ], + ]); + } +}; diff --git a/tests/TestApplication/config/routes.yaml b/tests/TestApplication/config/routes.yaml new file mode 100644 index 0000000..123b6d6 --- /dev/null +++ b/tests/TestApplication/config/routes.yaml @@ -0,0 +1,2 @@ +bitbag_sylius_banner_plugin: + resource: "@BitBagSyliusBannerPlugin/config/routing.yaml" diff --git a/tests/TestApplication/config/services_test.yaml b/tests/TestApplication/config/services_test.yaml new file mode 100644 index 0000000..77dc5ff --- /dev/null +++ b/tests/TestApplication/config/services_test.yaml @@ -0,0 +1,3 @@ +imports: + - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } + - { resource: "../../../tests/Behat/Resources/services.xml" } diff --git a/tests/TestApplication/config/sylius_twig_hooks.yaml b/tests/TestApplication/config/sylius_twig_hooks.yaml new file mode 100644 index 0000000..42534de --- /dev/null +++ b/tests/TestApplication/config/sylius_twig_hooks.yaml @@ -0,0 +1,8 @@ +sylius_twig_hooks: + hooks: + sylius_shop.homepage.index: + banner: + template: "@BitBagSyliusBannerPlugin/shop/common/banner.html.twig" + priority: 300 + configuration: + section_code: 'TEST' diff --git a/tests/TestApplication/package.json b/tests/TestApplication/package.json new file mode 100755 index 0000000..741f0b3 --- /dev/null +++ b/tests/TestApplication/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "swiper": "^11.2.6" + } +} diff --git a/src/Resources/assets/admin/scss/main.scss b/tests/TestApplication/templates/.gitkeep similarity index 100% rename from src/Resources/assets/admin/scss/main.scss rename to tests/TestApplication/templates/.gitkeep diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig b/tests/TestApplication/templates/shop/homepage/banner.html.twig similarity index 100% rename from tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig rename to tests/TestApplication/templates/shop/homepage/banner.html.twig diff --git a/src/Resources/translations/messages.en.yaml b/translations/messages.en.yaml similarity index 100% rename from src/Resources/translations/messages.en.yaml rename to translations/messages.en.yaml diff --git a/src/Resources/translations/validators.en.yaml b/translations/validators.en.yaml similarity index 100% rename from src/Resources/translations/validators.en.yaml rename to translations/validators.en.yaml diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index c452c93..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,40 +0,0 @@ -const path = require('path'); -const Encore = require('@symfony/webpack-encore'); -const pluginName = 'syliusBannerPlugin'; - -const getConfig = (pluginName, type) => { - Encore.reset(); - - Encore - .setOutputPath(`public/build/bitbag/${pluginName}/${type}/`) - .setPublicPath(`/build/bitbag/${pluginName}/${type}/`) - .addEntry(`bitbag-${pluginName}-${type}`, path.resolve(__dirname, `./src/Resources/assets/${type}/entry.js`)) - .disableSingleRuntimeChunk() - .cleanupOutputBeforeBuild() - .enableSourceMaps(!Encore.isProduction()) - .enableSassLoader(); - - const config = Encore.getWebpackConfig(); - config.name = `bitbag-${pluginName}-${type}`; - - return config; -} - -Encore - .setOutputPath(`src/Resources/public/`) - .setPublicPath(`/public/`) - .addEntry(`bitbag-${pluginName}-shop`, path.resolve(__dirname, `./src/Resources/assets/shop/entry.js`)) - .addEntry(`bitbag-${pluginName}-admin`, path.resolve(__dirname, `./src/Resources/assets/admin/entry.js`)) - .cleanupOutputBeforeBuild() - .disableSingleRuntimeChunk() - .enableSassLoader(); - -const distConfig = Encore.getWebpackConfig(); -distConfig.name = `bitbag-plugin-dist`; - -Encore.reset(); - -const shopConfig = getConfig(pluginName, 'shop') -const adminConfig = getConfig(pluginName, 'admin') - -module.exports = [shopConfig, adminConfig, distConfig];