diff --git a/.github/workflows/backwards-compatibility-check.yaml b/.github/workflows/backwards-compatibility-check.yaml index 806dd6a..85ba05c 100644 --- a/.github/workflows/backwards-compatibility-check.yaml +++ b/.github/workflows/backwards-compatibility-check.yaml @@ -20,7 +20,7 @@ jobs: - name: "Setup PHP, with composer and extensions" uses: "shivammathur/setup-php@v2" with: - php-version: "8.1" + php-version: "8.2" coverage: "none" - name: "Install tool" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2a1e8ad..a07d3b6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,7 +24,7 @@ jobs: strategy: matrix: php-version: - - "8.1" # Always use the lowest version of PHP since a higher version could create actual syntax errors in lower versions + - "8.2" # Always use the lowest version of PHP since a higher version could create actual syntax errors in lower versions dependencies: - "highest" @@ -59,10 +59,10 @@ jobs: continue-on-error: true - name: "Lint yaml files" - run: "(cd tests/Application && bin/console lint:yaml ../../src/Resources)" + run: "vendor/bin/console lint:yaml src/Resources" - name: "Lint twig files" - run: "(cd tests/Application && bin/console lint:twig ../../src/Resources)" + run: "vendor/bin/console lint:twig src/Resources" dependency-analysis: name: "Dependency Analysis (PHP${{ matrix.php-version }} | Deps: ${{ matrix.dependencies }} | SF${{ matrix.symfony }})" @@ -72,16 +72,16 @@ jobs: strategy: matrix: php-version: - - "8.1" - "8.2" + - "8.3" dependencies: - "lowest" - "highest" symfony: - - "~5.4.0" - "~6.4.0" + - "~7.3.0" steps: - name: "Checkout" @@ -119,16 +119,16 @@ jobs: strategy: matrix: php-version: - - "8.1" - "8.2" + - "8.3" dependencies: - "lowest" - "highest" symfony: - - "~5.4.0" - "~6.4.0" + - "~7.3.0" steps: - name: "Checkout" @@ -163,16 +163,16 @@ jobs: strategy: matrix: php-version: - - "8.1" - "8.2" + - "8.3" dependencies: - "lowest" - "highest" symfony: - - "~5.4.0" - "~6.4.0" + - "~7.3.0" steps: - name: "Checkout" @@ -204,16 +204,16 @@ jobs: strategy: matrix: php-version: - - "8.1" - "8.2" + - "8.3" dependencies: - "lowest" - "highest" symfony: - - "~5.4.0" - "~6.4.0" + - "~7.3.0" steps: - name: "Start MySQL" @@ -238,16 +238,16 @@ jobs: dependency-versions: "${{ matrix.dependencies }}" - name: "Lint container" - run: "(cd tests/Application && bin/console lint:container)" + run: "vendor/bin/console lint:container" - name: "Create database" - run: "(cd tests/Application && bin/console doctrine:database:create)" + run: "vendor/bin/console doctrine:database:create" - name: "Create database schema" - run: "(cd tests/Application && bin/console doctrine:schema:create)" + run: "vendor/bin/console doctrine:schema:create" - name: "Validate Doctrine mapping" - run: "(cd tests/Application && bin/console doctrine:schema:validate)" + run: "vendor/bin/console doctrine:schema:validate" mutation-tests: name: "Mutation tests" @@ -257,7 +257,7 @@ jobs: strategy: matrix: php-version: - - "8.2" + - "8.3" dependencies: - "highest" @@ -291,7 +291,7 @@ jobs: strategy: matrix: php-version: - - "8.2" + - "8.3" dependencies: - "highest" diff --git a/.gitignore b/.gitignore index 4c0aa2d..cc4f8c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ /.build/ +/var/ /vendor/ /node_modules/ /composer.lock -/tests/Application/yarn.lock +/tests/TestApplication/.env.local +/tests/TestApplication/.env.*.local /.phpunit.result.cache diff --git a/README.md b/README.md index 90bce49..192909c 100644 --- a/README.md +++ b/README.md @@ -53,28 +53,20 @@ in the `config/bundles.php` file of your project: # config/bundles.php return [ // ... - - Setono\SyliusTermsPlugin\SetonoSyliusTermsPlugin::class => ['all' => true], - - // It is important to add plugin before the grid bundle - Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], - - // ... + Setono\SyliusTermsPlugin\SetonoSyliusTermsPlugin::class => ['all' => true] ]; ``` -**NOTE** that you must instantiate the plugin before the grid bundle, else you will see an exception like `You have requested a non-existent parameter "setono_sylius_terms.model.terms.class".` - ### Step 3: Import routing ```yaml # config/routes/setono_sylius_terms.yaml setono_sylius_terms: - resource: "@SetonoSyliusTermsPlugin/Resources/config/routes.yaml" + resource: "@SetonoSyliusTermsPlugin/config/routes.yaml" ``` -There's also a version for non-localized stores: `@SetonoSyliusTermsPlugin/Resources/config/routes_no_locale.yaml` +There's also a version for non-localized stores: `@SetonoSyliusTermsPlugin/config/routes_no_locale.yaml` ### Step 4: Update your database schema @@ -83,38 +75,6 @@ $ php bin/console doctrine:migrations:diff $ php bin/console doctrine:migrations:migrate ``` -### Step 5: Override checkout complete form - -Override the [Sylius Form](https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/ShopBundle/Resources/views/Checkout/Complete/_form.html.twig): - -* If you haven't your own `templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig` yet: - - ```bash - $ cp vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/views/Checkout/Complete/_form.html.twig \ - templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig - ``` - -* If you already have it: - - Add terms field (exactly this conditional way): - - ```twig - {# templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig #} - {% if form.terms is defined %} - {{ form_row(form.terms) }} - {% endif %} - ``` - - So the final template will look like this: - - ```twig - {# templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig #} - {{ form_row(form.notes, {'attr': {'rows': 3}}) }} - {% if form.terms is defined %} - {{ form_row(form.terms) }} - {% endif %} - ``` - # Troubleshooting * If you see `Neither the property "terms" nor one of the methods "terms()", "getterms()"/"isterms()"/"hasterms()" or "__call()" exist and have public access in class "Symfony\Component\Form\FormView".` diff --git a/assets/admin/controllers.json b/assets/admin/controllers.json new file mode 100644 index 0000000..a1c6e90 --- /dev/null +++ b/assets/admin/controllers.json @@ -0,0 +1,4 @@ +{ + "controllers": [], + "entrypoints": [] +} diff --git a/tests/Application/config/api_platform/.gitignore b/assets/admin/entrypoint.js similarity index 100% rename from tests/Application/config/api_platform/.gitignore rename to assets/admin/entrypoint.js diff --git a/assets/shop/controllers.json b/assets/shop/controllers.json new file mode 100644 index 0000000..a1c6e90 --- /dev/null +++ b/assets/shop/controllers.json @@ -0,0 +1,4 @@ +{ + "controllers": [], + "entrypoints": [] +} diff --git a/tests/Application/config/routes.yaml b/assets/shop/entrypoint.js similarity index 100% rename from tests/Application/config/routes.yaml rename to assets/shop/entrypoint.js diff --git a/composer.json b/composer.json index d65023c..4e1d720 100644 --- a/composer.json +++ b/composer.json @@ -9,54 +9,52 @@ "terms" ], "require": { - "php": ">=8.1", - "doctrine/collections": "^1.6", + "php": "^8.2", + "doctrine/collections": "^2.2", "doctrine/orm": "^2.7", "fakerphp/faker": "^1.23", "knplabs/knp-menu": "^3.1", - "sylius/channel": "^1.0", - "sylius/channel-bundle": "^1.0", - "sylius/core": "^1.0", - "sylius/core-bundle": "^1.0", - "sylius/locale": "^1.0", + "sylius/core-bundle": "^2.0", "sylius/resource-bundle": "^1.6", - "sylius/ui-bundle": "^1.0", - "symfony/config": "^5.4 || ^6.4 || ^7.0", - "symfony/dependency-injection": "^5.4 || ^6.4 || ^7.0", - "symfony/event-dispatcher": "^5.4 || ^6.4 || ^7.0", - "symfony/form": "^5.4 || ^6.4 || ^7.0", - "symfony/http-foundation": "^5.4 || ^6.4 || ^7.0", - "symfony/http-kernel": "^5.4 || ^6.4 || ^7.0", - "symfony/options-resolver": "^5.4 || ^6.4 || ^7.0", - "symfony/routing": "^5.4 || ^6.4 || ^7.0", - "symfony/string": "^5.4 || ^6.4 || ^7.0", + "sylius/twig-extra": "^0.8", + "sylius/twig-hooks": "^0.8", + "symfony/config": "^6.4 || ^7.3", + "symfony/dependency-injection": "^6.4 || ^7.3", + "symfony/event-dispatcher": "^6.4 || ^7.3", + "symfony/form": "^6.4 || ^7.3", + "symfony/http-foundation": "^6.4 || ^7.3", + "symfony/http-kernel": "^6.4 || ^7.3", + "symfony/options-resolver": "^6.4 || ^7.3", + "symfony/routing": "^6.4 || ^7.3", + "symfony/string": "^6.4 || ^7.3", "symfony/translation-contracts": "^1.1 || ^2.4 || ^3.4", - "symfony/validator": "^5.4 || ^6.4 || ^7.0", + "symfony/validator": "^6.4 || ^7.3", "twig/twig": "^2.14 || ^3.8", "webmozart/assert": "^1.11" }, "require-dev": { "api-platform/core": "^2.7.16", - "babdev/pagerfanta-bundle": "^3.8", + "babdev/pagerfanta-bundle": "^4.4", "behat/behat": "^3.14", "doctrine/doctrine-bundle": "^2.11", "infection/infection": "^0.27.9", "jms/serializer-bundle": "^4.2", - "lexik/jwt-authentication-bundle": "^2.17", + "lexik/jwt-authentication-bundle": "^3.1", "matthiasnoback/symfony-config-test": "^4.3 || ^5.1", "matthiasnoback/symfony-dependency-injection-test": "^4.3 || ^5.0", "phpspec/prophecy-phpunit": "^2.1", "phpunit/phpunit": "^9.6", "psalm/plugin-phpunit": "^0.18", "setono/code-quality-pack": "^2.7", - "sylius/sylius": "~1.12.13", - "symfony/debug-bundle": "^5.4 || ^6.4 || ^7.0", - "symfony/dotenv": "^5.4 || ^6.4 || ^7.0", - "symfony/intl": "^5.4 || ^6.4 || ^7.0", - "symfony/property-info": "^5.4 || ^6.4 || ^7.0", - "symfony/serializer": "^5.4 || ^6.4 || ^7.0", - "symfony/web-profiler-bundle": "^5.4 || ^6.4 || ^7.0", - "symfony/webpack-encore-bundle": "^1.17", + "sylius/sylius": "^2.0", + "sylius/test-application": "^2.0.0@alpha", + "symfony/debug-bundle": "^6.4 || ^7.3", + "symfony/dotenv": "^6.4 || ^7.3", + "symfony/intl": "^6.4 || ^7.3", + "symfony/property-info": "^6.4 || ^7.3", + "symfony/serializer": "^6.4 || ^7.3", + "symfony/web-profiler-bundle": "^6.4 || ^7.3", + "symfony/webpack-encore-bundle": "^2.2", "willdurand/negotiation": "^3.1" }, "prefer-stable": true, @@ -67,18 +65,19 @@ }, "autoload-dev": { "psr-4": { - "Setono\\SyliusTermsPlugin\\Tests\\": "tests/" - }, - "classmap": [ - "tests/Application/Kernel.php" - ] + "Setono\\SyliusTermsPlugin\\Tests\\": "tests/", + "Tests\\Setono\\SyliusTermsPlugin\\": "tests/TestApplication/src" + } }, "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": false, "ergebnis/composer-normalize": true, "infection/extension-installer": true, - "symfony/thanks": false + "php-http/discovery": true, + "symfony/thanks": false, + "symfony/runtime": true, + "symfony/flex": true }, "sort-packages": true }, @@ -87,5 +86,8 @@ "check-style": "ecs check", "fix-style": "ecs check --fix", "phpunit": "phpunit" + }, + "extra": { + "public-dir": "vendor/sylius/test-application/public" } } diff --git a/src/Resources/config/app/fixtures.yaml b/config/app/fixtures.yaml similarity index 100% rename from src/Resources/config/app/fixtures.yaml rename to config/app/fixtures.yaml diff --git a/config/config.yaml b/config/config.yaml new file mode 100644 index 0000000..279f5bb --- /dev/null +++ b/config/config.yaml @@ -0,0 +1,3 @@ +imports: + - { resource: "app/fixtures.yaml" } + - { resource: "twig_hooks/**/*.yaml" } diff --git a/src/Resources/config/doctrine/model/Terms.orm.xml b/config/doctrine/model/Terms.orm.xml similarity index 100% rename from src/Resources/config/doctrine/model/Terms.orm.xml rename to config/doctrine/model/Terms.orm.xml diff --git a/src/Resources/config/doctrine/model/TermsTranslation.orm.xml b/config/doctrine/model/TermsTranslation.orm.xml similarity index 100% rename from src/Resources/config/doctrine/model/TermsTranslation.orm.xml rename to config/doctrine/model/TermsTranslation.orm.xml diff --git a/src/Resources/config/routes.yaml b/config/routes.yaml similarity index 56% rename from src/Resources/config/routes.yaml rename to config/routes.yaml index b91e865..49ce972 100644 --- a/src/Resources/config/routes.yaml +++ b/config/routes.yaml @@ -1,9 +1,9 @@ setono_sylius_terms_shop: - resource: "@SetonoSyliusTermsPlugin/Resources/config/routes/shop.yaml" + resource: "@SetonoSyliusTermsPlugin/config/routes/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}))?$ setono_sylius_terms_admin: - resource: "@SetonoSyliusTermsPlugin/Resources/config/routes/admin.yaml" + resource: "@SetonoSyliusTermsPlugin/config/routes/admin.yaml" prefix: /admin diff --git a/config/routes/admin.yaml b/config/routes/admin.yaml new file mode 100644 index 0000000..916b7e9 --- /dev/null +++ b/config/routes/admin.yaml @@ -0,0 +1,12 @@ +setono_sylius_terms_admin_terms: + resource: | + alias: setono_sylius_terms.terms + section: admin + except: [show] + templates: "@SyliusAdmin\\shared\\crud" + redirect: update + grid: setono_sylius_terms_terms + vars: + all: + hook_prefix: 'setono_sylius_terms.admin.terms' + type: sylius.resource diff --git a/src/Resources/config/routes/shop.yaml b/config/routes/shop.yaml similarity index 100% rename from src/Resources/config/routes/shop.yaml rename to config/routes/shop.yaml diff --git a/config/routes_no_locale.yaml b/config/routes_no_locale.yaml new file mode 100644 index 0000000..02b8538 --- /dev/null +++ b/config/routes_no_locale.yaml @@ -0,0 +1,6 @@ +setono_sylius_terms_shop: + resource: "@SetonoSyliusTermsPlugin/config/routes/shop.yaml" + +setono_sylius_terms_admin: + resource: "@SetonoSyliusTermsPlugin/config/routes/admin.yaml" + prefix: /admin diff --git a/config/services.xml b/config/services.xml new file mode 100644 index 0000000..4c76eb4 --- /dev/null +++ b/config/services.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/src/Resources/config/services/controller.xml b/config/services/controller.xml similarity index 100% rename from src/Resources/config/services/controller.xml rename to config/services/controller.xml diff --git a/src/Resources/config/services/event_subscriber.xml b/config/services/event_subscriber.xml similarity index 100% rename from src/Resources/config/services/event_subscriber.xml rename to config/services/event_subscriber.xml diff --git a/src/Resources/config/services/fixture.xml b/config/services/fixture.xml similarity index 100% rename from src/Resources/config/services/fixture.xml rename to config/services/fixture.xml diff --git a/src/Resources/config/services/form.xml b/config/services/form.xml similarity index 100% rename from src/Resources/config/services/form.xml rename to config/services/form.xml diff --git a/src/Resources/config/services/provider.xml b/config/services/provider.xml similarity index 100% rename from src/Resources/config/services/provider.xml rename to config/services/provider.xml diff --git a/src/Resources/config/services/renderer.xml b/config/services/renderer.xml similarity index 100% rename from src/Resources/config/services/renderer.xml rename to config/services/renderer.xml diff --git a/src/Resources/config/services/twig.xml b/config/services/twig.xml similarity index 100% rename from src/Resources/config/services/twig.xml rename to config/services/twig.xml diff --git a/config/services/twig_component.xml b/config/services/twig_component.xml new file mode 100644 index 0000000..2559e77 --- /dev/null +++ b/config/services/twig_component.xml @@ -0,0 +1,19 @@ + + + + + + + %setono_sylius_terms.model.terms.class% + Setono\SyliusTermsPlugin\Form\Type\TermsType + + + + + + diff --git a/config/twig_hooks/admin/terms/create.yaml b/config/twig_hooks/admin/terms/create.yaml new file mode 100644 index 0000000..08990c3 --- /dev/null +++ b/config/twig_hooks/admin/terms/create.yaml @@ -0,0 +1,50 @@ +sylius_twig_hooks: + hooks: + 'setono_sylius_terms.admin.terms.create.content': + form: + component: 'setono_sylius_terms:admin:terms:form' + props: + resource: '@=_context.resource' + form: '@=_context.form' + template: '@SetonoSyliusTermsPlugin/admin/terms/form.html.twig' + configuration: + render_rest: false + priority: 0 + + 'setono_sylius_terms.admin.terms.create.content.form.sections': + general: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/general.html.twig' + priority: 100 + translations: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/translations.html.twig' + priority: 0 + + 'setono_sylius_terms.admin.terms.create.content.form.sections.general': + default: + enabled: false + code: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/general/code.html.twig' + priority: 300 + enabled: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/general/enabled.html.twig' + priority: 200 + channels: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/general/channels.html.twig' + priority: 100 + forms: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/general/forms.html.twig' + priority: 0 + + 'setono_sylius_terms.admin.terms.create.content.form.sections.translations': + name: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/translations/name.html.twig' + priority: 300 + slug: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/translations/slug.html.twig' + priority: 200 + label: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/translations/label.html.twig' + priority: 100 + content: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/translations/content.html.twig' + priority: 0 diff --git a/config/twig_hooks/admin/terms/update.yaml b/config/twig_hooks/admin/terms/update.yaml new file mode 100644 index 0000000..fe716b0 --- /dev/null +++ b/config/twig_hooks/admin/terms/update.yaml @@ -0,0 +1,51 @@ +sylius_twig_hooks: + hooks: + 'setono_sylius_terms.admin.terms.update.content': + form: + component: 'setono_sylius_terms:admin:terms:form' + props: + resource: '@=_context.resource' + form: '@=_context.form' + template: '@SetonoSyliusTermsPlugin/admin/terms/form.html.twig' + configuration: + render_rest: false + method: 'PUT' + priority: 0 + + 'setono_sylius_terms.admin.terms.update.content.form.sections': + general: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/general.html.twig' + priority: 100 + translations: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/translations.html.twig' + priority: 0 + + 'setono_sylius_terms.admin.terms.update.content.form.sections.general': + default: + enabled: false + code: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/general/code.html.twig' + priority: 300 + enabled: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/general/enabled.html.twig' + priority: 200 + channels: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/general/channels.html.twig' + priority: 100 + forms: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/general/forms.html.twig' + priority: 0 + + 'setono_sylius_terms.admin.terms.update.content.form.sections.translations': + name: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/translations/name.html.twig' + priority: 300 + slug: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/translations/slug.html.twig' + priority: 200 + label: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/translations/label.html.twig' + priority: 100 + content: + template: '@SetonoSyliusTermsPlugin/admin/terms/form/sections/translations/content.html.twig' + priority: 0 diff --git a/config/twig_hooks/shop/checkout/complete.yaml b/config/twig_hooks/shop/checkout/complete.yaml new file mode 100644 index 0000000..6096e21 --- /dev/null +++ b/config/twig_hooks/shop/checkout/complete.yaml @@ -0,0 +1,6 @@ +sylius_twig_hooks: + hooks: + 'sylius_shop.checkout.complete.content.form': + terms: + template: '@SetonoSyliusTermsPlugin/shop/checkout/complete/content/form/terms.html.twig' + priority: 50 diff --git a/config/twig_hooks/shop/terms/show.yaml b/config/twig_hooks/shop/terms/show.yaml new file mode 100644 index 0000000..e2312c3 --- /dev/null +++ b/config/twig_hooks/shop/terms/show.yaml @@ -0,0 +1,27 @@ +sylius_twig_hooks: + hooks: + 'setono_sylius_terms.shop.terms.show': + content: + template: '@SetonoSyliusTermsPlugin/shop/terms/show/content.html.twig' + priority: 0 + + 'setono_sylius_terms.shop.terms.show.content': + header: + template: '@SetonoSyliusTermsPlugin/shop/terms/show/content/header.html.twig' + priority: 100 + main: + template: '@SetonoSyliusTermsPlugin/shop/terms/show/content/main.html.twig' + priority: 0 + + 'setono_sylius_terms.shop.terms.show.content.header': + breadcrumbs: + template: '@SetonoSyliusTermsPlugin/shop/terms/show/content/header/breadcrumbs.html.twig' + priority: 0 + + 'setono_sylius_terms.shop.terms.show.content.main': + name: + template: '@SetonoSyliusTermsPlugin/shop/terms/show/content/main/name.html.twig' + priority: 100 + content: + template: '@SetonoSyliusTermsPlugin/shop/terms/show/content/main/content.html.twig' + priority: 0 diff --git a/src/Resources/config/validation/Terms.xml b/config/validation/Terms.xml similarity index 100% rename from src/Resources/config/validation/Terms.xml rename to config/validation/Terms.xml diff --git a/src/Resources/config/validation/TermsTranslation.xml b/config/validation/TermsTranslation.xml similarity index 100% rename from src/Resources/config/validation/TermsTranslation.xml rename to config/validation/TermsTranslation.xml diff --git a/docs/images/admin-terms-index.png b/docs/images/admin-terms-index.png index 6194da2..a51e643 100644 Binary files a/docs/images/admin-terms-index.png and b/docs/images/admin-terms-index.png differ diff --git a/docs/images/admin-terms-update-translation.png b/docs/images/admin-terms-update-translation.png index 60ef821..e6415b8 100644 Binary files a/docs/images/admin-terms-update-translation.png and b/docs/images/admin-terms-update-translation.png differ diff --git a/docs/images/admin-terms-update.png b/docs/images/admin-terms-update.png index f5b6c9b..231eacd 100644 Binary files a/docs/images/admin-terms-update.png and b/docs/images/admin-terms-update.png differ diff --git a/docs/images/shop-checkout-complete.png b/docs/images/shop-checkout-complete.png index 8260dc3..1d485ae 100644 Binary files a/docs/images/shop-checkout-complete.png and b/docs/images/shop-checkout-complete.png differ diff --git a/node_modules b/node_modules index 9270531..f802bac 120000 --- a/node_modules +++ b/node_modules @@ -1 +1 @@ -tests/Application/node_modules \ No newline at end of file +vendor/sylius/test-application/node_modules \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 22655a4..d0fdb2c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ + bootstrap="vendor/sylius/test-application/config/bootstrap.php"> src/ @@ -13,6 +13,7 @@ + diff --git a/psalm.xml b/psalm.xml index b3e0471..90fe3c4 100644 --- a/psalm.xml +++ b/psalm.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" - phpVersion="8.1" + phpVersion="8.2" errorLevel="1" findUnusedBaselineEntry="false" findUnusedPsalmSuppress="false" @@ -14,7 +14,7 @@ - + @@ -30,6 +30,11 @@ + + + + + @@ -38,7 +43,18 @@ + + + + + + + + + + + diff --git a/src/DependencyInjection/SetonoSyliusTermsExtension.php b/src/DependencyInjection/SetonoSyliusTermsExtension.php index 56a3a76..a78b4fe 100644 --- a/src/DependencyInjection/SetonoSyliusTermsExtension.php +++ b/src/DependencyInjection/SetonoSyliusTermsExtension.php @@ -7,6 +7,7 @@ use ReflectionClass; use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension; use Sylius\Bundle\ResourceBundle\SyliusResourceBundle; +use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; @@ -16,14 +17,20 @@ final class SetonoSyliusTermsExtension extends AbstractResourceExtension implements PrependExtensionInterface { public function load(array $configs, ContainerBuilder $container): void + { + $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config')); + + $loader->load('services.xml'); + } + + public function prepend(ContainerBuilder $container): void { /** * @psalm-suppress PossiblyNullArgument * * @var array{forms: array, routing: array{terms: string}, resources: array} $config */ - $config = $this->processConfiguration($this->getConfiguration([], $container), $configs); - $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); + $config = $this->getCurrentConfiguration($container); foreach ($config['forms'] as $form => $formConfig) { $reflectionClass = new ReflectionClass($form); @@ -34,18 +41,8 @@ public function load(array $configs, ContainerBuilder $container): void $container->setParameter('setono_sylius_terms.forms', $config['forms']); $container->setParameter('setono_sylius_terms.terms_path', $config['routing']['terms']); - $loader->load('services.xml'); + $this->registerResources('setono_sylius_terms', SyliusResourceBundle::DRIVER_DOCTRINE_ORM, $config['resources'], $container); - $this->registerResources( - 'setono_sylius_terms', - SyliusResourceBundle::DRIVER_DOCTRINE_ORM, - $config['resources'], - $container, - ); - } - - public function prepend(ContainerBuilder $container): void - { $container->prependExtensionConfig('sylius_grid', [ 'grids' => [ 'setono_sylius_terms_terms' => [ @@ -68,7 +65,7 @@ public function prepend(ContainerBuilder $container): void 'type' => 'twig', 'label' => 'setono_sylius_terms.ui.channels', 'options' => [ - 'template' => '@SetonoSyliusTermsPlugin/admin/grid/field/channels.html.twig', + 'template' => '@SyliusAdmin/shared/grid/field/channels.html.twig', ], ], ], @@ -90,17 +87,15 @@ public function prepend(ContainerBuilder $container): void ], ], ]); + } - $container->prependExtensionConfig('sylius_ui', [ - 'events' => [ - 'setono_sylius_terms.admin.terms.create.javascripts' => [ - 'blocks' => [ - 'javascripts' => [ - 'template' => '@SetonoSyliusTermsPlugin/admin/terms/_javascripts.html.twig', - ], - ], - ], - ], - ]); + /** @return array */ + private function getCurrentConfiguration(ContainerBuilder $container): array + { + /** @var ConfigurationInterface $configuration */ + $configuration = $this->getConfiguration([], $container); + $configs = $container->getExtensionConfig($this->getAlias()); + + return $this->processConfiguration($configuration, $configs); } } diff --git a/src/EventSubscriber/AddMenuSubscriber.php b/src/EventSubscriber/AddMenuSubscriber.php index 71c81d6..af73fc6 100644 --- a/src/EventSubscriber/AddMenuSubscriber.php +++ b/src/EventSubscriber/AddMenuSubscriber.php @@ -35,9 +35,15 @@ private function addChild(ItemInterface $item): void $item ->addChild('terms', [ 'route' => 'setono_sylius_terms_admin_terms_index', + 'extras' => [ + 'routes' => [ + ['route' => 'setono_sylius_terms_admin_terms_create'], + ['route' => 'setono_sylius_terms_admin_terms_update'], + ], + ], ]) ->setLabel('setono_sylius_terms.menu.admin.main.configuration.terms') - ->setLabelAttribute('icon', 'check circle outline') + ->setLabelAttribute('icon', 'tabler:circle-check') ; } } diff --git a/src/Resources/config/routes/admin.yaml b/src/Resources/config/routes/admin.yaml deleted file mode 100644 index c232c0a..0000000 --- a/src/Resources/config/routes/admin.yaml +++ /dev/null @@ -1,15 +0,0 @@ -setono_sylius_terms_admin_terms: - resource: | - alias: setono_sylius_terms.terms - section: admin - templates: "@SyliusAdmin\\Crud" - redirect: update - grid: setono_sylius_terms_terms - vars: - all: - subheader: setono_sylius_terms.ui.manage_terms - templates: - form: "@SetonoSyliusTermsPlugin/admin/terms/_form.html.twig" - index: - icon: 'check circle outline' - type: sylius.resource diff --git a/src/Resources/config/routes_no_locale.yaml b/src/Resources/config/routes_no_locale.yaml deleted file mode 100644 index f4d2357..0000000 --- a/src/Resources/config/routes_no_locale.yaml +++ /dev/null @@ -1,6 +0,0 @@ -setono_sylius_terms_shop: - resource: "@SetonoSyliusTermsPlugin/Resources/config/routes/shop.yaml" - -setono_sylius_terms_admin: - resource: "@SetonoSyliusTermsPlugin/Resources/config/routes/admin.yaml" - prefix: /admin diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml deleted file mode 100644 index ecff83d..0000000 --- a/src/Resources/config/services.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff --git a/src/Resources/public/slugger.js b/src/Resources/public/slugger.js deleted file mode 100644 index a0d711a..0000000 --- a/src/Resources/public/slugger.js +++ /dev/null @@ -1,282 +0,0 @@ -/** - * Copied from https://jsfiddle.net/ARTsinn/J4BRX/ - */ -(function () { - - // some defaults - var options = { - sensitive: false, - replacement: "-", - truncate: false - }; - - // regex - var nonWord = /\W/g, - nonAlpha = /[^a-z0-9-]/g, - whitespace = /\s+/g, - trim = /^\s+|\s+$/g; - - // replacement charmap - var map = { - "À": "A", - "Á": "A", - "Â": "A", - "Ã": "A", - "Ä": "A", - "Å": "A", - "Æ": "AE", - "Ç": "C", - "È": "E", - "É": "E", - "Ê": "E", - "Ë": "E", - "Ì": "I", - "Í": "I", - "Î": "I", - "Ï": "I", - "Ð": "D", - "Ñ": "N", - "Ò": "O", - "Ó": "O", - "Ô": "O", - "Õ": "O", - "Ö": "O", - "Ø": "O", - "Ù": "U", - "Ú": "U", - "Û": "U", - "Ü": "U", - "Ý": "Y", - "ß": "s", - "à": "a", - "á": "a", - "â": "a", - "ã": "a", - "ä": "a", - "å": "a", - "æ": "ae", - "ç": "c", - "è": "e", - "é": "e", - "ê": "e", - "ë": "e", - "ì": "i", - "í": "i", - "î": "i", - "ï": "i", - "ñ": "n", - "ò": "o", - "ó": "o", - "ô": "o", - "õ": "o", - "ö": "o", - "ø": "o", - "ù": "u", - "ú": "u", - "û": "u", - "ü": "u", - "ý": "y", - "ÿ": "y", - "Ā": "A", - "ā": "a", - "Ă": "A", - "ă": "a", - "Ą": "A", - "ą": "a", - "Ć": "C", - "ć": "c", - "Ĉ": "C", - "ĉ": "c", - "Ċ": "C", - "ċ": "c", - "Č": "C", - "č": "c", - "Ď": "D", - "ď": "d", - "Đ": "D", - "đ": "d", - "Ē": "E", - "ē": "e", - "Ĕ": "E", - "ĕ": "e", - "Ė": "E", - "ė": "e", - "Ę": "E", - "ę": "e", - "Ě": "E", - "ě": "e", - "Ĝ": "G", - "ĝ": "g", - "Ğ": "G", - "ğ": "g", - "Ġ": "G", - "ġ": "g", - "Ģ": "G", - "ģ": "g", - "Ĥ": "H", - "ĥ": "h", - "Ħ": "H", - "ħ": "h", - "Ĩ": "I", - "ĩ": "i", - "Ī": "I", - "ī": "i", - "Ĭ": "I", - "ĭ": "i", - "Į": "I", - "į": "i", - "İ": "I", - "ı": "i", - "IJ": "IJ", - "ij": "ij", - "Ĵ": "J", - "ĵ": "j", - "Ķ": "K", - "ķ": "k", - "Ĺ": "L", - "ĺ": "l", - "Ļ": "L", - "ļ": "l", - "Ľ": "L", - "ľ": "l", - "Ŀ": "L", - "ŀ": "l", - "Ł": "l", - "ł": "l", - "Ń": "N", - "ń": "n", - "Ņ": "N", - "ņ": "n", - "Ň": "N", - "ň": "n", - "ʼn": "n", - "Ō": "O", - "ō": "o", - "Ŏ": "O", - "ŏ": "o", - "Ő": "O", - "ő": "o", - "Œ": "OE", - "œ": "oe", - "Ŕ": "R", - "ŕ": "r", - "Ŗ": "R", - "ŗ": "r", - "Ř": "R", - "ř": "r", - "Ś": "S", - "ś": "s", - "Ŝ": "S", - "ŝ": "s", - "Ş": "S", - "ş": "s", - "Š": "S", - "š": "s", - "Ţ": "T", - "ţ": "t", - "Ť": "T", - "ť": "t", - "Ŧ": "T", - "ŧ": "t", - "Ũ": "U", - "ũ": "u", - "Ū": "U", - "ū": "u", - "Ŭ": "U", - "ŭ": "u", - "Ů": "U", - "ů": "u", - "Ű": "U", - "ű": "u", - "Ų": "U", - "ų": "u", - "Ŵ": "W", - "ŵ": "w", - "Ŷ": "Y", - "ŷ": "y", - "Ÿ": "Y", - "Ź": "Z", - "ź": "z", - "Ż": "Z", - "ż": "z", - "Ž": "Z", - "ž": "z", - "ſ": "s", - "ƒ": "f", - "Ơ": "O", - "ơ": "o", - "Ư": "U", - "ư": "u", - "Ǎ": "A", - "ǎ": "a", - "Ǐ": "I", - "ǐ": "i", - "Ǒ": "O", - "ǒ": "o", - "Ǔ": "U", - "ǔ": "u", - "Ǖ": "U", - "ǖ": "u", - "Ǘ": "U", - "ǘ": "u", - "Ǚ": "U", - "ǚ": "u", - "Ǜ": "U", - "ǜ": "u", - "Ǻ": "A", - "ǻ": "a", - "Ǽ": "AE", - "ǽ": "ae", - "Ǿ": "O", - "ǿ": "o" - }; - - // replacer - var mapping = function (c) { - return map[c] || c; - }; - - - /** - * Normalise a string replacing foreign characters - * whitespace and all other illegals - * @param {String} str - * @param {Object} opts - */ - - this.slugger = function (str, opts) { - if (!str || typeof str !== "string") return; - - // populate some defaults - if (opts) for (var key in opts) options[key] = opts[key]; - - // case-sensitive or not - if (!options.sensitive) str = str.toLowerCase(); - - str = str - - // trim whitespace - .replace(trim, "") - - // swap foreign characters - .replace(nonWord, mapping) - - // replace whitespace - .replace(whitespace, options.replacement) - - // remove everything but alphanumeric characters and dashes - .replace(nonAlpha, "") - - // replace multiple instances of the replacement character with a single instance - .replace(new RegExp(`[${options.replacement}]+`, 'g'), options.replacement) - ; - - // smart truncate - if (options.truncate && str.length > options.truncate) { - var cut = str.indexOf("-", options.truncate); - str = cut === -1 ? str : str.slice(0, cut); - } - - return str; - }; -}()); diff --git a/src/Resources/public/slugify-terms-name.js b/src/Resources/public/slugify-terms-name.js deleted file mode 100644 index 48bcd7d..0000000 --- a/src/Resources/public/slugify-terms-name.js +++ /dev/null @@ -1,8 +0,0 @@ -document.addEventListener('DOMContentLoaded', function (e) { - document.querySelectorAll('input[name*="setono_sylius_terms_terms[translations]"][name*="[name]"]').forEach(function (input) { - input.addEventListener('input', function (event) { - const element = event.currentTarget; - element.closest('.content').querySelector('[name*="[slug]"]').value = slugger(element.value); - }); - }); -}); diff --git a/src/Resources/views/admin/grid/field/channels.html.twig b/src/Resources/views/admin/grid/field/channels.html.twig deleted file mode 100644 index 9c86b93..0000000 --- a/src/Resources/views/admin/grid/field/channels.html.twig +++ /dev/null @@ -1,7 +0,0 @@ -
    - {% for channel in data %} -
  • - {{ channel.name }} -
  • - {% endfor %} -
