diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index deeb43d9d..cd16ce8c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,30 +14,26 @@ on: jobs: tests: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" strategy: fail-fast: false matrix: - php: ["8.0"] - symfony: ["^5.4", "^6.0"] - sylius: ["~1.11.0", "~1.12.0"] - node: ["^14.17.x"] + php: ["8.1", "8.2", "8.3"] + symfony: ["^5.4", "^6.4"] + sylius: ["~1.12.0", "~1.13.0"] + node: ["20.x"] mysql: ["8.0"] - exclude: - - sylius: ~1.11.0 - symfony: "^6.0" - env: APP_ENV: test DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP @@ -45,12 +41,12 @@ jobs: with: php-version: "${{ matrix.php }}" extensions: intl - tools: symfony + tools: flex, symfony coverage: none - name: Setup Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: "${{ matrix.node }}" @@ -73,10 +69,6 @@ jobs: name: Install certificates run: symfony server:ca:install - - - name: Run Chrome Headless - run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & - - name: Run webserver run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) @@ -84,25 +76,17 @@ jobs: - name: Get Composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} restore-keys: | ${{ runner.os }}-php-${{ matrix.php }}-composer- - - - name: Restrict Symfony version - if: matrix.symfony != '' - run: | - composer global config --no-plugins allow-plugins.symfony/flex true - composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" - composer config extra.symfony.require "${{ matrix.symfony }}" - - name: Restrict Sylius version if: matrix.sylius != '' @@ -110,43 +94,44 @@ jobs: - name: Install PHP dependencies - run: composer install --no-interaction --no-scripts + run: composer install --no-interaction + env: + SYMFONY_REQUIRE: ${{ matrix.symfony }} + + - + name: Install Behat driver + run: vendor/bin/bdi browser:google-chrome drivers - name: Get Yarn cache directory id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache Yarn - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.yarn-cache.outputs.dir }} key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} restore-keys: | ${{ runner.os }}-node-${{ matrix.node }}-yarn- - - - name: Copy package.json.dist to package.json - if: matrix.sylius != '' - run: (cd tests/Application && cp package.json.\${{ matrix.sylius }}.dist package.json) - - name: Install JS dependencies run: | (cd tests/Application && yarn install) - (cd tests/Application && yarn encore dev) - name: Prepare test application database run: | (cd tests/Application && bin/console doctrine:database:create -vvv) - (cd tests/Application && bin/console doctrine:schema:create -vvv) + (cd tests/Application && bin/console doctrine:migrations:migrate -n -vvv -q) - name: Prepare test application assets run: | (cd tests/Application && bin/console assets:install public -vvv) + (cd tests/Application && yarn build:prod) - name: Prepare test application cache @@ -174,11 +159,11 @@ jobs: - name: Run Behat - run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun + run: vendor/bin/behat --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun - name: Upload Behat logs - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: failure() with: name: Behat logs @@ -196,4 +181,4 @@ jobs: SLACK_MESSAGE: ':x:' SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} - SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} \ No newline at end of file + SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index 7cc89e505..dff8e5644 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -16,56 +16,43 @@ jobs: tests: runs-on: ubuntu-latest - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" strategy: fail-fast: false matrix: - php: ["8.0"] - symfony: ["^5.4", "^6.0"] - sylius: ["~1.11.0", "~1.12.0"] - node: ["^14.17.x"] - mysql: ["8.0"] - - exclude: - - sylius: ~1.11.0 - symfony: "^6.0" + php: ["8.1"] + symfony: ["^5.4", "^6.4"] + sylius: ["~1.13.0"] + node: ["20.x"] env: APP_ENV: test - DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: "${{ matrix.php }}" extensions: intl - tools: symfony + tools: flex, symfony coverage: none - name: Get Composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} restore-keys: | ${{ runner.os }}-php-${{ matrix.php }}-composer- - - - name: Restrict Symfony version - if: matrix.symfony != '' - run: | - composer global config --no-plugins allow-plugins.symfony/flex true - composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" - composer config extra.symfony.require "${{ matrix.symfony }}" - name: Restrict Sylius version if: matrix.sylius != '' @@ -74,10 +61,12 @@ jobs: - name: Install PHP dependencies run: composer install --no-interaction + env: + SYMFONY_REQUIRE: ${{ matrix.symfony }} - name: Run PHPStan - run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ + run: vendor/bin/phpstan analyse - name: Run ECS run: vendor/bin/ecs @@ -92,4 +81,4 @@ jobs: SLACK_MESSAGE: ':x:' SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} - SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} \ No newline at end of file + SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} diff --git a/.gitignore b/.gitignore index 6772c7d26..6168d01ce 100644 --- a/.gitignore +++ b/.gitignore @@ -4,20 +4,21 @@ /etc/build/* !/etc/build/.gitignore -tests/Application/node_modules/ - -tests/Application/var/ -!tests/Application/var/.gitkeep - -tests/Application/web/* -!tests/Application/web/favicon.ico -!tests/Application/web/app.php -!tests/Application/web/app_dev.php -!tests/Application/web/app_test.php - -/tests/Application/yarn.lock - /composer.lock -/etc/build/* -!/etc/build/.gitkeep +/.phpunit.result.cache +/phpunit.xml +/phpstan.neon +/phpspec.yml +/behat.yml +/drivers + +###> symfony/framework-bundle ### +/.env.local +/.env.local.php +/.env.*.local +/config/secrets/prod/prod.decrypt.private.php +/public/bundles/ +/var/ +/vendor/ +###< symfony/framework-bundle ### diff --git a/behat.yml.dist b/behat.yml.dist index 6c02a541e..6a188c551 100755 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -3,8 +3,15 @@ imports: - tests/Behat/Resources/suites.yml default: + formatters: + pretty: + verbose: true + paths: false + snippets: false + extensions: DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~ + Robertfausk\Behat\PantherExtension: ~ FriendsOfBehat\MinkDebugExtension: directory: etc/build @@ -15,33 +22,32 @@ default: files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/" base_url: "https://127.0.0.1:8080/" default_session: symfony - javascript_session: chrome_headless + javascript_session: panther sessions: symfony: symfony: ~ - chrome_headless: + chromedriver: chrome: api_url: http://127.0.0.1:9222 validate_certificate: false - socket_timeout: 60 - chrome: - selenium2: - browser: chrome - capabilities: - browserName: chrome - browser: chrome - version: "" - marionette: null # https://github.com/Behat/MinkExtension/pull/311 - chrome: - switches: - - "start-fullscreen" - - "start-maximized" - - "no-sandbox" - extra_capabilities: + chrome_headless_second_session: + chrome: + api_url: http://127.0.0.1:9222 + validate_certificate: false + panther: + panther: + options: + webServerDir: "%paths.base%/tests/Application/public" + manager_options: + connection_timeout_in_ms: 5000 + request_timeout_in_ms: 120000 + chromedriver_arguments: + - --log-path=etc/build/chromedriver.log + - --verbose + capabilities: + acceptSslCerts: true + acceptInsecureCerts: true unexpectedAlertBehaviour: accept - firefox: - selenium2: - browser: firefox show_auto: false FriendsOfBehat\SymfonyExtension: @@ -54,3 +60,5 @@ default: FriendsOfBehat\SuiteSettingsExtension: paths: - "features" + + SyliusLabs\SuiteTagsExtension: ~ diff --git a/composer.json b/composer.json index fa6f4021c..93ad98869 100755 --- a/composer.json +++ b/composer.json @@ -9,46 +9,46 @@ "description": "CMS plugin for Sylius applications.", "license": "MIT", "require": { - "php": "^8.0", - "sylius/sylius": "~1.11.0 || ~1.12.0", + "sylius/sylius": "~1.12.0 || ~1.13.0", "league/csv": "^9.1", - "friendsofsymfony/ckeditor-bundle": "^1.1 || ^2.0", + "friendsofsymfony/ckeditor-bundle": "^2.0", "instaclick/php-webdriver": "^1.4", "symfony/webpack-encore-bundle": "^1.12" }, "require-dev": { - "behat/behat": "^3.7", - "behat/mink-selenium2-driver": "~1.6.0", - "bitbag/coding-standard": "^2.0", + "behat/behat": "^3.6.1", + "behat/mink-selenium2-driver": "^1.4", + "dbrekelmans/bdi": "^1.1", + "bitbag/coding-standard": "^3.0", "dmore/behat-chrome-extension": "^1.3", "dmore/chrome-mink-driver": "^2.7", "friends-of-behat/mink": "^1.8", "friends-of-behat/mink-browserkit-driver": "^1.4", - "friends-of-behat/mink-debug-extension": "^2.0", + "friends-of-behat/mink-debug-extension": "^2.0.0", "friends-of-behat/mink-extension": "^2.4", "friends-of-behat/page-object-extension": "^0.3", "friends-of-behat/suite-settings-extension": "^1.0", "friends-of-behat/symfony-extension": "^2.1", "friends-of-behat/variadic-extension": "^1.3", "lchrusciel/api-test-case": "^4.1 || ^5.0", - "phpspec/phpspec": "^7.0", + "matthiasnoback/symfony-config-test": "^5.1", + "phpspec/phpspec": "^7.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.0", - "phpstan/phpstan-doctrine": "^1.0", - "phpstan/phpstan-strict-rules": "^1.0", - "phpstan/phpstan-webmozart-assert": "^1.0", - "phpunit/phpunit": "^9.5", - "sylius-labs/coding-standard": "^4.0", - "symfony/browser-kit": "^5.4 || ^6.0", - "symfony/debug-bundle": "^5.4 || ^6.0", - "symfony/dotenv": "^5.4 || ^6.0", - "symfony/intl": "^5.4 || ^6.0", - "symfony/web-profiler-bundle": "^5.4 || ^6.0", - "league/flysystem-bundle": "2.4.0", - "sylius/mailer-bundle": "^1.8 || ^2.0@beta", - "matthiasnoback/symfony-config-test": "^4.3", + "phpstan/phpstan": "^1.8.1", + "phpstan/phpstan-doctrine": "^1.3", + "phpstan/phpstan-strict-rules": "^1.3.0", + "phpstan/phpstan-webmozart-assert": "^1.2.0", + "phpunit/phpunit": "^10.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", - "twig/twig": "^2.10.0" + "robertfausk/behat-panther-extension": "^1.1", + "sylius-labs/coding-standard": "^4.2", + "sylius-labs/suite-tags-extension": "^0.2", + "symfony/browser-kit": "^5.4 || ^6.4", + "symfony/debug-bundle": "^5.4 || ^6.4", + "symfony/dotenv": "^5.4 || ^6.4", + "symfony/intl": "^5.4 || ^6.4", + "symfony/runtime": "^5.4 || ^6.4", + "symfony/web-profiler-bundle": "^5.4 || ^6.4" }, "conflict": { "symfony/symfony": "4.1.8", @@ -57,7 +57,6 @@ "symfony/routing": "4.1.8", "symfony/doctrine-bridge": "4.4.16" }, - "suggest": { "stefandoorn/sitemap-plugin": "^2.0@alpha" }, @@ -77,9 +76,16 @@ "config": { "allow-plugins": { "composer/package-versions-deprecated": true, - "symfony/thanks": true, - "dealerdirect/phpcodesniffer-composer-installer": true, - "phpstan/extension-installer": true + "dealerdirect/phpcodesniffer-composer-installer": false, + "phpstan/extension-installer": false, + "symfony/flex": false, + "symfony/runtime": true + } + }, + "extra": { + "runtime": { + "project_dir": "tests/Application", + "dotenv_path": "tests/Application/.env" } } } diff --git a/ecs.php b/ecs.php index 022736f6b..e0c1045ae 100644 --- a/ecs.php +++ b/ecs.php @@ -3,14 +3,16 @@ declare(strict_types=1); use Symplify\EasyCodingStandard\Config\ECSConfig; -use Symplify\EasyCodingStandard\ValueObject\Option; return static function (ECSConfig $config): void { $config->import('vendor/bitbag/coding-standard/ecs.php'); - $parameters = $config->parameters(); - $parameters->set(Option::PATHS, [ + $config->paths([ __DIR__ . '/src', __DIR__ . '/tests', ]); + $config->skip([ + '**/var/*', + '**/node_modules/*', + ]); }; diff --git a/etc/travis/behat.yml b/etc/travis/behat.yml index 96f86c358..805b04644 100755 --- a/etc/travis/behat.yml +++ b/etc/travis/behat.yml @@ -1,20 +1 @@ imports: ["behat.yml.dist"] - -default: - extensions: - Behat\MinkExtension: - javascript_session: chromium - sessions: - chromium: - selenium2: - browser: chrome - capabilities: - browserName: chrome - browser: chrome - version: "" - chrome: - binary: "/usr/bin/chromium-browser" - switches: - - "start-fullscreen" - - "start-maximized" - - "no-sandbox" diff --git a/phpstan.neon b/phpstan.neon.dist similarity index 54% rename from phpstan.neon rename to phpstan.neon.dist index 0c2a35c3c..109ffc4ad 100644 --- a/phpstan.neon +++ b/phpstan.neon.dist @@ -1,11 +1,10 @@ -includes: - - vendor/bitbag/coding-standard/phpstan.neon parameters: level: 8 reportUnmatchedIgnoredErrors: false - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false - excludes_analyse: + paths: + - src + + excludePaths: # Sitemap dependent providers - 'src/SitemapProvider' - 'src/Importer/AbstractImporter' @@ -13,5 +12,6 @@ parameters: - 'tests/Fixture/PageFixtureTest.php' - 'src/Controller/Helper' ignoreErrors: + - identifier: missingType.iterableValue + - identifier: missingType.generics - '#.*NodeParentInterface.*#' - - '#.*PHPDoc tag @throws with type Exception|Psr\Container\ContainerExceptionInterface is not subtype of Throwable.*#' diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 13b99a583..ed1a450bd 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ @@ -15,7 +15,5 @@ - - diff --git a/spec/Twig/Parser/ContentParserSpec.php b/spec/Twig/Parser/ContentParserSpec.php index 797087c76..96e4fcdd9 100644 --- a/spec/Twig/Parser/ContentParserSpec.php +++ b/spec/Twig/Parser/ContentParserSpec.php @@ -30,13 +30,12 @@ public function it_implements_content_parser_interface(): void public function it_parses_string_function( Environment $twigEnvironment, - TwigFunction $renderBlockFunction, RenderBlockRuntimeInterface $renderBlockRuntime ): void { + $twigFunctionName = 'bitbag_cms_render_block'; $twigEnvironment->getFunctions()->willReturn([ - 'bitbag_cms_render_block' => $renderBlockFunction, + $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']) ]); - $renderBlockFunction->getCallable()->willReturn([$renderBlockRuntime, 'renderBlock']); $input = "Let's render! {{ bitbag_cms_render_block('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }}"; @@ -47,13 +46,13 @@ public function it_parses_string_function( public function it_parses_string_functions( Environment $twigEnvironment, - TwigFunction $renderBlockFunction, RenderBlockRuntimeInterface $renderBlockRuntime ): void { + + $twigFunctionName = 'bitbag_cms_render_block'; $twigEnvironment->getFunctions()->willReturn([ - 'bitbag_cms_render_block' => $renderBlockFunction, + $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']) ]); - $renderBlockFunction->getCallable()->willReturn([$renderBlockRuntime, 'renderBlock']); $input = "Let's render! {{ bitbag_cms_render_block('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }} Let's render twice! {{ bitbag_cms_render_block('intro1', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }}"; diff --git a/src/Controller/Action/Admin/ImportDataAction.php b/src/Controller/Action/Admin/ImportDataAction.php index d07601f03..704d32eac 100644 --- a/src/Controller/Action/Admin/ImportDataAction.php +++ b/src/Controller/Action/Admin/ImportDataAction.php @@ -51,7 +51,7 @@ public function __construct( FormErrorsFlashHelperInterface $formErrorsFlashHelper, TranslatorInterface $translator, Environment $twig, - ) { + ) { $this->importProcessor = $importProcessor; $this->formFactory = $formFactory; $this->requestStack = $requestStack; diff --git a/src/Controller/Action/Admin/ProductSearchAction.php b/src/Controller/Action/Admin/ProductSearchAction.php index 2181040c9..0711eb890 100644 --- a/src/Controller/Action/Admin/ProductSearchAction.php +++ b/src/Controller/Action/Admin/ProductSearchAction.php @@ -32,7 +32,7 @@ public function __construct( ProductRepositoryInterface $productRepository, LocaleContextInterface $localeContext, ViewHandler $viewHandler, - ) { + ) { $this->productRepository = $productRepository; $this->localeContext = $localeContext; $this->viewHandler = $viewHandler; diff --git a/src/Controller/Action/Admin/TaxonSearchAction.php b/src/Controller/Action/Admin/TaxonSearchAction.php index a6a2fd36e..eeefdd9c8 100644 --- a/src/Controller/Action/Admin/TaxonSearchAction.php +++ b/src/Controller/Action/Admin/TaxonSearchAction.php @@ -32,7 +32,7 @@ public function __construct( TaxonRepositoryInterface $taxonRepository, LocaleContextInterface $localeContext, ViewHandler $viewHandler, - ) { + ) { $this->taxonRepository = $taxonRepository; $this->localeContext = $localeContext; $this->viewHandler = $viewHandler; diff --git a/src/Controller/Action/Admin/UploadEditorImageAction.php b/src/Controller/Action/Admin/UploadEditorImageAction.php index 610398341..198a81490 100644 --- a/src/Controller/Action/Admin/UploadEditorImageAction.php +++ b/src/Controller/Action/Admin/UploadEditorImageAction.php @@ -36,7 +36,7 @@ public function __construct( MediaProviderResolverInterface $mediaProviderResolver, MediaRepositoryInterface $mediaRepository, FactoryInterface $mediaFactory, - ) { + ) { $this->mediaProviderResolver = $mediaProviderResolver; $this->mediaRepository = $mediaRepository; $this->mediaFactory = $mediaFactory; diff --git a/src/Entity/FrequentlyAskedQuestion.php b/src/Entity/FrequentlyAskedQuestion.php index ac5fcadbf..517ccc62c 100755 --- a/src/Entity/FrequentlyAskedQuestion.php +++ b/src/Entity/FrequentlyAskedQuestion.php @@ -19,8 +19,8 @@ class FrequentlyAskedQuestion implements FrequentlyAskedQuestionInterface use ChannelsAwareTrait; use ToggleableTrait, TranslatableTrait { - __construct as private initializeTranslationsCollection; - } + __construct as private initializeTranslationsCollection; + } /** @var int */ protected $id; diff --git a/src/Fixture/Factory/BlockFixtureFactory.php b/src/Fixture/Factory/BlockFixtureFactory.php index 5b71860c5..7c8115877 100755 --- a/src/Fixture/Factory/BlockFixtureFactory.php +++ b/src/Fixture/Factory/BlockFixtureFactory.php @@ -36,7 +36,7 @@ public function __construct( private TaxonsAssignerInterface $taxonsAssigner, private SectionsAssignerInterface $sectionsAssigner, private ChannelsAssignerInterface $channelAssigner, - ) { + ) { } public function load(array $data): void diff --git a/src/Fixture/Factory/FrequentlyAskedQuestionFixtureFactory.php b/src/Fixture/Factory/FrequentlyAskedQuestionFixtureFactory.php index 082fe5170..1dd5edfa3 100755 --- a/src/Fixture/Factory/FrequentlyAskedQuestionFixtureFactory.php +++ b/src/Fixture/Factory/FrequentlyAskedQuestionFixtureFactory.php @@ -23,7 +23,7 @@ public function __construct( private FactoryInterface $frequentlyAskedQuestionTranslationFactory, private FrequentlyAskedQuestionRepositoryInterface $frequentlyAskedQuestionRepository, private ChannelsAssignerInterface $channelAssigner, - ) { + ) { } public function load(array $data): void @@ -52,7 +52,7 @@ private function createFrequentlyAskedQuestion( string $code, array $frequentlyAskedQuestionData, int $position, - ): void { + ): void { /** @var FrequentlyAskedQuestionInterface $frequentlyAskedQuestion */ $frequentlyAskedQuestion = $this->frequentlyAskedQuestionFactory->createNew(); diff --git a/src/Fixture/Factory/MediaFixtureFactory.php b/src/Fixture/Factory/MediaFixtureFactory.php index 81e1214c0..153c44c0f 100644 --- a/src/Fixture/Factory/MediaFixtureFactory.php +++ b/src/Fixture/Factory/MediaFixtureFactory.php @@ -30,7 +30,7 @@ public function __construct( private ProductsAssignerInterface $productsAssigner, private SectionsAssignerInterface $sectionsAssigner, private ChannelsAssignerInterface $channelAssigner, - ) { + ) { } public function load(array $data): void diff --git a/src/Fixture/Factory/PageFixtureFactory.php b/src/Fixture/Factory/PageFixtureFactory.php index c7c125cd0..3a6827fd3 100755 --- a/src/Fixture/Factory/PageFixtureFactory.php +++ b/src/Fixture/Factory/PageFixtureFactory.php @@ -42,7 +42,7 @@ public function __construct( private ProductRepositoryInterface $productRepository, private LocaleContextInterface $localeContext, private ChannelRepositoryInterface $channelRepository, - ) { + ) { } public function load(array $data): void @@ -71,7 +71,7 @@ private function createPage( string $code, array $pageData, bool $generateSlug = false, - ): void { + ): void { /** @var PageInterface $page */ $page = $this->pageFactory->createNew(); $products = $pageData['products']; @@ -124,7 +124,7 @@ private function resolveProductsForChannels( PageInterface $page, int $limit, array $channelCodes, - ): void { + ): void { foreach ($channelCodes as $channelCode) { /** @var ChannelInterface|null $channel */ $channel = $this->channelRepository->findOneByCode($channelCode); @@ -138,7 +138,7 @@ private function resolveProductsForChannel( PageInterface $page, int $limit, ChannelInterface $channel, - ): void { + ): void { $products = $this->productRepository->findLatestByChannel( $channel, $this->localeContext->getLocaleCode(), diff --git a/src/Fixture/Factory/SectionFixtureFactory.php b/src/Fixture/Factory/SectionFixtureFactory.php index 4465b4631..32ccd2d06 100755 --- a/src/Fixture/Factory/SectionFixtureFactory.php +++ b/src/Fixture/Factory/SectionFixtureFactory.php @@ -21,7 +21,7 @@ public function __construct( private FactoryInterface $sectionFactory, private FactoryInterface $sectionTranslationFactory, private SectionRepositoryInterface $sectionRepository, - ) { + ) { } public function load(array $data): void diff --git a/src/Form/Type/MediaAutocompleteChoiceType.php b/src/Form/Type/MediaAutocompleteChoiceType.php index 49c28e018..951688e39 100644 --- a/src/Form/Type/MediaAutocompleteChoiceType.php +++ b/src/Form/Type/MediaAutocompleteChoiceType.php @@ -40,7 +40,7 @@ public function buildView( FormView $view, FormInterface $form, array $options, - ): void { + ): void { $view->vars['remote_criteria_type'] = 'contains'; $view->vars['remote_criteria_name'] = 'phrase'; $view->vars['media_type'] = $options['media_type']; diff --git a/src/Form/Type/MediaType.php b/src/Form/Type/MediaType.php index 83524b12d..7671a17d9 100644 --- a/src/Form/Type/MediaType.php +++ b/src/Form/Type/MediaType.php @@ -30,7 +30,7 @@ public function __construct( string $dataClass, array $validationGroups = [], array $providers = [], - ) { + ) { parent::__construct($dataClass, $validationGroups); $this->providers = $providers; diff --git a/src/Form/Type/SectionAutocompleteChoiceType.php b/src/Form/Type/SectionAutocompleteChoiceType.php index 9b4928619..ec57d6918 100755 --- a/src/Form/Type/SectionAutocompleteChoiceType.php +++ b/src/Form/Type/SectionAutocompleteChoiceType.php @@ -31,7 +31,7 @@ public function buildView( FormView $view, FormInterface $form, array $options, - ): void { + ): void { $view->vars['remote_criteria_type'] = 'contains'; $view->vars['remote_criteria_name'] = 'phrase'; } diff --git a/src/Importer/AbstractImporter.php b/src/Importer/AbstractImporter.php index 042767f2d..52147a013 100755 --- a/src/Importer/AbstractImporter.php +++ b/src/Importer/AbstractImporter.php @@ -36,7 +36,7 @@ protected function getTranslatableColumnValue( string $column, $locale, array $row, - ) { + ) { $column = str_replace('__locale__', '_' . $locale, $column); if (array_key_exists($column, $row)) { diff --git a/src/Importer/BlockImporter.php b/src/Importer/BlockImporter.php index c4cc09613..d0e941366 100644 --- a/src/Importer/BlockImporter.php +++ b/src/Importer/BlockImporter.php @@ -30,7 +30,7 @@ public function __construct( private ImporterProductsResolverInterface $importerProductsResolver, ValidatorInterface $validator, private BlockRepositoryInterface $blockRepository, - ) { + ) { parent::__construct($validator); } diff --git a/src/Importer/MediaImporter.php b/src/Importer/MediaImporter.php index d70848c8b..e5e602d65 100644 --- a/src/Importer/MediaImporter.php +++ b/src/Importer/MediaImporter.php @@ -28,7 +28,7 @@ public function __construct( private ImporterProductsResolverInterface $importerProductsResolver, ValidatorInterface $validator, private MediaRepositoryInterface $mediaRepository, - ) { + ) { parent::__construct($validator); } diff --git a/src/Importer/PageImporter.php b/src/Importer/PageImporter.php index 531b03e39..bcb24b48c 100644 --- a/src/Importer/PageImporter.php +++ b/src/Importer/PageImporter.php @@ -39,7 +39,7 @@ public function __construct( private ImporterProductsResolverInterface $importerProductsResolver, ValidatorInterface $validator, private EntityManagerInterface $entityManager, - ) { + ) { parent::__construct($validator); } @@ -94,7 +94,7 @@ private function resolveImage( string $url, string $locale, string $imageCode, - ): void { + ): void { $downloadedImage = $this->imageDownloader->download($url); /** @var MediaInterface $image */ diff --git a/src/MediaProvider/GenericProvider.php b/src/MediaProvider/GenericProvider.php index 1b111cdcd..465b0368e 100755 --- a/src/MediaProvider/GenericProvider.php +++ b/src/MediaProvider/GenericProvider.php @@ -21,7 +21,7 @@ public function __construct( private Environment $twigEngine, private string $template, private string $pathPrefix, - ) { + ) { } public function getTemplate(): string @@ -33,7 +33,7 @@ public function render( MediaInterface $media, ?string $template = null, array $options = [], - ): string { + ): string { return $this->twigEngine->render($template ?? $this->template, array_merge(['media' => $media], $options)); } diff --git a/src/MediaProvider/ProviderInterface.php b/src/MediaProvider/ProviderInterface.php index 7c46af390..a793fbf09 100644 --- a/src/MediaProvider/ProviderInterface.php +++ b/src/MediaProvider/ProviderInterface.php @@ -20,7 +20,7 @@ public function render( MediaInterface $media, ?string $template = null, array $options = [], - ): string; + ): string; public function upload(MediaInterface $media): void; } diff --git a/src/Processor/ImportProcessor.php b/src/Processor/ImportProcessor.php index 1f660b78b..2b32379a9 100644 --- a/src/Processor/ImportProcessor.php +++ b/src/Processor/ImportProcessor.php @@ -21,7 +21,7 @@ public function __construct( private ImporterChainInterface $importerChain, private ReaderInterface $reader, private EntityManagerInterface $entityManager, - ) { + ) { } public function process(string $resourceCode, string $filePath): void diff --git a/src/Repository/BlockRepository.php b/src/Repository/BlockRepository.php index 5a36615eb..143e8066f 100755 --- a/src/Repository/BlockRepository.php +++ b/src/Repository/BlockRepository.php @@ -43,7 +43,7 @@ public function findBySectionCode( string $sectionCode, string $localeCode, string $channelCode, - ): array { + ): array { return $this->createQueryBuilder('o') ->leftJoin('o.translations', 'translation') ->innerJoin('o.sections', 'section') @@ -64,7 +64,7 @@ public function findByProductCode( string $productCode, string $localeCode, string $channelCode, - ): array { + ): array { return $this->createQueryBuilder('o') ->leftJoin('o.translations', 'translation') ->innerJoin('o.products', 'product') diff --git a/src/Repository/BlockRepositoryInterface.php b/src/Repository/BlockRepositoryInterface.php index 0488b33ef..53bb70c68 100755 --- a/src/Repository/BlockRepositoryInterface.php +++ b/src/Repository/BlockRepositoryInterface.php @@ -24,11 +24,11 @@ public function findBySectionCode( string $sectionCode, string $localeCode, string $channelCode, - ): array; + ): array; public function findByProductCode( string $productCode, string $localeCode, string $channelCode, - ): array; + ): array; } diff --git a/src/Repository/MediaRepository.php b/src/Repository/MediaRepository.php index 5b1391da6..e469d8844 100755 --- a/src/Repository/MediaRepository.php +++ b/src/Repository/MediaRepository.php @@ -28,7 +28,7 @@ public function findOneEnabledByCode( string $code, string $localeCode, string $channelCode, - ): ?MediaInterface { + ): ?MediaInterface { return $this->createQueryBuilder('o') ->leftJoin('o.translations', 'translation') ->innerJoin('o.channels', 'channels') @@ -48,7 +48,7 @@ public function findBySectionCode( string $sectionCode, string $localeCode, string $channelCode, - ): array { + ): array { return $this->createQueryBuilder('o') ->leftJoin('o.translations', 'translation') ->innerJoin('o.sections', 'section') @@ -62,14 +62,14 @@ public function findBySectionCode( ->setParameter('channelCode', $channelCode) ->getQuery() ->getResult() - ; + ; } public function findByProductCode( string $productCode, string $localeCode, string $channelCode, - ): array { + ): array { return $this->createQueryBuilder('o') ->leftJoin('o.translations', 'translation') ->innerJoin('o.products', 'product') diff --git a/src/Repository/MediaRepositoryInterface.php b/src/Repository/MediaRepositoryInterface.php index 27b6ae943..17505e3cf 100755 --- a/src/Repository/MediaRepositoryInterface.php +++ b/src/Repository/MediaRepositoryInterface.php @@ -22,17 +22,17 @@ public function findOneEnabledByCode( string $code, string $localeCode, string $channelCode, - ): ?MediaInterface; + ): ?MediaInterface; public function findBySectionCode( string $sectionCode, string $localeCode, string $channelCode, - ): array; + ): array; public function findByProductCode( string $productCode, string $localeCode, string $channelCode, - ): array; + ): array; } diff --git a/src/Repository/PageRepository.php b/src/Repository/PageRepository.php index 94fd2d201..ebfa26e1a 100755 --- a/src/Repository/PageRepository.php +++ b/src/Repository/PageRepository.php @@ -57,7 +57,7 @@ public function findOneEnabledBySlugAndChannelCode( string $slug, ?string $localeCode, string $channelCode, - ): ?PageInterface { + ): ?PageInterface { return $this->createQueryBuilder('o') ->leftJoin('o.translations', 'translation') ->innerJoin('o.channels', 'channels') @@ -105,7 +105,7 @@ public function findByProduct( ProductInterface $product, string $channelCode, ?\DateTimeInterface $date = null, - ): array { + ): array { $qb = $this->createQueryBuilder('o') ->innerJoin('o.products', 'product') ->innerJoin('o.channels', 'channel') @@ -131,7 +131,7 @@ public function findByProductAndSectionCode( string $sectionCode, string $channelCode, ?\DateTimeInterface $date = null, - ): array { + ): array { $qb = $this->createQueryBuilder('o') ->innerJoin('o.products', 'product') ->innerJoin('o.sections', 'section') diff --git a/src/Repository/PageRepositoryInterface.php b/src/Repository/PageRepositoryInterface.php index 36f81bb65..afa541021 100755 --- a/src/Repository/PageRepositoryInterface.php +++ b/src/Repository/PageRepositoryInterface.php @@ -27,7 +27,7 @@ public function findOneEnabledBySlugAndChannelCode( string $slug, ?string $localeCode, string $channelCode, - ): ?PageInterface; + ): ?PageInterface; public function createShopListQueryBuilder(string $sectionCode, string $channelCode): QueryBuilder; @@ -37,12 +37,12 @@ public function findByProduct( ProductInterface $product, string $channelCode, ?\DateTimeInterface $date, - ): array; + ): array; public function findByProductAndSectionCode( ProductInterface $product, string $sectionCode, string $channelCode, ?\DateTimeInterface $date, - ): array; + ): array; } diff --git a/src/Repository/SectionRepository.php b/src/Repository/SectionRepository.php index 6d4d89e79..2c1791279 100755 --- a/src/Repository/SectionRepository.php +++ b/src/Repository/SectionRepository.php @@ -75,6 +75,6 @@ public function findByCodesAndLocale(string $codes, string $localeCode): array ->setParameter('localeCode', $localeCode) ->getQuery() ->getResult() - ; + ; } } diff --git a/src/Resolver/BlockResourceResolver.php b/src/Resolver/BlockResourceResolver.php index 41ffc67eb..baf6ab6a8 100755 --- a/src/Resolver/BlockResourceResolver.php +++ b/src/Resolver/BlockResourceResolver.php @@ -22,7 +22,7 @@ public function __construct( private BlockRepositoryInterface $blockRepository, private LoggerInterface $logger, private ChannelContextInterface $channelContext, - ) { + ) { } public function findOrLog(string $code): ?BlockInterface diff --git a/src/Resolver/MediaResourceResolver.php b/src/Resolver/MediaResourceResolver.php index 2c58f0ebe..c396aa6d4 100755 --- a/src/Resolver/MediaResourceResolver.php +++ b/src/Resolver/MediaResourceResolver.php @@ -24,7 +24,7 @@ public function __construct( private LocaleContextInterface $localeContext, private ChannelContextInterface $channelContext, private LoggerInterface $logger, - ) { + ) { } public function findOrLog(string $code): ?MediaInterface diff --git a/src/Resolver/PageResourceResolver.php b/src/Resolver/PageResourceResolver.php index c7152a7a3..a8ae222cc 100755 --- a/src/Resolver/PageResourceResolver.php +++ b/src/Resolver/PageResourceResolver.php @@ -21,7 +21,7 @@ public function __construct( private PageRepositoryInterface $pageRepository, private LocaleContextInterface $localeContext, private LoggerInterface $logger, - ) { + ) { } public function findOrLog(string $code): ?PageInterface diff --git a/src/Resolver/ResourceResolver.php b/src/Resolver/ResourceResolver.php index ebe9e5c31..2076d55ad 100644 --- a/src/Resolver/ResourceResolver.php +++ b/src/Resolver/ResourceResolver.php @@ -21,7 +21,7 @@ public function __construct( private RepositoryInterface $repository, private FactoryInterface $factory, private string $uniqueColumn, - ) { + ) { } /** diff --git a/src/Twig/Parser/ContentParser.php b/src/Twig/Parser/ContentParser.php index ea4d8c375..0104a4171 100644 --- a/src/Twig/Parser/ContentParser.php +++ b/src/Twig/Parser/ContentParser.php @@ -11,6 +11,7 @@ namespace BitBag\SyliusCmsPlugin\Twig\Parser; use Twig\Environment; +use Twig\TwigFunction; use Webmozart\Assert\Assert; final class ContentParser implements ContentParserInterface @@ -68,9 +69,9 @@ private function callFunction( array $functions, string $functionName, array $arguments, - ): string { + ): string { Assert::keyExists($functions, $functionName, sprintf('Function %s does not exist!', $functionName)); - /** @var \Twig_Function $function */ + /** @var TwigFunction $function */ $function = $functions[$functionName]; $callable = $function->getCallable(); Assert::isArray($callable, sprintf('Function with name "%s" is not callable', $functionName)); diff --git a/src/Twig/Runtime/RenderLinkRuntime.php b/src/Twig/Runtime/RenderLinkRuntime.php index 003512a80..0d051aa8c 100644 --- a/src/Twig/Runtime/RenderLinkRuntime.php +++ b/src/Twig/Runtime/RenderLinkRuntime.php @@ -24,7 +24,7 @@ public function __construct( private PageRepositoryInterface $pageRepository, private RouterInterface $router, private string $defaultTemplate, - ) { + ) { } public function renderLinkForCode( @@ -32,7 +32,7 @@ public function renderLinkForCode( string $code, array $options = [], ?string $template = null, - ): string { + ): string { $page = $this->pageRepository->findOneEnabledByCode($code, $this->localeContext->getLocaleCode()); return $environment->render($template ?? $this->defaultTemplate, [ diff --git a/src/Twig/Runtime/RenderLinkRuntimeInterface.php b/src/Twig/Runtime/RenderLinkRuntimeInterface.php index 616791859..c10624dd3 100644 --- a/src/Twig/Runtime/RenderLinkRuntimeInterface.php +++ b/src/Twig/Runtime/RenderLinkRuntimeInterface.php @@ -20,7 +20,7 @@ public function renderLinkForCode( string $code, array $options = [], ?string $template = null, - ): string; + ): string; public function getLinkForCode(string $code, array $options = []): string; } diff --git a/src/Twig/Runtime/RenderProductPagesRuntime.php b/src/Twig/Runtime/RenderProductPagesRuntime.php index 62a555212..ad8f0cdf7 100644 --- a/src/Twig/Runtime/RenderProductPagesRuntime.php +++ b/src/Twig/Runtime/RenderProductPagesRuntime.php @@ -24,7 +24,7 @@ public function __construct( private ChannelContextInterface $channelContext, private Environment $templatingEngine, private SectionsSorterInterface $sectionsSorter, - ) { + ) { } public function renderProductPages(ProductInterface $product, string $sectionCode = null): string diff --git a/src/Uploader/MediaUploader.php b/src/Uploader/MediaUploader.php index bb2e0abe9..a238dd028 100644 --- a/src/Uploader/MediaUploader.php +++ b/src/Uploader/MediaUploader.php @@ -79,7 +79,7 @@ private function expandPath( string $path, string $pathPrefix, ?string $originalName = null, - ): string { + ): string { return sprintf( '%s/%s/%s/%s', $pathPrefix, diff --git a/tests/Application/.babelrc b/tests/Application/.babelrc index e563a62ea..14eaf4cc4 100644 --- a/tests/Application/.babelrc +++ b/tests/Application/.babelrc @@ -1,14 +1,13 @@ { "presets": [ - ["env", { + ["@babel/preset-env", { "targets": { "node": "6" - }, - "useBuiltIns": true + } }] ], "plugins": [ - ["transform-object-rest-spread", { + ["@babel/plugin-proposal-object-rest-spread", { "useBuiltIns": true }] ] diff --git a/tests/Application/.env b/tests/Application/.env index 3f3595b34..9aa4fccd3 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -33,5 +33,8 @@ JWT_PASSPHRASE=YOUR_SECRET_PASSPHRASE # MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages # MESSENGER_TRANSPORT_DSN=doctrine://default # MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages -MESSENGER_TRANSPORT_DSN=sync:// +SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=sync:// +SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=sync:// +SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=sync:// +SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=sync:// ###< symfony/messenger ### diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore index 871a97acd..0de8f0401 100644 --- a/tests/Application/.gitignore +++ b/tests/Application/.gitignore @@ -3,22 +3,16 @@ /public/css /public/js /public/media/* -!/public/media/image/ -/public/media/image/* -!/public/media/image/.gitignore /node_modules /yarn-error.log +/yarn.lock ###> symfony/framework-bundle ### -/.env.*.local /.env.local /.env.local.php +/.env.*.local /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 index 52230c23e..769ca698b 100755 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -5,26 +5,13 @@ namespace Tests\BitBag\SyliusCmsPlugin\Application; use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer; -use Sylius\Bundle\CoreBundle\Application\Kernel as SyliusKernel; +use Sylius\Bundle\CoreBundle\SyliusCoreBundle; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; -use Symfony\Component\Config\Loader\DelegatingLoader; use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Loader\LoaderResolver; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Loader\ClosureLoader; -use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; -use Symfony\Component\DependencyInjection\Loader\GlobFileLoader; -use Symfony\Component\DependencyInjection\Loader\IniFileLoader; -use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\HttpKernel\Config\FileLocator; use Symfony\Component\HttpKernel\Kernel as BaseKernel; -use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; -use Webmozart\Assert\Assert; final class Kernel extends BaseKernel { @@ -53,67 +40,30 @@ public function registerBundles(): iterable } } - protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void + private function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void { $container->addResource(new FileResource($this->getProjectDir() . '/config/bundles.php')); $container->setParameter('container.dumper.inline_class_loader', true); $confDir = $this->getProjectDir() . '/config'; - $syliusDir = $this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION; $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob'); $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob'); $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob'); $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); - if (is_dir($syliusDir)) { - $loader->load($syliusDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); - } - $loader->load($confDir . '/{api_resources}/*' . self::CONFIG_EXTS, 'glob'); - } - - 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); } protected function getContainerBaseClass(): string { - if ($this->isTestEnvironment() && class_exists(MockerContainer::class)) { + if ($this->isTestEnvironment()) { return MockerContainer::class; } return parent::getContainerBaseClass(); } - protected function getContainerLoader(ContainerInterface $container): DelegatingLoader - { - Assert::isInstanceOf($container, ContainerBuilder::class); - - $locator = new FileLocator($this); - $resolver = new LoaderResolver([ - new XmlFileLoader($container, $locator), - new YamlFileLoader($container, $locator), - new IniFileLoader($container, $locator), - new PhpFileLoader($container, $locator), - new GlobFileLoader($container, $locator), - new DirectoryLoader($container, $locator), - new ClosureLoader($container), - ]); - - return new DelegatingLoader($resolver); - } - private function isTestEnvironment(): bool { - return 0 === strpos($this->getEnvironment(), 'test'); + return str_starts_with($this->getEnvironment(), 'test'); } /** @@ -121,6 +71,7 @@ private function isTestEnvironment(): bool */ private function registerBundlesFromFile(string $bundlesFile): iterable { + /** @var array $contents */ $contents = require $bundlesFile; foreach ($contents as $class => $envs) { if (isset($envs['all']) || isset($envs[$this->environment])) { @@ -135,7 +86,7 @@ private function registerBundlesFromFile(string $bundlesFile): iterable private function getConfigurationDirectories(): iterable { yield $this->getProjectDir() . '/config'; - $syliusConfigDir = $this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION; + $syliusConfigDir = $this->getProjectDir() . '/config/sylius/' . SyliusCoreBundle::MAJOR_VERSION . '.' . SyliusCoreBundle::MINOR_VERSION; if (is_dir($syliusConfigDir)) { yield $syliusConfigDir; } diff --git a/tests/Application/bin/console b/tests/Application/bin/console index cee26f0b7..8ff019cdd 100755 --- a/tests/Application/bin/console +++ b/tests/Application/bin/console @@ -3,36 +3,13 @@ use Tests\BitBag\SyliusCmsPlugin\Application\Kernel; use Symfony\Bundle\FrameworkBundle\Console\Application; -use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Debug\Debug; -set_time_limit(0); - -require __DIR__.'/../../../vendor/autoload.php'; - -if (!class_exists(Application::class)) { - throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.'); +if (!is_file(dirname(__DIR__).'/../../vendor/autoload_runtime.php')) { + throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".'); } -$input = new ArgvInput(); -if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); -} - -if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); -} - -require dirname(__DIR__).'/config/bootstrap.php'; - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists(Debug::class)) { - Debug::enable(); - } -} +require_once dirname(__DIR__).'/../../vendor/autoload_runtime.php'; -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$application = new Application($kernel); -$application->run($input); +return function (array $context) { + return new Application(new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG'])); +}; diff --git a/tests/Application/composer.lock b/tests/Application/composer.lock deleted file mode 100644 index da8dbee31..000000000 --- a/tests/Application/composer.lock +++ /dev/null @@ -1,18 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "75c622fd23b726cd12ac83a6454fec39", - "packages": [], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.0.0" -} diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php index 2291ab428..d2199243a 100644 --- a/tests/Application/config/bootstrap.php +++ b/tests/Application/config/bootstrap.php @@ -13,11 +13,15 @@ $_ENV += $env; } elseif (!class_exists(Dotenv::class)) { throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); +} elseif (method_exists(Dotenv::class, 'bootEnv')) { + (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); + + return; } else { // load all the .env files (new Dotenv())->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'] ?? '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 index 562409827..48ddcbe01 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -8,6 +8,7 @@ Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], + Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true], Sylius\Bundle\MoneyBundle\SyliusMoneyBundle::class => ['all' => true], Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle::class => ['all' => true], @@ -40,6 +41,7 @@ Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true], Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true], Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], + BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true], Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true], @@ -48,17 +50,16 @@ 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], - FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], - Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], - FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true], + Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], + FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], - Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], + Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], - BitBag\SyliusCmsPlugin\BitBagSyliusCmsPlugin::class => ['all' => true], - Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], - Sylius\Bundle\MailerBundle\SyliusMailerBundle::class => ['all' => true], + SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], League\FlysystemBundle\FlysystemBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], + Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], + FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true], + BitBag\SyliusCmsPlugin\BitBagSyliusCmsPlugin::class => ['all' => true], ]; diff --git a/tests/Application/config/packages/_sylius.yaml b/tests/Application/config/packages/_sylius.yaml index fa411e618..ab14c62ef 100644 --- a/tests/Application/config/packages/_sylius.yaml +++ b/tests/Application/config/packages/_sylius.yaml @@ -6,6 +6,7 @@ imports: - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" } - { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" } + - { resource: "../parameters.yaml" } parameters: sylius_core.public_dir: '%kernel.project_dir%/public' diff --git a/tests/Application/config/packages/bitbag_sylius_cms_plugin.yml b/tests/Application/config/packages/bitbag_sylius_cms_plugin.yaml similarity index 100% rename from tests/Application/config/packages/bitbag_sylius_cms_plugin.yml rename to tests/Application/config/packages/bitbag_sylius_cms_plugin.yaml diff --git a/tests/Application/config/packages/doctrine_migrations.yaml b/tests/Application/config/packages/doctrine_migrations.yaml index c2456bfdb..cdbc01ae7 100644 --- a/tests/Application/config/packages/doctrine_migrations.yaml +++ b/tests/Application/config/packages/doctrine_migrations.yaml @@ -2,5 +2,3 @@ doctrine_migrations: storage: table_storage: table_name: sylius_migrations - migrations_paths: - 'DoctrineMigrations': '%kernel.project_dir%/src/Migrations' diff --git a/tests/Application/config/packages/liip_imagine.yaml b/tests/Application/config/packages/liip_imagine.yaml index 4381e52dc..bb2e7ceb9 100644 --- a/tests/Application/config/packages/liip_imagine.yaml +++ b/tests/Application/config/packages/liip_imagine.yaml @@ -1,10 +1,4 @@ liip_imagine: - loaders: - default: - filesystem: - data_root: - - "%sylius_core.public_dir%/media/image" - - "%sylius_core.public_dir%" resolvers: default: web_path: diff --git a/tests/Application/config/parameters.yaml b/tests/Application/config/parameters.yaml new file mode 100644 index 000000000..16dc40b75 --- /dev/null +++ b/tests/Application/config/parameters.yaml @@ -0,0 +1,2 @@ +parameters: + locale: en_US diff --git a/tests/Application/config/routes/bitbag_sylius_cms_plugin.yml b/tests/Application/config/routes/bitbag_sylius_cms_plugin.yaml similarity index 100% rename from tests/Application/config/routes/bitbag_sylius_cms_plugin.yml rename to tests/Application/config/routes/bitbag_sylius_cms_plugin.yaml diff --git a/tests/Application/config/services.yaml b/tests/Application/config/services.yaml index 615506eb5..e69de29bb 100644 --- a/tests/Application/config/services.yaml +++ b/tests/Application/config/services.yaml @@ -1,4 +0,0 @@ -# Put parameters here that don't need to change on each machine where the app is deployed -# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration -parameters: - locale: en_US diff --git a/tests/Application/config/services_test.yaml b/tests/Application/config/services_test.yaml new file mode 100644 index 000000000..a925faa16 --- /dev/null +++ b/tests/Application/config/services_test.yaml @@ -0,0 +1,3 @@ +imports: + - { resource: "../../Behat/Resources/services.yml" } + - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } diff --git a/tests/Application/config/services_test_cached.yaml b/tests/Application/config/services_test_cached.yaml new file mode 100644 index 000000000..5d2c7fa48 --- /dev/null +++ b/tests/Application/config/services_test_cached.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: "services_test.yaml" } diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.11/bundles.php deleted file mode 100644 index fc6ec3af0..000000000 --- a/tests/Application/config/sylius/1.11/bundles.php +++ /dev/null @@ -1,9 +0,0 @@ - ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc613f..000000000 --- a/tests/Application/config/sylius/1.11/packages/jms_serializer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -jms_serializer: - visitors: - xml_serialization: - format_output: '%kernel.debug%' diff --git a/tests/Application/config/sylius/1.11/packages/security.yaml b/tests/Application/config/sylius/1.11/packages/security.yaml deleted file mode 100644 index 10628102a..000000000 --- a/tests/Application/config/sylius/1.11/packages/security.yaml +++ /dev/null @@ -1,148 +0,0 @@ -parameters: - sylius.security.admin_regex: "^/%sylius_admin.path_name%" - sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++" - sylius.security.new_api_route: "/new-api" - sylius.security.new_api_regex: "^%sylius.security.new_api_route%" - sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" - sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%" - sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop" - sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%" - -security: - always_authenticate_before_granting: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - anonymous: true - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml deleted file mode 100644 index 73bba2755..000000000 --- a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - url: '%env(MAILER_URL)%' diff --git a/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml deleted file mode 100644 index cf16fdfed..000000000 --- a/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" \ No newline at end of file diff --git a/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml deleted file mode 100644 index cf16fdfed..000000000 --- a/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" \ No newline at end of file diff --git a/tests/Application/config/sylius/1.11/services_test.yaml b/tests/Application/config/sylius/1.11/services_test.yaml deleted file mode 100644 index bf7b55e79..000000000 --- a/tests/Application/config/sylius/1.11/services_test.yaml +++ /dev/null @@ -1,3 +0,0 @@ -imports: - - { resource: "../../../../Behat/Resources/services.sylius.1.11.yml" } - - { resource: "../../../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } diff --git a/tests/Application/config/sylius/1.12/bundles.php b/tests/Application/config/sylius/1.12/bundles.php deleted file mode 100644 index d50639f7b..000000000 --- a/tests/Application/config/sylius/1.12/bundles.php +++ /dev/null @@ -1,8 +0,0 @@ - ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.12/packages/jms_serializer.yaml b/tests/Application/config/sylius/1.12/packages/jms_serializer.yaml deleted file mode 100644 index ed7bc613f..000000000 --- a/tests/Application/config/sylius/1.12/packages/jms_serializer.yaml +++ /dev/null @@ -1,4 +0,0 @@ -jms_serializer: - visitors: - xml_serialization: - format_output: '%kernel.debug%' diff --git a/tests/Application/config/sylius/1.12/packages/security.yaml b/tests/Application/config/sylius/1.12/packages/security.yaml deleted file mode 100644 index 4ed342f82..000000000 --- a/tests/Application/config/sylius/1.12/packages/security.yaml +++ /dev/null @@ -1,124 +0,0 @@ -security: - enable_authenticator_manager: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - - password_hashers: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - - new_api_admin_user: - pattern: "%sylius.security.new_api_admin_regex%/.*" - provider: sylius_api_admin_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_admin_route%/authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - new_api_shop_user: - pattern: "%sylius.security.new_api_shop_regex%/.*" - provider: sylius_api_shop_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_shop_route%/authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_homepage - invalidate_session: false - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - image_resolver: - pattern: ^/media/cache/resolve - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } - - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.12/services_test.yaml b/tests/Application/config/sylius/1.12/services_test.yaml deleted file mode 100644 index 11f60224d..000000000 --- a/tests/Application/config/sylius/1.12/services_test.yaml +++ /dev/null @@ -1,3 +0,0 @@ -imports: - - { resource: "../../../../Behat/Resources/services.yml" } - - { resource: "../../../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } diff --git a/tests/Application/config/sylius/1.13/bundles.php b/tests/Application/config/sylius/1.13/bundles.php new file mode 100644 index 000000000..5d54121b4 --- /dev/null +++ b/tests/Application/config/sylius/1.13/bundles.php @@ -0,0 +1,7 @@ + ['all' => true], +]; diff --git a/tests/Application/package.json b/tests/Application/package.json new file mode 100755 index 000000000..dfe325839 --- /dev/null +++ b/tests/Application/package.json @@ -0,0 +1,13 @@ +{ + "license": "MIT", + "scripts": { + "build": "encore dev", + "build:prod": "encore production", + "postinstall": "semantic-ui-css-patch", + "lint": "yarn lint:js", + "watch": "encore dev --watch" + }, + "devDependencies": { + "@sylius-ui/frontend": "^1.0" + } +} diff --git a/tests/Application/package.json.~1.11.0.dist b/tests/Application/package.json.~1.11.0.dist deleted file mode 100755 index 9ca356278..000000000 --- a/tests/Application/package.json.~1.11.0.dist +++ /dev/null @@ -1,41 +0,0 @@ -{ - "dependencies": { - "@babel/polyfill": "^7.0.0", - "chart.js": "^2.9.3", - "jquery": "^3.5.0", - "jquery.dirtyforms": "^2.0.0", - "lightbox2": "^2.9.0", - "semantic-ui-css": "^2.2.0", - "slick-carousel": "^1.8.1" - }, - "devDependencies": { - "@symfony/webpack-encore": "^1.6.1", - "babel-core": "^6.26.3", - "babel-plugin-external-helpers": "^6.22.0", - "babel-plugin-module-resolver": "^3.1.1", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-preset-env": "^1.7.0", - "babel-register": "^6.26.0", - "dedent": "^0.7.0", - "eslint": "^4.19.1", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-import-resolver-babel-module": "^4.0.0", - "eslint-plugin-import": "^2.11.0", - "merge-stream": "^1.0.0", - "sass": "^1.39.2", - "sass-loader": "^12.1.0" - }, - "scripts": { - "dev": "yarn encore dev", - "watch": "yarn encore dev --watch", - "prod": "yarn encore prod", - "lint": "yarn lint:js", - "lint:js": "eslint gulpfile.babel.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Sylius/Sylius.git" - }, - "author": "Paweł Jędrzejewski", - "license": "MIT" -} diff --git a/tests/Application/package.json.~1.12.0.dist b/tests/Application/package.json.~1.12.0.dist deleted file mode 100755 index 36e6c1f0f..000000000 --- a/tests/Application/package.json.~1.12.0.dist +++ /dev/null @@ -1,41 +0,0 @@ -{ - "dependencies": { - "@babel/polyfill": "^7.0.0", - "chart.js": "^3.7.1", - "jquery": "^3.5.0", - "jquery.dirtyforms": "^2.0.0", - "lightbox2": "^2.9.0", - "semantic-ui-css": "^2.2.0", - "slick-carousel": "^1.8.1" - }, - "devDependencies": { - "@symfony/webpack-encore": "^1.6.1", - "babel-core": "^6.26.3", - "babel-plugin-external-helpers": "^6.22.0", - "babel-plugin-module-resolver": "^3.1.1", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-preset-env": "^1.7.0", - "babel-register": "^6.26.0", - "dedent": "^0.7.0", - "eslint": "^4.19.1", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-import-resolver-babel-module": "^4.0.0", - "eslint-plugin-import": "^2.11.0", - "merge-stream": "^1.0.0", - "sass": "^1.39.2", - "sass-loader": "^12.1.0" - }, - "scripts": { - "dev": "yarn encore dev", - "watch": "yarn encore dev --watch", - "prod": "yarn encore prod", - "lint": "yarn lint:js", - "lint:js": "eslint gulpfile.babel.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Sylius/Sylius.git" - }, - "author": "Paweł Jędrzejewski", - "license": "MIT" -} diff --git a/tests/Application/public/index.php b/tests/Application/public/index.php index 529ed0fa3..09d8731ab 100644 --- a/tests/Application/public/index.php +++ b/tests/Application/public/index.php @@ -2,28 +2,10 @@ declare(strict_types=1); -use Symfony\Component\ErrorHandler\Debug; -use Symfony\Component\HttpFoundation\Request; use Tests\BitBag\SyliusCmsPlugin\Application\Kernel; -require dirname(__DIR__) . '/config/bootstrap.php'; +require_once dirname(__DIR__) . '/../../vendor/autoload_runtime.php'; -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - Debug::enable(); -} - -if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) { - Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); -} - -if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) { - Request::setTrustedHosts([$trustedHosts]); -} - -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$request = Request::createFromGlobals(); -$response = $kernel->handle($request); -$response->send(); -$kernel->terminate($request, $response); +return static function (array $context) { + return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); +}; diff --git a/tests/Behat/Context/Api/BlockContext.php b/tests/Behat/Context/Api/BlockContext.php index 9822835dc..836397c95 100644 --- a/tests/Behat/Context/Api/BlockContext.php +++ b/tests/Behat/Context/Api/BlockContext.php @@ -52,8 +52,8 @@ public function iShouldSeeBlocksInTheList(int $count): void } /** - * @Then I should see block with code :block * @Given I view block with code :block + * @Then I should see block with code :block */ public function iShouldSeeBlockWithCode(string $code): void { diff --git a/tests/Behat/Context/Api/MediaContext.php b/tests/Behat/Context/Api/MediaContext.php index 5b936aa1c..463f7741e 100644 --- a/tests/Behat/Context/Api/MediaContext.php +++ b/tests/Behat/Context/Api/MediaContext.php @@ -53,8 +53,8 @@ public function iShouldSeeMediaInTheList(int $count): void } /** - * @Then I should see media with code :media * @Given I view media with code :media + * @Then I should see media with code :media */ public function iShouldSeeTheMedia(MediaInterface $media): void { diff --git a/tests/Behat/Context/Api/SectionContext.php b/tests/Behat/Context/Api/SectionContext.php index 8e0a993fe..a13e610eb 100644 --- a/tests/Behat/Context/Api/SectionContext.php +++ b/tests/Behat/Context/Api/SectionContext.php @@ -53,8 +53,8 @@ public function iShouldSeeSectionsInTheList(int $count): void } /** - * @Then I should see section with code :section * @Given I view section with code :section + * @Then I should see section with code :section */ public function iShouldSeeSectionWithCode(SectionInterface $section): void { diff --git a/tests/Behat/Context/Setup/BlockContext.php b/tests/Behat/Context/Setup/BlockContext.php index ba142492d..68804109c 100755 --- a/tests/Behat/Context/Setup/BlockContext.php +++ b/tests/Behat/Context/Setup/BlockContext.php @@ -37,7 +37,7 @@ public function __construct( RandomStringGeneratorInterface $randomStringGenerator, FactoryInterface $blockFactory, BlockRepositoryInterface $blockRepository, - ) { + ) { $this->sharedStorage = $sharedStorage; $this->randomStringGenerator = $randomStringGenerator; $this->blockFactory = $blockFactory; @@ -79,7 +79,7 @@ private function createBlock( ?string $code = null, ?string $content = null, ChannelInterface $channel = null, - ): BlockInterface { + ): BlockInterface { /** @var BlockInterface $block */ $block = $this->blockFactory->createNew(); diff --git a/tests/Behat/Context/Setup/FrequentlyAskedQuestionContext.php b/tests/Behat/Context/Setup/FrequentlyAskedQuestionContext.php index b01ebab4b..c7f7ac1b2 100755 --- a/tests/Behat/Context/Setup/FrequentlyAskedQuestionContext.php +++ b/tests/Behat/Context/Setup/FrequentlyAskedQuestionContext.php @@ -34,7 +34,7 @@ public function __construct( RandomStringGeneratorInterface $randomStringGenerator, FactoryInterface $frequentlyAskedQuestionFactory, FrequentlyAskedQuestionRepositoryInterface $frequentlyAskedQuestionRepository, - ) { + ) { $this->sharedStorage = $sharedStorage; $this->randomStringGenerator = $randomStringGenerator; $this->frequentlyAskedQuestionFactory = $frequentlyAskedQuestionFactory; @@ -94,7 +94,7 @@ private function createFrequentlyAskedQuestion( int $position = null, bool $prefixQuestionWithPosition = false, ChannelInterface $channel = null, - ): FrequentlyAskedQuestionInterface { + ): FrequentlyAskedQuestionInterface { /** @var FrequentlyAskedQuestionInterface $frequentlyAskedQuestion */ $frequentlyAskedQuestion = $this->frequentlyAskedQuestionFactory->createNew(); diff --git a/tests/Behat/Context/Setup/MediaContext.php b/tests/Behat/Context/Setup/MediaContext.php index de7e6f6c9..3d856a233 100755 --- a/tests/Behat/Context/Setup/MediaContext.php +++ b/tests/Behat/Context/Setup/MediaContext.php @@ -58,7 +58,7 @@ public function __construct( ProductRepositoryInterface $productRepository, SectionRepositoryInterface $sectionRepository, MediaProviderResolverInterface $mediaProviderResolver, - ) { + ) { $this->sharedStorage = $sharedStorage; $this->randomStringGenerator = $randomStringGenerator; $this->mediaFactory = $mediaFactory; @@ -99,7 +99,7 @@ private function createMedia( ?string $content = null, ?string $fileType = null, ChannelInterface $channel = null, - ): MediaInterface { + ): MediaInterface { /** @var MediaInterface $media */ $media = $this->mediaFactory->createNew(); diff --git a/tests/Behat/Context/Setup/PageContext.php b/tests/Behat/Context/Setup/PageContext.php index 734350da8..044be81eb 100755 --- a/tests/Behat/Context/Setup/PageContext.php +++ b/tests/Behat/Context/Setup/PageContext.php @@ -14,9 +14,9 @@ use BitBag\SyliusCmsPlugin\Entity\Media; use BitBag\SyliusCmsPlugin\Entity\MediaInterface; use BitBag\SyliusCmsPlugin\Entity\PageInterface; +use BitBag\SyliusCmsPlugin\MediaProvider\ProviderInterface; use BitBag\SyliusCmsPlugin\Repository\PageRepositoryInterface; use BitBag\SyliusCmsPlugin\Repository\SectionRepositoryInterface; -use BitBag\SyliusCmsPlugin\Uploader\MediaUploaderInterface; use Doctrine\ORM\EntityManagerInterface; use Sylius\Behat\Service\SharedStorageInterface; use Sylius\Component\Core\Formatter\StringInflector; @@ -49,8 +49,8 @@ final class PageContext implements Context /** @var SectionRepositoryInterface */ private $sectionRepository; - /** @var MediaUploaderInterface */ - private $mediaUploader; + /** @var ProviderInterface */ + private $imageProvider; public function __construct( SharedStorageInterface $sharedStorage, @@ -60,8 +60,8 @@ public function __construct( EntityManagerInterface $entityManager, ProductRepositoryInterface $productRepository, SectionRepositoryInterface $sectionRepository, - MediaUploaderInterface $mediaUploader, - ) { + ProviderInterface $imageProvider, + ) { $this->sharedStorage = $sharedStorage; $this->randomStringGenerator = $randomStringGenerator; $this->pageFactory = $pageFactory; @@ -69,7 +69,7 @@ public function __construct( $this->entityManager = $entityManager; $this->productRepository = $productRepository; $this->sectionRepository = $sectionRepository; - $this->mediaUploader = $mediaUploader; + $this->imageProvider = $imageProvider; } /** @@ -225,7 +225,7 @@ private function createPage( ?string $name = null, ?string $content = null, ChannelInterface $channel = null, - ): PageInterface { + ): PageInterface { /** @var PageInterface $page */ $page = $this->pageFactory->createNew(); @@ -265,7 +265,7 @@ private function uploadImage(string $name): MediaInterface $image->setFile($uploadedImage); - $this->mediaUploader->upload($image, '/tests/Application/Resources/images/'); + $this->imageProvider->upload($image); return $image; } diff --git a/tests/Behat/Context/Setup/SectionContext.php b/tests/Behat/Context/Setup/SectionContext.php index 048938f59..6b824993a 100755 --- a/tests/Behat/Context/Setup/SectionContext.php +++ b/tests/Behat/Context/Setup/SectionContext.php @@ -34,7 +34,7 @@ public function __construct( RandomStringGeneratorInterface $randomStringGenerator, FactoryInterface $sectionFactory, SectionRepositoryInterface $sectionRepository, - ) { + ) { $this->sharedStorage = $sharedStorage; $this->randomStringGenerator = $randomStringGenerator; $this->sectionFactory = $sectionFactory; diff --git a/tests/Behat/Context/Ui/Admin/BlockContext.php b/tests/Behat/Context/Ui/Admin/BlockContext.php index cd7da0926..6e723a55f 100755 --- a/tests/Behat/Context/Ui/Admin/BlockContext.php +++ b/tests/Behat/Context/Ui/Admin/BlockContext.php @@ -58,7 +58,7 @@ public function __construct( UpdatePageInterface $updatePage, RandomStringGeneratorInterface $randomStringGenerator, BlockRepositoryInterface $blockRepository, - ) { + ) { $this->sharedStorage = $sharedStorage; $this->currentPageResolver = $currentPageResolver; $this->notificationChecker = $notificationChecker; diff --git a/tests/Behat/Context/Ui/Admin/FrequentlyAskedQuestionContext.php b/tests/Behat/Context/Ui/Admin/FrequentlyAskedQuestionContext.php index cdd4a13e5..b12e17efc 100755 --- a/tests/Behat/Context/Ui/Admin/FrequentlyAskedQuestionContext.php +++ b/tests/Behat/Context/Ui/Admin/FrequentlyAskedQuestionContext.php @@ -53,7 +53,7 @@ public function __construct( CreatePageInterface $createPage, UpdatePageInterface $updatePage, RandomStringGeneratorInterface $randomStringGenerator, - ) { + ) { $this->sharedStorage = $sharedStorage; $this->currentPageResolver = $currentPageResolver; $this->notificationChecker = $notificationChecker; diff --git a/tests/Behat/Context/Ui/Admin/MediaContext.php b/tests/Behat/Context/Ui/Admin/MediaContext.php index 77b969dd6..41819fd30 100755 --- a/tests/Behat/Context/Ui/Admin/MediaContext.php +++ b/tests/Behat/Context/Ui/Admin/MediaContext.php @@ -58,7 +58,7 @@ public function __construct( UpdatePageInterface $updatePage, RandomStringGeneratorInterface $randomStringGenerator, MediaRepositoryInterface $mediaRepository, - ) { + ) { $this->sharedStorage = $sharedStorage; $this->currentPageResolver = $currentPageResolver; $this->notificationChecker = $notificationChecker; diff --git a/tests/Behat/Context/Ui/Admin/PageContext.php b/tests/Behat/Context/Ui/Admin/PageContext.php index 24b96d937..11b808a75 100755 --- a/tests/Behat/Context/Ui/Admin/PageContext.php +++ b/tests/Behat/Context/Ui/Admin/PageContext.php @@ -58,7 +58,7 @@ public function __construct( UpdatePageInterface $updatePage, RandomStringGeneratorInterface $randomStringGenerator, PageRepositoryInterface $pageRepository, - ) { + ) { $this->sharedStorage = $sharedStorage; $this->currentPageResolver = $currentPageResolver; $this->notificationChecker = $notificationChecker; diff --git a/tests/Behat/Context/Ui/Admin/SectionContext.php b/tests/Behat/Context/Ui/Admin/SectionContext.php index 05162b91f..43518855a 100755 --- a/tests/Behat/Context/Ui/Admin/SectionContext.php +++ b/tests/Behat/Context/Ui/Admin/SectionContext.php @@ -53,7 +53,7 @@ public function __construct( CreatePageInterface $createPage, UpdatePageInterface $updatePage, RandomStringGeneratorInterface $randomStringGenerator, - ) { + ) { $this->sharedStorage = $sharedStorage; $this->currentPageResolver = $currentPageResolver; $this->notificationChecker = $notificationChecker; diff --git a/tests/Behat/Context/Ui/Shop/PageContext.php b/tests/Behat/Context/Ui/Shop/PageContext.php index 53b5ffc0e..f0b5cc837 100755 --- a/tests/Behat/Context/Ui/Shop/PageContext.php +++ b/tests/Behat/Context/Ui/Shop/PageContext.php @@ -31,7 +31,7 @@ public function __construct( ShowPageInterface $showPage, IndexPageInterface $indexPage, SharedStorageInterface $sharedStorage, - ) { + ) { $this->showPage = $showPage; $this->indexPage = $indexPage; $this->sharedStorage = $sharedStorage; diff --git a/tests/Behat/Page/Admin/Block/CreatePage.php b/tests/Behat/Page/Admin/Block/CreatePage.php index e655c3da9..6fc59e55f 100755 --- a/tests/Behat/Page/Admin/Block/CreatePage.php +++ b/tests/Behat/Page/Admin/Block/CreatePage.php @@ -10,7 +10,7 @@ namespace Tests\BitBag\SyliusCmsPlugin\Behat\Page\Admin\Block; -use DMore\ChromeDriver\ChromeDriver; +use Behat\Mink\Driver\PantherDriver; use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage; use Tests\BitBag\SyliusCmsPlugin\Behat\Behaviour\ContainsErrorTrait; use Webmozart\Assert\Assert; @@ -51,7 +51,7 @@ public function disable(): void public function associateSections(array $sectionsNames): void { - Assert::isInstanceOf($this->getDriver(), ChromeDriver::class); + Assert::isInstanceOf($this->getDriver(), PantherDriver::class); $dropdown = $this->getElement('association_dropdown_section'); $dropdown->click(); diff --git a/tests/Behat/Page/Admin/Media/CreatePage.php b/tests/Behat/Page/Admin/Media/CreatePage.php index 3876c96de..c7385c2b1 100755 --- a/tests/Behat/Page/Admin/Media/CreatePage.php +++ b/tests/Behat/Page/Admin/Media/CreatePage.php @@ -10,7 +10,7 @@ namespace Tests\BitBag\SyliusCmsPlugin\Behat\Page\Admin\Media; -use DMore\ChromeDriver\ChromeDriver; +use Behat\Mink\Driver\PantherDriver; use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage; use Tests\BitBag\SyliusCmsPlugin\Behat\Behaviour\ContainsErrorTrait; use Webmozart\Assert\Assert; @@ -50,7 +50,7 @@ public function fillContent(string $content): void public function associateSections(array $sectionsNames): void { - Assert::isInstanceOf($this->getDriver(), ChromeDriver::class); + Assert::isInstanceOf($this->getDriver(), PantherDriver::class); $dropdown = $this->getElement('association_dropdown_section'); $dropdown->click(); diff --git a/tests/Behat/Page/Admin/Page/CreatePage.php b/tests/Behat/Page/Admin/Page/CreatePage.php index 537788973..39131ab09 100755 --- a/tests/Behat/Page/Admin/Page/CreatePage.php +++ b/tests/Behat/Page/Admin/Page/CreatePage.php @@ -10,7 +10,7 @@ namespace Tests\BitBag\SyliusCmsPlugin\Behat\Page\Admin\Page; -use DMore\ChromeDriver\ChromeDriver; +use Behat\Mink\Driver\PantherDriver; use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage; use Sylius\Behat\Service\SlugGenerationHelper; use Tests\BitBag\SyliusCmsPlugin\Behat\Behaviour\ContainsErrorTrait; @@ -40,7 +40,7 @@ public function fillName(string $name): void { $this->getDocument()->fillField('Name', $name); - if ($this->getDriver() instanceof ChromeDriver) { + if ($this->getDriver() instanceof PantherDriver) { SlugGenerationHelper::waitForSlugGeneration($this->getSession(), $this->getElement('slug')); } } @@ -67,7 +67,7 @@ public function fillContent(string $content): void public function associateSections(array $sectionsNames): void { - Assert::isInstanceOf($this->getDriver(), ChromeDriver::class); + Assert::isInstanceOf($this->getDriver(), PantherDriver::class); $dropdown = $this->getElement('association_dropdown_section'); $dropdown->click(); diff --git a/tests/Behat/Resources/services.sylius.1.11.yml b/tests/Behat/Resources/services.sylius.1.11.yml deleted file mode 100755 index 9070756ec..000000000 --- a/tests/Behat/Resources/services.sylius.1.11.yml +++ /dev/null @@ -1,8 +0,0 @@ -imports: - - { resource: "services/contexts.yml" } - - { resource: "services/pages.yml" } - - { resource: "services/api.sylius.1.11.yml" } - -services: - bitbag_sylius_cms_plugin.behat.random_string_generator: - class: Tests\BitBag\SyliusCmsPlugin\Behat\Service\RandomStringGenerator diff --git a/tests/Behat/Resources/services/api.sylius.1.11.yml b/tests/Behat/Resources/services/api.sylius.1.11.yml deleted file mode 100644 index d4440cef0..000000000 --- a/tests/Behat/Resources/services/api.sylius.1.11.yml +++ /dev/null @@ -1,35 +0,0 @@ -services: - bitbag_sylius_cms_plugin.behat.api_platform_client.shop.block: - class: Sylius\Behat\Client\ApiPlatformClient - parent: sylius.behat.api_platform_client - arguments: - - 'blocks' - - 'shop/cms-plugin' - - bitbag_sylius_cms_plugin.behat.api_platform_client.shop.frequently_asked_question: - class: Sylius\Behat\Client\ApiPlatformClient - parent: sylius.behat.api_platform_client - arguments: - - 'faq' - - 'shop/cms-plugin' - - bitbag_sylius_cms_plugin.behat.api_platform_client.shop.media: - class: Sylius\Behat\Client\ApiPlatformClient - parent: sylius.behat.api_platform_client - arguments: - - 'media' - - 'shop/cms-plugin' - - bitbag_sylius_cms_plugin.behat.api_platform_client.shop.page: - class: Sylius\Behat\Client\ApiPlatformClient - parent: sylius.behat.api_platform_client - arguments: - - 'pages' - - 'shop/cms-plugin' - - bitbag_sylius_cms_plugin.behat.api_platform_client.shop.section: - class: Sylius\Behat\Client\ApiPlatformClient - parent: sylius.behat.api_platform_client - arguments: - - 'sections' - - 'shop/cms-plugin' diff --git a/tests/Behat/Resources/services/contexts/setup.yml b/tests/Behat/Resources/services/contexts/setup.yml index 94a500eed..f4a0a5afa 100755 --- a/tests/Behat/Resources/services/contexts/setup.yml +++ b/tests/Behat/Resources/services/contexts/setup.yml @@ -19,7 +19,7 @@ services: - "@doctrine.orm.entity_manager" - "@sylius.repository.product" - "@bitbag_sylius_cms_plugin.repository.section" - - "@bitbag_sylius_cms_plugin.media_uploader" + - "@bitbag_sylius_cms_plugin.media_provider.image" bitbag_sylius_cms_plugin.behat.context.setup.frequently_asked_question: class: Tests\BitBag\SyliusCmsPlugin\Behat\Context\Setup\FrequentlyAskedQuestionContext diff --git a/tests/Behat/Service/FormHelper.php b/tests/Behat/Service/FormHelper.php index 6f33c70d0..123e5d009 100644 --- a/tests/Behat/Service/FormHelper.php +++ b/tests/Behat/Service/FormHelper.php @@ -19,7 +19,7 @@ public static function fillHiddenInput( Session $session, string $id, $value, - ): void { + ): void { try { $session->executeScript( sprintf( diff --git a/tests/Behat/Service/WysiwygHelper.php b/tests/Behat/Service/WysiwygHelper.php index 372f02cbd..e174d90fa 100644 --- a/tests/Behat/Service/WysiwygHelper.php +++ b/tests/Behat/Service/WysiwygHelper.php @@ -10,9 +10,9 @@ namespace Tests\BitBag\SyliusCmsPlugin\Behat\Service; +use Behat\Mink\Driver\PantherDriver; use Behat\Mink\Element\DocumentElement; use Behat\Mink\Session; -use DMore\ChromeDriver\ChromeDriver; use Webmozart\Assert\Assert; final class WysiwygHelper @@ -22,8 +22,8 @@ public static function fillContent( DocumentElement $document, string $content, int $iframeNumber = 1, - ): void { - Assert::isInstanceOf($session->getDriver(), ChromeDriver::class); + ): void { + Assert::isInstanceOf($session->getDriver(), PantherDriver::class); $session->wait(3000); $session->switchToIFrame($iframeNumber); diff --git a/tests/Functional/FunctionalTestCase.php b/tests/Functional/FunctionalTestCase.php index a1d25b996..8580d5bb7 100644 --- a/tests/Functional/FunctionalTestCase.php +++ b/tests/Functional/FunctionalTestCase.php @@ -20,7 +20,7 @@ abstract class FunctionalTestCase extends BaseJsonApiTestCase public function __construct( ?string $name = null, array $data = [], - string $dataName = '' + string $dataName = '', ) { parent::__construct($name, $data, $dataName);