diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 92faea2..5da7b9f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,2 @@ +* @BitBagCommerce * @Sylius/core-team diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aed8c16..ddabcd4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,30 +6,30 @@ on: - 'dependabot/**' pull_request: ~ release: - types: [ created ] + types: [created] schedule: - cron: "0 1 * * 6" # Run at 1am every Saturday workflow_dispatch: ~ jobs: tests: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, + MySQL ${{ matrix.mysql }}" strategy: fail-fast: false matrix: - php: [ 8.0 ] - symfony: [ ^5.4, ^6.0 ] - sylius: [ ~1.11.0, ~1.12.0 ] - node: [ 14.x ] - mysql: [ 5.7, 8.0 ] + php: ["8.0", "8.1", "8.2", "8.3"] + symfony: ["^5.4", "^6.0"] + sylius: ["~1.12.0", "~1.13.0"] + node: ["^20.x"] + mysql: ["8.0"] exclude: - - - sylius: ~1.11.0 - symfony: ^6.0 + - sylius: "~1.13.0" + php: "8.0" env: APP_ENV: test @@ -130,8 +130,11 @@ jobs: - name: Validate database schema run: (cd tests/Application && bin/console doctrine:schema:validate) + - name: Run PHPStan + run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ + - name: Run ECS - run: vendor/bin/ecs check src + run: vendor/bin/ecs check src tests/Behat - name: Run PHPSpec run: vendor/bin/phpspec run --ansi -f progress --no-interaction diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml deleted file mode 100644 index b6b8c5a..0000000 --- a/.github/workflows/coding_standard.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Coding standard - -on: - pull_request: ~ - release: - types: [created] - workflow_dispatch: ~ - -jobs: - tests: - runs-on: ubuntu-latest - - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" - - strategy: - fail-fast: false - matrix: - php: [ 8.0] - symfony: [^5.4, ^6.0] - sylius: [~1.11.0, ~1.12.0] - node: [14.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 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - extensions: intl - tools: symfony - coverage: none - - - name: Get Composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - - name: Cache Composer - uses: actions/cache@v2 - 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 config extra.symfony.require "${{ matrix.symfony }}" - - - name: Restrict Sylius version - if: matrix.sylius != '' - run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction - - - - name: Install PHP dependencies - run: composer install --no-interaction - - - - name: Run PHPStan - run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ - - - - name: Run ECS - run: vendor/bin/ecs - - - - name: Failed build Slack notification - uses: rtCamp/action-slack-notify@v2 - if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} - env: - SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} - SLACK_COLOR: ${{ job.status }} - SLACK_ICON: https://github.com/rtCamp.png?size=48 - 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 }} diff --git a/composer.json b/composer.json index a6252e1..7116ba2 100644 --- a/composer.json +++ b/composer.json @@ -10,12 +10,12 @@ "license": "MIT", "require": { "php": "^8.0", - "sylius/sylius": "^1.11 || ^1.12" + "sylius/sylius": "^1.12 || ^1.13" }, "require-dev": { "behat/behat": "^3.6.1", "behat/mink-selenium2-driver": "^1.4", - "bitbag/coding-standard": "^v2.0.1", + "bitbag/coding-standard": "^3.0", "dmore/behat-chrome-extension": "^1.3", "dmore/chrome-mink-driver": "^2.7", "friends-of-behat/mink": "^1.8", @@ -28,23 +28,24 @@ "friends-of-behat/variadic-extension": "^1.3", "phpspec/phpspec": "^7.0", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.4", + "phpstan/phpstan": "1.4", "phpstan/phpstan-doctrine": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", "phpstan/phpstan-webmozart-assert": "^1.0", "phpunit/phpunit": "^9.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "sylius-labs/coding-standard": "^4.0", - "symfony/browser-kit": "^4.4 || ^5.2", - "symfony/debug-bundle": "^4.4 || ^5.2", - "symfony/dotenv": "^4.4 || ^5.2", - "symfony/intl": "^4.4 || ^5.2", - "symfony/web-profiler-bundle": "^4.4 || ^5.2", + "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", "symfony/webpack-encore-bundle": "^1.14", - "vimeo/psalm": "4.24.0" + "doctrine/persistence": "^3.0" }, "conflict": { - "composer/composer": "2.3.9" + "behat/mink-selenium2-driver": ">=1.7.0", + "doctrine/annotations": ">1.15" }, "config": { "sort-packages": true, diff --git a/ecs.php b/ecs.php index aaafe23..4982640 100644 --- a/ecs.php +++ b/ecs.php @@ -2,19 +2,11 @@ declare(strict_types=1); -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; -use Symplify\EasyCodingStandard\ValueObject\Option; +use Symplify\EasyCodingStandard\Config\ECSConfig; -return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php'); +return static function (ECSConfig $config): void { + putenv('ALLOW_BITBAG_OS_HEADER=1'); - $parameters = $containerConfigurator->parameters(); - $parameters->set(Option::PATHS, [ - __DIR__ . '/src', - __DIR__ . '/tests', - ]); - $parameters->set(Option::SKIP, [ - __DIR__ . '/tests/Application/var', - __DIR__ . '/vendor' - ]); + $config->import('vendor/bitbag/coding-standard/ecs.php'); + $config->paths(['src', 'tests']); }; diff --git a/features/banner.feature b/features/banner.feature index 03978f4..d5a26e3 100644 --- a/features/banner.feature +++ b/features/banner.feature @@ -14,7 +14,7 @@ Feature: Adding a new banner @ui Scenario: Adding a new banner When I fill form with "TEST-SECTION" section, "TEST-AD" ad, "en_US" and "100" priority - And I add new image "ford.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8000/en_US" + And I add new image "ford.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8080/en_US" And I submit form Then I should be notified that it has been successfully created And "TEST-AD" ad should has 1 banners @@ -22,12 +22,12 @@ Feature: Adding a new banner @ui Scenario: Adding 2 banners to one ad When I fill form with "TEST-SECTION" section, "TEST-AD" ad, "en_US" and "100" priority - And I add new image "ford.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8000/en_US" + And I add new image "ford.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8080/en_US" And I submit form Then I should be notified that it has been successfully created And I am on new banner page And I fill form with "TEST-SECTION" section, "TEST-AD" ad, "en_US" and "150" priority - And I add new image "troll.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8000/en_US" + And I add new image "troll.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8080/en_US" And I submit form Then I should be notified that it has been successfully created And "TEST-AD" ad should has 2 banners diff --git a/src/Controller/Action/CountClicksAction.php b/src/Controller/Action/CountClicksAction.php index 02bf0a9..d3f0a7d 100644 --- a/src/Controller/Action/CountClicksAction.php +++ b/src/Controller/Action/CountClicksAction.php @@ -26,7 +26,7 @@ final class CountClicksAction public function __construct( BannerRepositoryInterface $bannerRepository, - ObjectManager $objectManager + ObjectManager $objectManager, ) { $this->bannerRepository = $bannerRepository; $this->objectManager = $objectManager; diff --git a/src/DataProvider/GetAdsBannersDataProvider.php b/src/DataProvider/GetAdsBannersDataProvider.php index b8caf0c..e601c1a 100644 --- a/src/DataProvider/GetAdsBannersDataProvider.php +++ b/src/DataProvider/GetAdsBannersDataProvider.php @@ -32,7 +32,7 @@ public function __construct(AdRepositoryInterface $adRepository, BannersProvider public function supports( string $resourceClass, string $operationName = null, - array $context = [] + array $context = [], ): bool { return Banner::class === $resourceClass; } @@ -40,7 +40,7 @@ public function supports( public function getCollection( string $resourceClass, string $operationName = null, - array $context = [] + array $context = [], ): iterable { $localeCode = $context['filters']['locale_code'] ?? null; $sectionCode = $context['filters']['section_code'] ?? null; diff --git a/src/Generator/BannerPathGenerator.php b/src/Generator/BannerPathGenerator.php index f6d7683..d06fe06 100644 --- a/src/Generator/BannerPathGenerator.php +++ b/src/Generator/BannerPathGenerator.php @@ -25,7 +25,7 @@ public function generate(BannerInterface $banner): string return $this->expandPath( sprintf('%s.%s', $hash, $file->guessExtension()), - self::PATH_PREFIX + self::PATH_PREFIX, ); } @@ -36,7 +36,7 @@ private function expandPath(string $path, string $pathPrefix): string $pathPrefix, substr($path, 0, 2), substr($path, 2, 2), - substr($path, 4) + substr($path, 4), ); } } diff --git a/src/Operator/BannersOperator.php b/src/Operator/BannersOperator.php index fba63f7..0d6d72f 100644 --- a/src/Operator/BannersOperator.php +++ b/src/Operator/BannersOperator.php @@ -20,7 +20,7 @@ final class BannersOperator implements BannersOperatorInterface public function operate( AdInterface $ad, string $sectionCode, - string $localeCode + string $localeCode, ): ?array { /** @var Collection $adBanners */ $adBanners = $ad->getBanners(); @@ -44,7 +44,7 @@ public function operate( private function filterBannersBySectionAndLocale( Collection $adBanners, string $sectionCode, - string $localeCode + string $localeCode, ): Collection { return $adBanners->filter(function (BannerInterface $banner) use ($sectionCode, $localeCode) { if (null !== $banner->getLocale() && diff --git a/src/Operator/BannersOperatorInterface.php b/src/Operator/BannersOperatorInterface.php index 2bd3a07..57cd3ef 100644 --- a/src/Operator/BannersOperatorInterface.php +++ b/src/Operator/BannersOperatorInterface.php @@ -18,6 +18,6 @@ interface BannersOperatorInterface public function operate( AdInterface $ad, string $sectionCode, - string $localeCode + string $localeCode, ): ?array; } diff --git a/src/Provider/BannersProvider.php b/src/Provider/BannersProvider.php index 4652d0a..f3d4ed4 100644 --- a/src/Provider/BannersProvider.php +++ b/src/Provider/BannersProvider.php @@ -26,7 +26,7 @@ public function __construct(BannersOperatorInterface $bannersOperator) public function getAdsBanners( array $ads, string $sectionCode, - string $localeCode + string $localeCode, ): ?array { $banners = []; @@ -44,7 +44,7 @@ public function getAdsBanners( public function getAdBanners( AdInterface $ad, string $sectionCode, - string $localeCode + string $localeCode, ): ?array { return $this->bannersOperator->operate($ad, $sectionCode, $localeCode); } diff --git a/src/Provider/BannersProviderInterface.php b/src/Provider/BannersProviderInterface.php index 5e356c2..9640ce3 100644 --- a/src/Provider/BannersProviderInterface.php +++ b/src/Provider/BannersProviderInterface.php @@ -1,7 +1,5 @@ adRepository->findAllActiveAds(); @@ -52,7 +52,7 @@ public function getActiveAdsBannersBySectionAndLocale( public function getActiveAdBannersByCodeSectionAndLocale( string $adCode, string $sectionCode, - string $localeCode + string $localeCode, ): ?array { $ad = $this->adRepository->findActiveAdByCode($adCode); diff --git a/src/Uploader/BannerUploader.php b/src/Uploader/BannerUploader.php index 20bad87..c8d087a 100644 --- a/src/Uploader/BannerUploader.php +++ b/src/Uploader/BannerUploader.php @@ -53,7 +53,7 @@ public function upload(BannerInterface $banner): void $this->filesystem->write( $path, - $fileContents + $fileContents, ); } diff --git a/tests/Application/.env b/tests/Application/.env index 5f0098c..f00d7c9 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -12,7 +12,7 @@ APP_SECRET=EDITME # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url # For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db" # Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls -DATABASE_URL=mysql://root@127.0.0.1/sylius_banner_plugin_%kernel.environment%?serverVersion=5.7 +DATABASE_URL=mysql://root@127.0.0.1/sylius_banner_plugin_%kernel.environment%?serverVersion=8.0 ###< doctrine/doctrine-bundle ### ###> lexik/jwt-authentication-bundle ### diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php index d7ac51d..2291ab4 100644 --- a/tests/Application/config/bootstrap.php +++ b/tests/Application/config/bootstrap.php @@ -15,7 +15,7 @@ throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); } else { // load all the .env files - (new Dotenv(true))->loadEnv(dirname(__DIR__) . '/.env'); + (new Dotenv())->loadEnv(dirname(__DIR__) . '/.env'); } $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index 2ba5527..2bb980f 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -6,13 +6,13 @@ * You can find more information about us on https://bitbag.io and write us * an email on hello@bitbag.io. */ + declare(strict_types=1); return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], - Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true], @@ -63,4 +63,8 @@ Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], + Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], + League\FlysystemBundle\FlysystemBundle::class => ['all' => true], + BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], + SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/sylius/1.12/packages/mailer.yaml b/tests/Application/config/packages/test/mailer.yaml similarity index 100% rename from tests/Application/config/sylius/1.12/packages/mailer.yaml rename to tests/Application/config/packages/test/mailer.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 236cefa..0000000 --- a/tests/Application/config/sylius/1.11/bundles.php +++ /dev/null @@ -1,17 +0,0 @@ - ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], - Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml deleted file mode 100644 index f438078..0000000 --- a/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - disable_delivery: true diff --git a/tests/Application/config/sylius/1.11/packages/security.yaml b/tests/Application/config/sylius/1.11/packages/security.yaml deleted file mode 100644 index 1062810..0000000 --- a/tests/Application/config/sylius/1.11/packages/security.yaml +++ /dev/null @@ -1,148 +0,0 @@ -parameters: - sylius.security.admin_regex: "^/%sylius_admin.path_name%" - sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++" - sylius.security.new_api_route: "/new-api" - sylius.security.new_api_regex: "^%sylius.security.new_api_route%" - sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" - sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%" - sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop" - sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%" - -security: - always_authenticate_before_granting: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - anonymous: true - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/sylius/1.11/packages/staging/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/staging/swiftmailer.yaml deleted file mode 100644 index f438078..0000000 --- a/tests/Application/config/sylius/1.11/packages/staging/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - disable_delivery: true 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 3bab0d3..0000000 --- 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/security.yaml b/tests/Application/config/sylius/1.11/packages/test/security.yaml deleted file mode 100644 index 21cc377..0000000 --- a/tests/Application/config/sylius/1.11/packages/test/security.yaml +++ /dev/null @@ -1,3 +0,0 @@ -security: - encoders: - sha512: sha512 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 c438f4b..0000000 --- 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" diff --git a/tests/Application/config/sylius/1.11/packages/test_cached/security.yaml b/tests/Application/config/sylius/1.11/packages/test_cached/security.yaml deleted file mode 100644 index 21cc377..0000000 --- a/tests/Application/config/sylius/1.11/packages/test_cached/security.yaml +++ /dev/null @@ -1,3 +0,0 @@ -security: - encoders: - sha512: sha512 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 c438f4b..0000000 --- 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" 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 e11e90b..0000000 --- a/tests/Application/config/sylius/1.12/bundles.php +++ /dev/null @@ -1,17 +0,0 @@ - ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], - League\FlysystemBundle\FlysystemBundle::class => ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.13/bundles.php b/tests/Application/config/sylius/1.13/bundles.php new file mode 100644 index 0000000..a266a2f --- /dev/null +++ b/tests/Application/config/sylius/1.13/bundles.php @@ -0,0 +1,5 @@ + ['all' => true], +]; diff --git a/tests/Application/config/sylius/1.13/packages/_sylius.yaml b/tests/Application/config/sylius/1.13/packages/_sylius.yaml new file mode 100644 index 0000000..259552d --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/_sylius.yaml @@ -0,0 +1,7 @@ +parameters: + test_default_state_machine_adapter: 'symfony_workflow' + test_sylius_state_machine_adapter: '%env(string:default:test_default_state_machine_adapter:TEST_SYLIUS_STATE_MACHINE_ADAPTER)%' + +sylius_state_machine_abstraction: + graphs_to_adapters_mapping: + sylius_refund_refund_payment: '%test_sylius_state_machine_adapter%' diff --git a/tests/Application/config/sylius/1.13/packages/security.yaml b/tests/Application/config/sylius/1.13/packages/security.yaml new file mode 100644 index 0000000..7458c77 --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/security.yaml @@ -0,0 +1,124 @@ +security: + enable_authenticator_manager: true + providers: + sylius_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_api_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + sylius_api_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + + password_hashers: + Sylius\Component\User\Model\UserInterface: argon2i + firewalls: + admin: + switch_user: true + context: admin + pattern: "%sylius.security.admin_regex%" + provider: sylius_admin_user_provider + form_login: + provider: sylius_admin_user_provider + login_path: sylius_admin_login + check_path: sylius_admin_login_check + failure_path: sylius_admin_login + default_target_path: sylius_admin_dashboard + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_admin_security_token + csrf_token_id: admin_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + path: "/%sylius_admin.path_name%" + name: APP_ADMIN_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_admin_logout + target: sylius_admin_login + + new_api_admin_user: + pattern: "%sylius.security.new_api_admin_regex%/.*" + provider: sylius_api_admin_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_admin_route%/administrators/token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + new_api_shop_user: + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_shop_route%/customers/token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + shop: + switch_user: { role: ROLE_ALLOWED_TO_SWITCH } + context: shop + pattern: "%sylius.security.shop_regex%" + provider: sylius_shop_user_provider + form_login: + success_handler: sylius.authentication.success_handler + failure_handler: sylius.authentication.failure_handler + provider: sylius_shop_user_provider + login_path: sylius_shop_login + check_path: sylius_shop_login_check + failure_path: sylius_shop_login + default_target_path: sylius_shop_homepage + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_shop_security_token + csrf_token_id: shop_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + name: APP_SHOP_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_shop_logout + target: sylius_shop_homepage + invalidate_session: false + + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + image_resolver: + pattern: ^/media/cache/resolve + security: false + + access_control: + - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } + - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } + + - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } + - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } + + - { path: "%sylius.security.new_api_admin_route%/administrators/reset-password", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.new_api_admin_route%/administrators/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.new_api_shop_route%/customers/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.13/packages/test_cached/security.yaml b/tests/Application/config/sylius/1.13/packages/test_cached/security.yaml new file mode 100644 index 0000000..e6c3df6 --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/test_cached/security.yaml @@ -0,0 +1,3 @@ +security: + encoders: + sha512: sha512 diff --git a/tests/Application/config/symfony/4.4/packages/framework.yaml b/tests/Application/config/symfony/4.4/packages/framework.yaml deleted file mode 100644 index 62f82d3..0000000 --- a/tests/Application/config/symfony/4.4/packages/framework.yaml +++ /dev/null @@ -1,2 +0,0 @@ -framework: - templating: { engines: ["twig"] } diff --git a/tests/Application/package.json b/tests/Application/package.json index e503876..e56f4f0 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -1,15 +1,15 @@ { "dependencies": { "babel-polyfill": "^6.26.0", - "chart.js": "^3.7.1", "jquery": "^3.4.0", "jquery.dirtyforms": "^2.0.0", "lightbox2": "^2.9.0", "semantic-ui-css": "^2.2.0", - "slick-carousel": "^1.8.1" + "slick-carousel": "^1.8.1", + "chart.js": "^3.7.1" }, "devDependencies": { - "@symfony/webpack-encore": "^1.8.0", + "@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", @@ -23,13 +23,18 @@ "eslint-plugin-import": "^2.11.0", "fast-async": "^6.3.7", "merge-stream": "^1.0.0", - "sass": "^1.39.2", - "sass-loader": "^12.1.0" + "sass": "^1.50.0", + "sass-loader": "^7.0.1", + "upath": "^1.1.0", + "webpack": "^5.76.1", + "yargs": "^6.4.0" }, "scripts": { "dev": "yarn encore dev", "watch": "yarn encore dev --watch", - "prod": "yarn encore prod" + "prod": "yarn encore prod", + "lint": "yarn lint:js", + "lint:js": "eslint gulpfile.babel.js" }, "repository": { "type": "git", diff --git a/tests/Application/public/media/image/.gitignore b/tests/Application/public/media/image/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tests/Behat/Context/Setup/Admin/BannerSetupContext.php b/tests/Behat/Context/Setup/Admin/BannerSetupContext.php index 18b7d92..11913f3 100644 --- a/tests/Behat/Context/Setup/Admin/BannerSetupContext.php +++ b/tests/Behat/Context/Setup/Admin/BannerSetupContext.php @@ -48,7 +48,7 @@ public function __construct( FactoryInterface $bannerFactory, ObjectRepository $localeRepository, BannerPage $bannerPage, - BannerRepository $bannerRepository + BannerRepository $bannerRepository, ) { $this->adRepository = $adRepository; $this->sectionRepository = $sectionRepository; @@ -82,7 +82,7 @@ public function theStoreHasSectionWithCode(string $code) public function theStoreHasActiveAdWithCode( string $code, int $priority, - string $name + string $name, ) { /** @var AdInterface $ad */ $ad = $this->adFactory->createNew(); @@ -103,7 +103,7 @@ public function theStoreHasActiveAdWithCode( public function theStoreHasNonActiveAdWithCode( string $code, int $priority, - string $name + string $name, ) { /** @var AdInterface $ad */ $ad = $this->adFactory->createNew(); @@ -128,7 +128,7 @@ public function theStoreHasBannerWithImageAltAndLinkInSectionAndAdWithPriorityIn SectionInterface $section, AdInterface $ad, int $priority, - string $locale + string $locale, ) { $locale = $this->localeRepository->findOneBy(['code' => $locale]); diff --git a/tests/Behat/Context/Ui/Admin/AdContext.php b/tests/Behat/Context/Ui/Admin/AdContext.php index 6a229e4..b735f92 100644 --- a/tests/Behat/Context/Ui/Admin/AdContext.php +++ b/tests/Behat/Context/Ui/Admin/AdContext.php @@ -41,7 +41,7 @@ public function iCreateANewAdWithData( string $startDate, string $endDate, int $priority, - string $code + string $code, ) { $this->adPage->setAdFormData( $name, @@ -49,7 +49,7 @@ public function iCreateANewAdWithData( $startDate, $endDate, $priority, - $code + $code, ); $this->adPage->submitForm(); } diff --git a/tests/Behat/Context/Ui/Admin/BannerContext.php b/tests/Behat/Context/Ui/Admin/BannerContext.php index e03615a..e5666b1 100644 --- a/tests/Behat/Context/Ui/Admin/BannerContext.php +++ b/tests/Behat/Context/Ui/Admin/BannerContext.php @@ -27,7 +27,7 @@ final class BannerContext implements Context public function __construct( BannerPage $bannerPage, - ObjectManager $manager + ObjectManager $manager, ) { $this->bannerPage = $bannerPage; $this->manager = $manager; @@ -66,7 +66,7 @@ public function iFillFormWithAndPriority( SectionInterface $sectionCode, AdInterface $adCode, string $locale, - int $priority + int $priority, ) { $this->bannerPage->fillGeneralInfoForm($sectionCode, $adCode, $locale, $priority); } @@ -77,7 +77,7 @@ public function iFillFormWithAndPriority( public function iAddNewImageAndFillAltAsAndLinksAs( string $image, string $alt, - string $link + string $link, ) { $this->bannerPage->fillBannerInfoForm($alt, $link); $this->bannerPage->attachImage($image); diff --git a/tests/Behat/Context/Ui/Admin/SectionContext.php b/tests/Behat/Context/Ui/Admin/SectionContext.php index 88dd89c..0a457fd 100644 --- a/tests/Behat/Context/Ui/Admin/SectionContext.php +++ b/tests/Behat/Context/Ui/Admin/SectionContext.php @@ -31,7 +31,7 @@ public function iCreateANewSectionWithData( string $name, string $code, int $width, - int $height + int $height, ) { $this->sectionPage->setSectionData($name, $code, $width, $height); $this->sectionPage->submitForm(); diff --git a/tests/Behat/Page/Admin/AdPage.php b/tests/Behat/Page/Admin/AdPage.php index aebabd6..effff80 100644 --- a/tests/Behat/Page/Admin/AdPage.php +++ b/tests/Behat/Page/Admin/AdPage.php @@ -26,7 +26,7 @@ public function setSectionData( string $name, string $code, int $width, - int $height + int $height, ): void { $this->getElement('section_name_field')->setValue($name); $this->getElement('section_code_field')->setValue($code); @@ -57,7 +57,7 @@ public function setAdFormData( string $startDate, string $endDate, int $priority, - string $code + string $code, ) { $this->getElement('section_name_field')->setValue($name); $this->getElement('section_code_field')->setValue($code); diff --git a/tests/Behat/Page/Admin/BannerPage.php b/tests/Behat/Page/Admin/BannerPage.php index 7f760cb..698a38f 100644 --- a/tests/Behat/Page/Admin/BannerPage.php +++ b/tests/Behat/Page/Admin/BannerPage.php @@ -28,7 +28,7 @@ public function setSectionData( string $name, string $code, int $width, - int $height + int $height, ): void { $this->getElement('section_name_field')->setValue($name); $this->getElement('section_code_field')->setValue($code); @@ -57,7 +57,7 @@ public function fillGeneralInfoForm( SectionInterface $sectionCode, AdInterface $adCode, string $locale, - int $priority + int $priority, ): void { $this->getElement('banner_locale_field')->setValue($locale); $this->getElement('banner_section_field')->setValue($sectionCode->getId()); @@ -90,7 +90,7 @@ protected function getDefinedElements(): array 'banner_section_field' => '#bitbag_sylius_banner_plugin_banner_section', 'banner_priority_field' => '#bitbag_sylius_banner_plugin_banner_priority', 'banner_ad_field' => '#bitbag_sylius_banner_plugin_banner_ads', - 'banner_file_field' => '#bitbag_sylius_banner_plugin_banner_file', + 'banner_file_field' => 'input[name="bitbag_sylius_banner_plugin_banner[file]"]', 'banner_link_field' => '#bitbag_sylius_banner_plugin_banner_link', 'banner_alt_field' => '#bitbag_sylius_banner_plugin_banner_alt', ]); diff --git a/tests/Behat/Page/Admin/SectionPage.php b/tests/Behat/Page/Admin/SectionPage.php index ca47d24..c350d7d 100644 --- a/tests/Behat/Page/Admin/SectionPage.php +++ b/tests/Behat/Page/Admin/SectionPage.php @@ -26,7 +26,7 @@ public function __construct( Session $session, $minkParameters, RouterInterface $router, - NotificationCheckerInterface $notificationChecker + NotificationCheckerInterface $notificationChecker, ) { parent::__construct($session, $minkParameters, $router); $this->notificationChecker = $notificationChecker; @@ -41,7 +41,7 @@ public function setSectionData( string $name, string $code, int $width, - int $height + int $height, ): void { $this->getElement('section_name_field')->setValue($name); $this->getElement('section_code_field')->setValue($code); diff --git a/tests/Behat/Resources/suites/ui/admin/ad.yaml b/tests/Behat/Resources/suites/ui/admin/ad.yaml index 06bde62..ef5fe0c 100644 --- a/tests/Behat/Resources/suites/ui/admin/ad.yaml +++ b/tests/Behat/Resources/suites/ui/admin/ad.yaml @@ -14,4 +14,4 @@ default: - bitbag.sylius_banner_plugin.behat.context.ui.admin.ad_context filters: - tags: "@managing_ad && @ui" + tags: "@managing_ad&&@ui" diff --git a/tests/Behat/Resources/suites/ui/admin/banner.yaml b/tests/Behat/Resources/suites/ui/admin/banner.yaml index 722dbb8..e0022fb 100644 --- a/tests/Behat/Resources/suites/ui/admin/banner.yaml +++ b/tests/Behat/Resources/suites/ui/admin/banner.yaml @@ -17,4 +17,4 @@ default: - bitbag.sylius_banner_plugin.behat.transformer.ad_transformer filters: - tags: "@managing_banners && @ui" + tags: "@managing_banners&&@ui" diff --git a/tests/Behat/Resources/suites/ui/admin/section.yaml b/tests/Behat/Resources/suites/ui/admin/section.yaml index b6612ab..98d3650 100644 --- a/tests/Behat/Resources/suites/ui/admin/section.yaml +++ b/tests/Behat/Resources/suites/ui/admin/section.yaml @@ -14,4 +14,4 @@ default: - bitbag.sylius_banner_plugin.behat.context.ui.admin.section_context filters: - tags: "@managing_sections && @ui" + tags: "@managing_sections&&@ui" diff --git a/tests/Behat/Resources/suites/ui/shop/banners.yaml b/tests/Behat/Resources/suites/ui/shop/banners.yaml index 9eb3911..9436882 100644 --- a/tests/Behat/Resources/suites/ui/shop/banners.yaml +++ b/tests/Behat/Resources/suites/ui/shop/banners.yaml @@ -23,4 +23,4 @@ default: - bitbag.sylius_banner_plugin.behat.transformer.ad_transformer filters: - tags: "@showing_banners && @ui" + tags: "@showing_banners&&@ui" diff --git a/tests/Behat/Transformer/AdTransformer.php b/tests/Behat/Transformer/AdTransformer.php index 168bcae..216b96d 100644 --- a/tests/Behat/Transformer/AdTransformer.php +++ b/tests/Behat/Transformer/AdTransformer.php @@ -37,7 +37,7 @@ public function getAdByCode(string $adCode): AdInterface Assert::notNull( $ad, - sprintf('Banner ad with code "%s" does not exist', $adCode) + sprintf('Banner ad with code "%s" does not exist', $adCode), ); return $ad; diff --git a/tests/Behat/Transformer/SectionTransformer.php b/tests/Behat/Transformer/SectionTransformer.php index 94c9ec8..50a3efe 100644 --- a/tests/Behat/Transformer/SectionTransformer.php +++ b/tests/Behat/Transformer/SectionTransformer.php @@ -37,7 +37,7 @@ public function getSectionByCode(string $sectionCode): SectionInterface Assert::notNull( $section, - sprintf('Banner section with code "%s" does not exist', $sectionCode) + sprintf('Banner section with code "%s" does not exist', $sectionCode), ); return $section;