diff --git a/src/Resources/views/admin/terms/_form.html.twig b/src/Resources/views/admin/terms/_form.html.twig deleted file mode 100644 index 27a7c6c..0000000 --- a/src/Resources/views/admin/terms/_form.html.twig +++ /dev/null @@ -1,20 +0,0 @@ -{% from '@SyliusAdmin/Macro/translationForm.html.twig' import translationFormWithSlug %} - -
-
- {{ form_errors(form) }} - -
- {{ form_row(form.code) }} - {{ form_row(form.enabled) }} -
- {{ form_row(form.forms) }} - {{ form_row(form.channels) }} -
- -
-
-
- {{ translationFormWithSlug(form.translations, '@SyliusAdmin/Product/_slugField.html.twig', terms) }} -
-
diff --git a/src/Resources/views/admin/terms/_javascripts.html.twig b/src/Resources/views/admin/terms/_javascripts.html.twig deleted file mode 100644 index f650404..0000000 --- a/src/Resources/views/admin/terms/_javascripts.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -{% include '@SyliusUi/_javascripts.html.twig' with {'path': '/bundles/setonosyliustermsplugin/slugger.js'} %} -{% include '@SyliusUi/_javascripts.html.twig' with {'path': '/bundles/setonosyliustermsplugin/slugify-terms-name.js'} %} diff --git a/src/Resources/views/shop/terms/show.html.twig b/src/Resources/views/shop/terms/show.html.twig deleted file mode 100644 index 9814ab2..0000000 --- a/src/Resources/views/shop/terms/show.html.twig +++ /dev/null @@ -1,19 +0,0 @@ -{% extends '@SyliusShop/layout.html.twig' %} - -{%- block title -%} - {{ terms.name }} -{%- endblock -%} - -{% block content %} - {% include '@SetonoSyliusTermsPlugin/shop/terms/show/_breadcrumb.html.twig' %} - - - -
-
-

{{ terms.name }}

- - {{ terms.content|raw }} -
-
-{% endblock %} diff --git a/src/Resources/views/shop/terms/show/_breadcrumb.html.twig b/src/Resources/views/shop/terms/show/_breadcrumb.html.twig deleted file mode 100644 index db4e950..0000000 --- a/src/Resources/views/shop/terms/show/_breadcrumb.html.twig +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/SetonoSyliusTermsPlugin.php b/src/SetonoSyliusTermsPlugin.php index 53471d8..9b22295 100644 --- a/src/SetonoSyliusTermsPlugin.php +++ b/src/SetonoSyliusTermsPlugin.php @@ -18,4 +18,18 @@ public function getSupportedDrivers(): array SyliusResourceBundle::DRIVER_DOCTRINE_ORM, ]; } + + public function getPath(): string + { + return \dirname(__DIR__); + } + + protected function getConfigFilesPath(): string + { + return sprintf( + '%s/config/doctrine/%s', + $this->getPath(), + strtolower($this->getDoctrineMappingDirectory()), + ); + } } diff --git a/src/Twig/Component/Terms/FormComponent.php b/src/Twig/Component/Terms/FormComponent.php new file mode 100644 index 0000000..67e5d77 --- /dev/null +++ b/src/Twig/Component/Terms/FormComponent.php @@ -0,0 +1,43 @@ + */ + use ResourceFormComponentTrait; + use TemplatePropTrait; + + /** + * @param RepositoryInterface $termsRepository + */ + public function __construct( + RepositoryInterface $termsRepository, + FormFactoryInterface $formFactory, + string $resourceClass, + string $formClass, + protected readonly SlugGeneratorInterface $slugGenerator, + ) { + $this->initialize($termsRepository, $formFactory, $resourceClass, $formClass); + } + + #[LiveAction] + public function generateTermsSlug(#[LiveArg] string $localeCode): void + { + $this->formValues['translations'][$localeCode]['slug'] = + $this->slugGenerator->generate($this->formValues['translations'][$localeCode]['name'] ?? ''); + } +} diff --git a/templates/admin/terms/form.html.twig b/templates/admin/terms/form.html.twig new file mode 100644 index 0000000..978a143 --- /dev/null +++ b/templates/admin/terms/form.html.twig @@ -0,0 +1,17 @@ +{# Rendered with using Setono\SyliusTermsPlugin\Twig\Component\Terms\FormComponent #} + +{% form_theme form '@SetonoSyliusTermsPlugin/admin/terms/form_theme.html.twig' %} + +
+ {{ form_start(form, {'attr': {'class': 'ui loadable form', 'novalidate': 'novalidate', 'id': form.vars.id}}) }} +
+ {% if hookable_metadata.configuration.method is defined %} + + {% endif %} + {{ form_errors(form) }} + {{ form_widget(form._token) }} + + {% hook 'form' with { form, resource } %} +
+ {{ form_end(form, {render_rest: hookable.configuration.render_rest|default(false)}) }} +
diff --git a/templates/admin/terms/form/sections/general.html.twig b/templates/admin/terms/form/sections/general.html.twig new file mode 100644 index 0000000..7d031cb --- /dev/null +++ b/templates/admin/terms/form/sections/general.html.twig @@ -0,0 +1,12 @@ +
+
+
+ {{ 'sylius.ui.general'|trans }} +
+
+
+
+ {% hook 'general' %} +
+
+
diff --git a/templates/admin/terms/form/sections/general/channels.html.twig b/templates/admin/terms/form/sections/general/channels.html.twig new file mode 100644 index 0000000..d43328c --- /dev/null +++ b/templates/admin/terms/form/sections/general/channels.html.twig @@ -0,0 +1,5 @@ +{% set form = hookable_metadata.context.form %} + +
+ {{ form_row(form.channels, sylius_test_form_attribute('channels')) }} +
diff --git a/templates/admin/terms/form/sections/general/code.html.twig b/templates/admin/terms/form/sections/general/code.html.twig new file mode 100644 index 0000000..09a3a0d --- /dev/null +++ b/templates/admin/terms/form/sections/general/code.html.twig @@ -0,0 +1,5 @@ +{% set form = hookable_metadata.context.form %} + +
+ {{ form_row(form.code, sylius_test_form_attribute('code')) }} +
diff --git a/templates/admin/terms/form/sections/general/enabled.html.twig b/templates/admin/terms/form/sections/general/enabled.html.twig new file mode 100644 index 0000000..e124c6b --- /dev/null +++ b/templates/admin/terms/form/sections/general/enabled.html.twig @@ -0,0 +1,5 @@ +{% set form = hookable_metadata.context.form %} + +
+ {{ form_row(form.enabled, sylius_test_form_attribute('enabled')) }} +
diff --git a/templates/admin/terms/form/sections/general/forms.html.twig b/templates/admin/terms/form/sections/general/forms.html.twig new file mode 100644 index 0000000..9159bc8 --- /dev/null +++ b/templates/admin/terms/form/sections/general/forms.html.twig @@ -0,0 +1,5 @@ +{% set form = hookable_metadata.context.form %} + +
+ {{ form_row(form.forms, sylius_test_form_attribute('forms')) }} +
diff --git a/templates/admin/terms/form/sections/translations.html.twig b/templates/admin/terms/form/sections/translations.html.twig new file mode 100644 index 0000000..362f9da --- /dev/null +++ b/templates/admin/terms/form/sections/translations.html.twig @@ -0,0 +1,16 @@ +{% import '@SyliusAdmin/shared/helper/translations.html.twig' as translations %} + +{% set form = hookable_metadata.context.form %} +{% set prefixes = hookable_metadata.prefixes %} + +
+
+
{{ 'sylius.ui.translations'|trans }}
+
+ +
+
+ {{ translations.with_hook(form.translations, prefixes, null, { accordion_flush: true }) }} +
+
+
diff --git a/templates/admin/terms/form/sections/translations/content.html.twig b/templates/admin/terms/form/sections/translations/content.html.twig new file mode 100644 index 0000000..9a44e96 --- /dev/null +++ b/templates/admin/terms/form/sections/translations/content.html.twig @@ -0,0 +1,5 @@ +{% set form = hookable_metadata.context.form %} + +
+ {{ form_row(form.content, sylius_test_form_attribute('content')) }} +
diff --git a/templates/admin/terms/form/sections/translations/label.html.twig b/templates/admin/terms/form/sections/translations/label.html.twig new file mode 100644 index 0000000..2085377 --- /dev/null +++ b/templates/admin/terms/form/sections/translations/label.html.twig @@ -0,0 +1,5 @@ +{% set form = hookable_metadata.context.form %} + +
+ {{ form_row(form.label, sylius_test_form_attribute('label')) }} +
diff --git a/templates/admin/terms/form/sections/translations/name.html.twig b/templates/admin/terms/form/sections/translations/name.html.twig new file mode 100644 index 0000000..96597c2 --- /dev/null +++ b/templates/admin/terms/form/sections/translations/name.html.twig @@ -0,0 +1,5 @@ +{% set form = hookable_metadata.context.form %} + +
+ {{ form_row(form.name, sylius_test_form_attribute('name')) }} +
diff --git a/templates/admin/terms/form/sections/translations/slug.html.twig b/templates/admin/terms/form/sections/translations/slug.html.twig new file mode 100644 index 0000000..7c1db47 --- /dev/null +++ b/templates/admin/terms/form/sections/translations/slug.html.twig @@ -0,0 +1,5 @@ +{% set form = hookable_metadata.context.form %} + +
+ {{ form_row(form.slug, sylius_test_form_attribute('slug')) }} +
diff --git a/templates/admin/terms/form_theme.html.twig b/templates/admin/terms/form_theme.html.twig new file mode 100644 index 0000000..bb0c347 --- /dev/null +++ b/templates/admin/terms/form_theme.html.twig @@ -0,0 +1,21 @@ +{% extends '@SyliusAdmin/shared/form_theme.html.twig' %} + +{% block _setono_sylius_terms_terms_translations_entry_slug_row %} + {% set locale = form.parent.vars.name %} + + {{ form_label(form) }} +
+ {{ form_widget(form, sylius_test_form_attribute('slug', locale)) }} + +
+ {{ form_errors(form) }} +{% endblock %} diff --git a/templates/shop/checkout/complete/content/form/terms.html.twig b/templates/shop/checkout/complete/content/form/terms.html.twig new file mode 100644 index 0000000..8e0a987 --- /dev/null +++ b/templates/shop/checkout/complete/content/form/terms.html.twig @@ -0,0 +1,3 @@ +{% set form = hookable_metadata.context.form %} + +{{ form_row(form.terms, sylius_test_form_attribute('terms')) }} diff --git a/src/Resources/views/shop/terms/link.html.twig b/templates/shop/terms/link.html.twig similarity index 61% rename from src/Resources/views/shop/terms/link.html.twig rename to templates/shop/terms/link.html.twig index b51b1d9..1efc1c4 100644 --- a/src/Resources/views/shop/terms/link.html.twig +++ b/templates/shop/terms/link.html.twig @@ -1,2 +1,2 @@ -{# @var terms \Setono\SyliusTermsPlugin\Model\TermsInterface #} +{# @var terms \Setono\SyliusTermsPlugin\Entity\TermsInterface #} {{ terms.name }} diff --git a/templates/shop/terms/show.html.twig b/templates/shop/terms/show.html.twig new file mode 100644 index 0000000..2c2aba0 --- /dev/null +++ b/templates/shop/terms/show.html.twig @@ -0,0 +1,7 @@ +{% extends '@SyliusShop/shared/layout/base.html.twig' %} + +{% block title %}{{ terms.name }} | {{ parent() }}{% endblock %} + +{% block content %} + {% hook 'setono_sylius_terms.shop.terms.show' %} +{% endblock %} diff --git a/templates/shop/terms/show/content.html.twig b/templates/shop/terms/show/content.html.twig new file mode 100644 index 0000000..6392fe0 --- /dev/null +++ b/templates/shop/terms/show/content.html.twig @@ -0,0 +1,3 @@ +
+ {% hook 'content' %} +
diff --git a/templates/shop/terms/show/content/header.html.twig b/templates/shop/terms/show/content/header.html.twig new file mode 100644 index 0000000..4176a43 --- /dev/null +++ b/templates/shop/terms/show/content/header.html.twig @@ -0,0 +1 @@ +{% hook 'header' %} diff --git a/templates/shop/terms/show/content/header/breadcrumbs.html.twig b/templates/shop/terms/show/content/header/breadcrumbs.html.twig new file mode 100644 index 0000000..4aabfa7 --- /dev/null +++ b/templates/shop/terms/show/content/header/breadcrumbs.html.twig @@ -0,0 +1,8 @@ +{% from '@SyliusShop/shared/breadcrumbs.html.twig' import breadcrumbs as breadcrumbs %} + +{% set terms = hookable_metadata.context.terms %} + +{{ breadcrumbs([ + { label: 'sylius.ui.home'|trans, path: path('sylius_shop_homepage')}, + { label: terms.name, active: true } +]) }} diff --git a/templates/shop/terms/show/content/main.html.twig b/templates/shop/terms/show/content/main.html.twig new file mode 100644 index 0000000..963e810 --- /dev/null +++ b/templates/shop/terms/show/content/main.html.twig @@ -0,0 +1,3 @@ +
+ {% hook 'main' %} +
diff --git a/templates/shop/terms/show/content/main/content.html.twig b/templates/shop/terms/show/content/main/content.html.twig new file mode 100644 index 0000000..fdf988e --- /dev/null +++ b/templates/shop/terms/show/content/main/content.html.twig @@ -0,0 +1,3 @@ +{% set terms = hookable_metadata.context.terms %} + +{{ terms.content|raw }} diff --git a/templates/shop/terms/show/content/main/name.html.twig b/templates/shop/terms/show/content/main/name.html.twig new file mode 100644 index 0000000..fa5e361 --- /dev/null +++ b/templates/shop/terms/show/content/main/name.html.twig @@ -0,0 +1,3 @@ +{% set terms = hookable_metadata.context.terms %} + +

{{ terms.name }}

diff --git a/tests/Application/.env b/tests/Application/.env deleted file mode 100644 index fd5fd3d..0000000 --- a/tests/Application/.env +++ /dev/null @@ -1,47 +0,0 @@ -# In all environments, the following files are loaded if they exist, -# the later taking precedence over the former: -# -# * .env contains default values for the environment variables needed by the app -# * .env.local uncommitted file with local overrides -# * .env.$APP_ENV committed environment-specific defaults -# * .env.$APP_ENV.local uncommitted environment-specific overrides -# -# Real environment variables win over .env files. -# -# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. -# -# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). -# 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 https://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/setono_sylius_terms_%kernel.environment%?serverVersion=5.7 -###< doctrine/doctrine-bundle ### - -###> lexik/jwt-authentication-bundle ### -JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem -JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem -JWT_PASSPHRASE=acme_plugin_development -###< lexik/jwt-authentication-bundle ### - -###> symfony/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 ### - -###> 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_DSN=null://localhost -###< symfony/swiftmailer-bundle ### diff --git a/tests/Application/.env.test b/tests/Application/.env.test deleted file mode 100644 index 2d53b11..0000000 --- a/tests/Application/.env.test +++ /dev/null @@ -1,2 +0,0 @@ -APP_SECRET='ch4mb3r0f5ecr3ts' -KERNEL_CLASS='Setono\SyliusTermsPlugin\Tests\Application\Kernel' diff --git a/tests/Application/.eslintrc.js b/tests/Application/.eslintrc.js deleted file mode 100644 index dfddb25..0000000 --- a/tests/Application/.eslintrc.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - extends: 'airbnb-base', - env: { - node: true, - }, - rules: { - 'object-shorthand': ['error', 'always', { - avoidQuotes: true, - avoidExplicitReturnArrows: true, - }], - 'function-paren-newline': ['error', 'consistent'], - 'max-len': ['warn', 120, 2, { - ignoreUrls: true, - ignoreComments: false, - ignoreRegExpLiterals: true, - ignoreStrings: true, - ignoreTemplateLiterals: true, - }], - }, -}; diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore deleted file mode 100644 index bc600a8..0000000 --- a/tests/Application/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -/public/assets -/public/build -/public/css -/public/js -/public/media/* -!/public/media/image/ -/public/media/image/* -!/public/media/image/.gitignore - -/node_modules - -###> symfony/framework-bundle ### -/.env.*.local -/.env.local -/.env.local.php -/public/bundles -/var/ -/vendor/ -###< symfony/framework-bundle ### - -###> symfony/web-server-bundle ### -/.web-server-pid -###< symfony/web-server-bundle ### diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php deleted file mode 100644 index 374aaf0..0000000 --- a/tests/Application/Kernel.php +++ /dev/null @@ -1,73 +0,0 @@ -getProjectDir() . '/var/cache/' . $this->environment; - } - - public function getLogDir(): string - { - return $this->getProjectDir() . '/var/log'; - } - - public function registerBundles(): iterable - { - foreach ($this->getConfigurationDirectories() as $confDir) { - $bundlesFile = $confDir . '/bundles.php'; - if (false === is_file($bundlesFile)) { - continue; - } - yield from $this->registerBundlesFromFile($bundlesFile); - } - } - - protected function configureRoutes(RoutingConfigurator $routes): void - { - foreach ($this->getConfigurationDirectories() as $confDir) { - $this->loadRoutesConfiguration($routes, $confDir); - } - } - - 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'; - } -} 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 5e2dc5f..0000000 --- a/tests/Application/bin/console +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env php -getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); -} - -if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); -} - -require dirname(__DIR__).'/config/bootstrap.php'; - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists(Debug::class)) { - Debug::enable(); - } -} - -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$application = new Application($kernel); -$application->run($input); diff --git a/tests/Application/composer.json b/tests/Application/composer.json deleted file mode 100644 index 326735f..0000000 --- a/tests/Application/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "sylius/plugin-skeleton-test-application", - "description": "Sylius application for plugin testing purposes (composer.json needed for project dir resolving)", - "license": "MIT" -} diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php deleted file mode 100644 index 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 4d6ec65..0000000 --- a/tests/Application/config/bundles.php +++ /dev/null @@ -1,61 +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], - Setono\SyliusTermsPlugin\SetonoSyliusTermsPlugin::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], - League\FlysystemBundle\FlysystemBundle::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], - Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], - Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], - ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], - Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], - Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], - SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], - BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::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 a78e725..0000000 --- a/tests/Application/config/packages/_sylius.yaml +++ /dev/null @@ -1,15 +0,0 @@ -imports: - - { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" } - -parameters: - sylius_core.public_dir: '%kernel.project_dir%/public' - -sylius_shop: - product_grid: - include_all_descendants: true - -sylius_api: - enabled: true diff --git a/tests/Application/config/packages/api_platform.yaml b/tests/Application/config/packages/api_platform.yaml deleted file mode 100644 index 26def49..0000000 --- a/tests/Application/config/packages/api_platform.yaml +++ /dev/null @@ -1,9 +0,0 @@ -api_platform: - mapping: - paths: - - '%kernel.project_dir%/../../vendor/sylius/sylius/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources' - - '%kernel.project_dir%/config/api_platform' - patch_formats: - json: ['application/merge-patch+json'] - swagger: - versions: [3] diff --git a/tests/Application/config/packages/assets.yaml b/tests/Application/config/packages/assets.yaml deleted file mode 100644 index 2468901..0000000 --- a/tests/Application/config/packages/assets.yaml +++ /dev/null @@ -1,7 +0,0 @@ -framework: - assets: - packages: - shop: - json_manifest_path: '%kernel.project_dir%/public/build/shop/manifest.json' - admin: - json_manifest_path: '%kernel.project_dir%/public/build/admin/manifest.json' diff --git a/tests/Application/config/packages/dev/framework.yaml b/tests/Application/config/packages/dev/framework.yaml deleted file mode 100644 index 4b116de..0000000 --- a/tests/Application/config/packages/dev/framework.yaml +++ /dev/null @@ -1,2 +0,0 @@ -framework: - profiler: { only_exceptions: false } diff --git a/tests/Application/config/packages/dev/jms_serializer.yaml b/tests/Application/config/packages/dev/jms_serializer.yaml deleted file mode 100644 index 2f32a9b..0000000 --- a/tests/Application/config/packages/dev/jms_serializer.yaml +++ /dev/null @@ -1,12 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/packages/dev/monolog.yaml b/tests/Application/config/packages/dev/monolog.yaml deleted file mode 100644 index da2b092..0000000 --- a/tests/Application/config/packages/dev/monolog.yaml +++ /dev/null @@ -1,9 +0,0 @@ -monolog: - handlers: - main: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug - firephp: - type: firephp - level: info diff --git a/tests/Application/config/packages/dev/routing.yaml b/tests/Application/config/packages/dev/routing.yaml deleted file mode 100644 index 4116679..0000000 --- a/tests/Application/config/packages/dev/routing.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - router: - strict_requirements: true diff --git a/tests/Application/config/packages/dev/web_profiler.yaml b/tests/Application/config/packages/dev/web_profiler.yaml deleted file mode 100644 index 1f1cb2b..0000000 --- a/tests/Application/config/packages/dev/web_profiler.yaml +++ /dev/null @@ -1,3 +0,0 @@ -web_profiler: - toolbar: true - intercept_redirects: false diff --git a/tests/Application/config/packages/doctrine.yaml b/tests/Application/config/packages/doctrine.yaml deleted file mode 100644 index f51ba5a..0000000 --- a/tests/Application/config/packages/doctrine.yaml +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - # Adds a fallback DATABASE_URL if the env var is not set. - # This allows you to run cache:warmup even if your - # environment variables are not available yet. - # You should not need to change this value. - env(DATABASE_URL): '' - -doctrine: - dbal: - driver: 'pdo_mysql' - server_version: '5.7' - charset: UTF8 - - url: '%env(resolve:DATABASE_URL)%' diff --git a/tests/Application/config/packages/doctrine_migrations.yaml b/tests/Application/config/packages/doctrine_migrations.yaml deleted file mode 100644 index cdbc01a..0000000 --- a/tests/Application/config/packages/doctrine_migrations.yaml +++ /dev/null @@ -1,4 +0,0 @@ -doctrine_migrations: - storage: - table_storage: - table_name: sylius_migrations diff --git a/tests/Application/config/packages/fos_rest.yaml b/tests/Application/config/packages/fos_rest.yaml deleted file mode 100644 index eaebb27..0000000 --- a/tests/Application/config/packages/fos_rest.yaml +++ /dev/null @@ -1,11 +0,0 @@ -fos_rest: - exception: true - view: - formats: - json: true - xml: true - empty_content: 204 - format_listener: - rules: - - { path: '^/api/v1/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true } - - { path: '^/', stop: true } diff --git a/tests/Application/config/packages/framework.yaml b/tests/Application/config/packages/framework.yaml deleted file mode 100644 index 3df2c0a..0000000 --- a/tests/Application/config/packages/framework.yaml +++ /dev/null @@ -1,9 +0,0 @@ -framework: - secret: '%env(APP_SECRET)%' - ide: phpstorm - form: - enabled: true - legacy_error_messages: false - csrf_protection: true - session: - handler_id: ~ diff --git a/tests/Application/config/packages/jms_serializer.yaml b/tests/Application/config/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc61..0000000 --- a/tests/Application/config/packages/jms_serializer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -jms_serializer: - visitors: - xml_serialization: - format_output: '%kernel.debug%' diff --git a/tests/Application/config/packages/lexik_jwt_authentication.yaml b/tests/Application/config/packages/lexik_jwt_authentication.yaml deleted file mode 100644 index edfb69d..0000000 --- a/tests/Application/config/packages/lexik_jwt_authentication.yaml +++ /dev/null @@ -1,4 +0,0 @@ -lexik_jwt_authentication: - secret_key: '%env(resolve:JWT_SECRET_KEY)%' - public_key: '%env(resolve:JWT_PUBLIC_KEY)%' - pass_phrase: '%env(JWT_PASSPHRASE)%' diff --git a/tests/Application/config/packages/liip_imagine.yaml b/tests/Application/config/packages/liip_imagine.yaml deleted file mode 100644 index bb2e7ce..0000000 --- a/tests/Application/config/packages/liip_imagine.yaml +++ /dev/null @@ -1,6 +0,0 @@ -liip_imagine: - resolvers: - default: - web_path: - web_root: "%kernel.project_dir%/public" - cache_prefix: "media/cache" diff --git a/tests/Application/config/packages/mailer.yaml b/tests/Application/config/packages/mailer.yaml deleted file mode 100644 index 56a650d..0000000 --- a/tests/Application/config/packages/mailer.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - mailer: - dsn: '%env(MAILER_DSN)%' diff --git a/tests/Application/config/packages/prod/doctrine.yaml b/tests/Application/config/packages/prod/doctrine.yaml deleted file mode 100644 index 2f16f0f..0000000 --- a/tests/Application/config/packages/prod/doctrine.yaml +++ /dev/null @@ -1,31 +0,0 @@ -doctrine: - orm: - metadata_cache_driver: - type: service - id: doctrine.system_cache_provider - query_cache_driver: - type: service - id: doctrine.system_cache_provider - result_cache_driver: - type: service - id: doctrine.result_cache_provider - -services: - doctrine.result_cache_provider: - class: Symfony\Component\Cache\DoctrineProvider - public: false - arguments: - - '@doctrine.result_cache_pool' - doctrine.system_cache_provider: - class: Symfony\Component\Cache\DoctrineProvider - public: false - arguments: - - '@doctrine.system_cache_pool' - -framework: - cache: - pools: - doctrine.result_cache_pool: - adapter: cache.app - doctrine.system_cache_pool: - adapter: cache.system diff --git a/tests/Application/config/packages/prod/jms_serializer.yaml b/tests/Application/config/packages/prod/jms_serializer.yaml deleted file mode 100644 index c288182..0000000 --- a/tests/Application/config/packages/prod/jms_serializer.yaml +++ /dev/null @@ -1,10 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION - json_deserialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/tests/Application/config/packages/prod/monolog.yaml b/tests/Application/config/packages/prod/monolog.yaml deleted file mode 100644 index 6461211..0000000 --- a/tests/Application/config/packages/prod/monolog.yaml +++ /dev/null @@ -1,10 +0,0 @@ -monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug diff --git a/tests/Application/config/packages/routing.yaml b/tests/Application/config/packages/routing.yaml deleted file mode 100644 index 368bc7f..0000000 --- a/tests/Application/config/packages/routing.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - router: - strict_requirements: ~ diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/packages/security.yaml deleted file mode 100644 index 2f5c687..0000000 --- a/tests/Application/config/packages/security.yaml +++ /dev/null @@ -1,122 +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 - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/forgotten-password", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } - - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/packages/setono_sylius_terms.yaml b/tests/Application/config/packages/setono_sylius_terms.yaml deleted file mode 100644 index 3e571d3..0000000 --- a/tests/Application/config/packages/setono_sylius_terms.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "@SetonoSyliusTermsPlugin/Resources/config/app/fixtures.yaml" } diff --git a/tests/Application/config/packages/staging/monolog.yaml b/tests/Application/config/packages/staging/monolog.yaml deleted file mode 100644 index 6461211..0000000 --- a/tests/Application/config/packages/staging/monolog.yaml +++ /dev/null @@ -1,10 +0,0 @@ -monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug diff --git a/tests/Application/config/packages/stof_doctrine_extensions.yaml b/tests/Application/config/packages/stof_doctrine_extensions.yaml deleted file mode 100644 index 7770f74..0000000 --- a/tests/Application/config/packages/stof_doctrine_extensions.yaml +++ /dev/null @@ -1,4 +0,0 @@ -# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html -# See the official DoctrineExtensions documentation for more details: https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/ -stof_doctrine_extensions: - default_locale: '%locale%' diff --git a/tests/Application/config/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml deleted file mode 100644 index fc1d3c1..0000000 --- a/tests/Application/config/packages/test/framework.yaml +++ /dev/null @@ -1,4 +0,0 @@ -framework: - test: ~ - session: - storage_factory_id: session.storage.factory.mock_file diff --git a/tests/Application/config/packages/test/monolog.yaml b/tests/Application/config/packages/test/monolog.yaml deleted file mode 100644 index 7e2b9e3..0000000 --- a/tests/Application/config/packages/test/monolog.yaml +++ /dev/null @@ -1,6 +0,0 @@ -monolog: - handlers: - main: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: error diff --git a/tests/Application/config/packages/test/security.yaml b/tests/Application/config/packages/test/security.yaml deleted file mode 100644 index 4071d31..0000000 --- a/tests/Application/config/packages/test/security.yaml +++ /dev/null @@ -1,6 +0,0 @@ -security: - password_hashers: - Sylius\Component\User\Model\UserInterface: - algorithm: argon2i - time_cost: 3 - memory_cost: 10 diff --git a/tests/Application/config/packages/test/sylius_theme.yaml b/tests/Application/config/packages/test/sylius_theme.yaml deleted file mode 100644 index 4d34199..0000000 --- a/tests/Application/config/packages/test/sylius_theme.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_theme: - sources: - test: ~ diff --git a/tests/Application/config/packages/test/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 76d7e5e..0000000 --- a/tests/Application/config/packages/test_cached/framework.yaml +++ /dev/null @@ -1,4 +0,0 @@ -framework: - test: ~ - session: - storage_id: session.storage.mock_file diff --git a/tests/Application/config/packages/test_cached/monolog.yaml b/tests/Application/config/packages/test_cached/monolog.yaml deleted file mode 100644 index 7e2b9e3..0000000 --- a/tests/Application/config/packages/test_cached/monolog.yaml +++ /dev/null @@ -1,6 +0,0 @@ -monolog: - handlers: - main: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: error diff --git a/tests/Application/config/packages/test_cached/security.yaml b/tests/Application/config/packages/test_cached/security.yaml deleted file mode 100644 index 21cc377..0000000 --- a/tests/Application/config/packages/test_cached/security.yaml +++ /dev/null @@ -1,3 +0,0 @@ -security: - encoders: - sha512: sha512 diff --git a/tests/Application/config/packages/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/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/twig_extensions.yaml b/tests/Application/config/packages/twig_extensions.yaml deleted file mode 100644 index 0881cc9..0000000 --- a/tests/Application/config/packages/twig_extensions.yaml +++ /dev/null @@ -1,11 +0,0 @@ -services: - _defaults: - public: false - autowire: true - autoconfigure: true - - # Uncomment any lines below to activate that Twig extension - #Twig\Extensions\ArrayExtension: ~ - #Twig\Extensions\DateExtension: ~ - #Twig\Extensions\IntlExtension: ~ - #Twig\Extensions\TextExtension: ~ diff --git a/tests/Application/config/packages/validator.yaml b/tests/Application/config/packages/validator.yaml deleted file mode 100644 index 61807db..0000000 --- a/tests/Application/config/packages/validator.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - validation: - enable_annotations: true diff --git a/tests/Application/config/packages/webpack_encore.yaml b/tests/Application/config/packages/webpack_encore.yaml deleted file mode 100644 index 9bee248..0000000 --- a/tests/Application/config/packages/webpack_encore.yaml +++ /dev/null @@ -1,5 +0,0 @@ -webpack_encore: - output_path: '%kernel.project_dir%/public/build/default' - builds: - shop: '%kernel.project_dir%/public/build/shop' - admin: '%kernel.project_dir%/public/build/admin' diff --git a/tests/Application/config/routes/dev/web_profiler.yaml b/tests/Application/config/routes/dev/web_profiler.yaml deleted file mode 100644 index 3e79dc2..0000000 --- a/tests/Application/config/routes/dev/web_profiler.yaml +++ /dev/null @@ -1,7 +0,0 @@ -_wdt: - resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" - prefix: /_wdt - -_profiler: - resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" - prefix: /_profiler diff --git a/tests/Application/config/routes/liip_imagine.yaml b/tests/Application/config/routes/liip_imagine.yaml deleted file mode 100644 index 201cbd5..0000000 --- a/tests/Application/config/routes/liip_imagine.yaml +++ /dev/null @@ -1,2 +0,0 @@ -_liip_imagine: - resource: "@LiipImagineBundle/Resources/config/routing.yaml" diff --git a/tests/Application/config/routes/setono_sylius_terms.yaml b/tests/Application/config/routes/setono_sylius_terms.yaml deleted file mode 100644 index dd4189d..0000000 --- a/tests/Application/config/routes/setono_sylius_terms.yaml +++ /dev/null @@ -1,2 +0,0 @@ -setono_sylius_terms: - resource: "@SetonoSyliusTermsPlugin/Resources/config/routes.yaml" diff --git a/tests/Application/config/routes/sylius_admin.yaml b/tests/Application/config/routes/sylius_admin.yaml deleted file mode 100644 index b9c12c2..0000000 --- a/tests/Application/config/routes/sylius_admin.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sylius_admin: - resource: "@SyliusAdminBundle/Resources/config/routing.yml" - prefix: '/%sylius_admin.path_name%' 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 22e7a4a..0000000 --- a/tests/Application/config/routes/sylius_shop.yaml +++ /dev/null @@ -1,23 +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 - -# see https://web.dev/change-password-url/ -sylius_shop_request_password_reset_token_redirect: - path: /.well-known/change-password - methods: [GET] - controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction - defaults: - route: sylius_shop_request_password_reset_token - permanent: false 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/serialization/.gitignore b/tests/Application/config/serialization/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Application/config/services.yaml b/tests/Application/config/services.yaml deleted file mode 100644 index 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/package.json b/tests/Application/package.json deleted file mode 100644 index 8f62c4c..0000000 --- a/tests/Application/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "dependencies": { - "chart.js": "^3.9", - "jquery": "^3.6", - "jquery.dirtyforms": "^2.0", - "lightbox2": "^2.9", - "semantic-ui-css": "^2.2", - "slick-carousel": "^1.8" - }, - "devDependencies": { - "@symfony/webpack-encore": "^1.8", - "eslint": "^8.18", - "eslint-config-airbnb-base": "^15.0", - "eslint-import-resolver-babel-module": "^5.3", - "eslint-plugin-import": "^2.26", - "node-sass": "^7.0", - "sass-loader": "^12.0" - }, - "scripts": { - "dev": "encore dev", - "build": "encore production", - "watch": "encore dev --watch" - }, - "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 2160592..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/SetonoSyliusTermsPlugin/shop/terms/show/eula_us.html.twig b/tests/Application/templates/bundles/SetonoSyliusTermsPlugin/shop/terms/show/eula_us.html.twig deleted file mode 100644 index 1c09e0f..0000000 --- a/tests/Application/templates/bundles/SetonoSyliusTermsPlugin/shop/terms/show/eula_us.html.twig +++ /dev/null @@ -1,20 +0,0 @@ -{% extends '@SyliusShop/layout.html.twig' %} - -{%- block title -%} - {{ terms.name }} -{%- endblock -%} - -{% block content %} - {% include '@SetonoSyliusTermsPlugin/shop/terms/show/_breadcrumb.html.twig' %} - - - -
-
-

NOTICE: This is a special template only for the EULA US terms

-

{{ terms.name }}

- - {{ terms.content|raw }} -
-
-{% endblock %} 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 1b65d7f..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/_logo.html.twig +++ /dev/null @@ -1,5 +0,0 @@ - -
- Sylius -
-
diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig deleted file mode 100644 index f5f9835..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/_scripts.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_script_tags('admin-entry', null, 'admin') }} diff --git a/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig b/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig deleted file mode 100644 index a96144c..0000000 --- a/tests/Application/templates/bundles/SyliusAdminBundle/_styles.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_link_tags('admin-entry', null, 'admin') }} diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig deleted file mode 100644 index f4bd66e..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig +++ /dev/null @@ -1,4 +0,0 @@ -{{ form_row(form.notes, {'attr': {'rows': 3}}) }} -{% if form.terms is defined %} - {{ form_row(form.terms) }} -{% endif %} diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig deleted file mode 100644 index bb594f7..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Homepage/_banner.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -Sylius - diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Footer/Grid/_plus.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Layout/Footer/Grid/_plus.html.twig deleted file mode 100644 index 0bf5a06..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Footer/Grid/_plus.html.twig +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Footer/Grid/_your_store.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Layout/Footer/Grid/_your_store.html.twig deleted file mode 100644 index b65f2c1..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Footer/Grid/_your_store.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -
-

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

- -
diff --git a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig deleted file mode 100644 index 39110d6..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig deleted file mode 100644 index d1655bb..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_script_tags('shop-entry', null, 'shop') }} diff --git a/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig b/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig deleted file mode 100644 index fd2c7cb..0000000 --- a/tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ encore_entry_link_tags('shop-entry', null, 'shop') }} diff --git a/tests/Application/translations/.gitignore b/tests/Application/translations/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js deleted file mode 100644 index fae1429..0000000 --- a/tests/Application/webpack.config.js +++ /dev/null @@ -1,47 +0,0 @@ -const path = require('path'); -const Encore = require('@symfony/webpack-encore'); - -const syliusBundles = path.resolve(__dirname, '../../vendor/sylius/sylius/src/Sylius/Bundle/'); -const uiBundleScripts = path.resolve(syliusBundles, 'UiBundle/Resources/private/js/'); -const uiBundleResources = path.resolve(syliusBundles, 'UiBundle/Resources/private/'); - -// Shop config -Encore - .setOutputPath('public/build/shop/') - .setPublicPath('/build/shop') - .addEntry('shop-entry', './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') - .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.externals = Object.assign({}, adminConfig.externals, { window: 'window', document: 'document' }); -adminConfig.name = 'admin'; - -module.exports = [shopConfig, adminConfig]; diff --git a/tests/TestApplication/.env b/tests/TestApplication/.env new file mode 100644 index 0000000..b26047e --- /dev/null +++ b/tests/TestApplication/.env @@ -0,0 +1,9 @@ +###> sylius/test-application ### +SYLIUS_TEST_APP_CONFIGS_TO_IMPORT="../../../../tests/TestApplication/config/config.yaml" +SYLIUS_TEST_APP_ROUTES_TO_IMPORT="../../../../tests/TestApplication/config/routes.yaml" +SYLIUS_TEST_APP_BUNDLES_PATH="tests/TestApplication/config/bundles.php" +###< sylius/test-application ### + +###> doctrine/doctrine-bundle ### +DATABASE_URL=mysql://root:root@127.0.0.1:3306/your_plugin_dev?serverVersion=8.0 +###< doctrine/doctrine-bundle ### diff --git a/tests/TestApplication/.env.test b/tests/TestApplication/.env.test new file mode 100644 index 0000000..1027941 --- /dev/null +++ b/tests/TestApplication/.env.test @@ -0,0 +1,5 @@ +###> sylius/test-application ### +SYLIUS_TEST_APP_CONFIGS_TO_IMPORT="../../../../tests/TestApplication/config/config.yaml" +SYLIUS_TEST_APP_ROUTES_TO_IMPORT="../../../../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..bbb6260 --- /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..1a9b845 --- /dev/null +++ b/tests/TestApplication/config/config.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "@SetonoSyliusTermsPlugin/config/config.yaml" } diff --git a/tests/TestApplication/config/routes.yaml b/tests/TestApplication/config/routes.yaml new file mode 100644 index 0000000..554b1d7 --- /dev/null +++ b/tests/TestApplication/config/routes.yaml @@ -0,0 +1,2 @@ +setono_sylius_terms: + resource: "@SetonoSyliusTermsPlugin/config/routes.yaml" diff --git a/tests/TestApplication/templates/bundles/SetonoSyliusTermsPlugin/shop/terms/show/eula_us.html.twig b/tests/TestApplication/templates/bundles/SetonoSyliusTermsPlugin/shop/terms/show/eula_us.html.twig new file mode 100644 index 0000000..1b3b22c --- /dev/null +++ b/tests/TestApplication/templates/bundles/SetonoSyliusTermsPlugin/shop/terms/show/eula_us.html.twig @@ -0,0 +1,22 @@ +{% extends '@SyliusShop/shared/layout/base.html.twig' %} + +{% block title %}{{ terms.name }} | {{ parent() }}{% endblock %} + +{% block content %} +
+ {% from '@SyliusShop/shared/breadcrumbs.html.twig' import breadcrumbs as breadcrumbs %} + + {{ breadcrumbs([ + { label: 'sylius.ui.home'|trans, path: path('sylius_shop_homepage')}, + { label: terms.name, active: true } + ]) }} + +
+

NOTICE: This is a special template only for the EULA US terms

+

{{ terms.name }}

+ + {{ terms.content|raw }} +
+
+{% endblock %} + diff --git a/src/Resources/translations/messages.da.yaml b/translations/messages.da.yaml similarity index 100% rename from src/Resources/translations/messages.da.yaml rename to translations/messages.da.yaml diff --git a/src/Resources/translations/messages.de.yaml b/translations/messages.de.yaml similarity index 100% rename from src/Resources/translations/messages.de.yaml rename to translations/messages.de.yaml 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/messages.fr.yaml b/translations/messages.fr.yaml similarity index 100% rename from src/Resources/translations/messages.fr.yaml rename to translations/messages.fr.yaml diff --git a/src/Resources/translations/messages.nl.yaml b/translations/messages.nl.yaml similarity index 100% rename from src/Resources/translations/messages.nl.yaml rename to translations/messages.nl.yaml diff --git a/src/Resources/translations/validators.da.yaml b/translations/validators.da.yaml similarity index 100% rename from src/Resources/translations/validators.da.yaml rename to translations/validators.da.yaml diff --git a/src/Resources/translations/validators.de.yaml b/translations/validators.de.yaml similarity index 100% rename from src/Resources/translations/validators.de.yaml rename to translations/validators.de.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/src/Resources/translations/validators.fr.yaml b/translations/validators.fr.yaml similarity index 100% rename from src/Resources/translations/validators.fr.yaml rename to translations/validators.fr.yaml diff --git a/src/Resources/translations/validators.nl.yaml b/translations/validators.nl.yaml similarity index 100% rename from src/Resources/translations/validators.nl.yaml rename to translations/validators.nl.yaml