diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f930ed8d..95be71f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,22 +14,18 @@ on: jobs: tests: - runs-on: ubuntu-20.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 }}, Node ${{ matrix.node }}" strategy: fail-fast: false matrix: - php: ["8.1"] - symfony: ["^5.4", "^6.0"] - sylius: ["~1.11.0", "~1.12.0", "1.13.x-dev as 1.13.0"] - node: ["14.x"] - mysql: ["8.0.36"] - - exclude: - - sylius: ~1.11.0 - symfony: "^6.0" + php: [ "8.1", "8.2", "8.3" ] + symfony: [ "^5.4", "^6.0" ] + sylius: [ "^1.12", "^1.13" ] + node: [ "18.x", "20.x" ] + mysql: [ "5.7", "8.0" ] env: APP_ENV: test DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" @@ -139,11 +135,6 @@ jobs: 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) @@ -170,7 +161,6 @@ jobs: - name: Validate composer.json - if: ${{ matrix.sylius != '1.13.x-dev as 1.13.0' }} run: composer validate --ansi --strict - @@ -186,12 +176,10 @@ jobs: - name: Run Behat - if: ${{ matrix.sylius != '1.13.x-dev as 1.13.0' }} run: vendor/bin/behat --colors --strict -vvv --no-interaction --tags '~@sylius113' || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun --tags '~@sylius113' - name: Run Behat - if: ${{ matrix.sylius == '1.13.x-dev as 1.13.0' }} run: vendor/bin/behat --colors --strict -vvv --no-interaction --tags '~@sylius112' || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun --tags '~@sylius112' diff --git a/composer.json b/composer.json index 91ee9ae8..1a8a3399 100644 --- a/composer.json +++ b/composer.json @@ -6,15 +6,17 @@ "require": { "ext-json": "*", "php": "^8.0", - "sylius/sylius": "~1.11.0 || >=1.12.13 || ~1.13.0", "friendsofsymfony/elastica-bundle": "^6.0", + "sylius/sylius": ">=1.12.13 || ~1.13.0", "symfony/property-access": "^5.4 || ^6.0", - "symfony/webpack-encore-bundle": "^1.16", + "symfony/webpack-encore-bundle": "^1.15", "symfony/proxy-manager-bridge": "^5.4 || ^6.0" }, "require-dev": { - "behat/behat": "^3.7", - "behat/mink-selenium2-driver": "~1.6.0", + "behat/behat": "^3.6.1", + "behat/mink-selenium2-driver": "^1.4", + "bitbag/coding-standard": "^v2.0", + "dbrekelmans/bdi": "^1.1", "dmore/behat-chrome-extension": "^1.3", "dmore/chrome-mink-driver": "^2.7", "friends-of-behat/mink": "^1.8", @@ -25,32 +27,46 @@ "friends-of-behat/suite-settings-extension": "^1.0", "friends-of-behat/symfony-extension": "^2.1", "friends-of-behat/variadic-extension": "^1.3", - "phpspec/phpspec": "^7.0", + "league/flysystem-bundle": "2.4.0", + "lchrusciel/api-test-case": "^5.2", + "phpspec/phpspec": "^7.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "0.12.82", - "phpstan/phpstan-doctrine": "0.12.33", - "phpstan/phpstan-strict-rules": "^0.12.0", - "phpstan/phpstan-webmozart-assert": "0.12.12", - "phpunit/phpunit": "^9.5", - "sylius-labs/coding-standard": "^4.0", + "phpstan/phpstan": "^1.8.1", + "phpstan/phpstan-doctrine": "1.3.69", + "phpstan/phpstan-strict-rules": "^1.3.0", + "phpstan/phpstan-webmozart-assert": "^1.2.0", + "phpunit/phpunit": "^10.5", + "polishsymfonycommunity/symfony-mocker-container": "^1.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.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", - "vimeo/psalm": "4.27.0", - "bitbag/coding-standard": "^1.0.1", - "league/flysystem-bundle": "2.4.0", - "polishsymfonycommunity/symfony-mocker-container": "^1.0", - "lchrusciel/api-test-case": "^5.2", - "symfony/mailer": "^5.4 || ^6.0", - "sylius/mailer-bundle": "^1.8 || ^2.0@beta", - "twig/extra-bundle": "^3.4" + "symfony/web-profiler-bundle": "^5.4 || ^6.0" }, "conflict": { - "symfony/form": "4.4.11 || 4.4.12", "api-platform/core": "v2.7.17", - "sylius/sylius": ">= 1.12.0 < 1.12.13" + "symfony/framework-bundle": "6.2.8", + "behat/mink-selenium2-driver": ">=1.7.0" + }, + "config": { + "sort-packages": true, + "allow-plugins": { + "symfony/thanks": true, + "composer/package-versions-deprecated": true, + "dealerdirect/phpcodesniffer-composer-installer": true, + "phpstan/extension-installer": true + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + }, + "symfony": { + "require": "^5.4 || ^6.0" + } }, "autoload": { "psr-4": { @@ -75,14 +91,11 @@ ], "post-create-project-cmd": [ "php bin/create_node_symlink.php" - ] - }, - "config": { - "allow-plugins": { - "symfony/thanks": true, - "composer/package-versions-deprecated": true, - "dealerdirect/phpcodesniffer-composer-installer": true, - "phpstan/extension-installer": true + ], + "auto-scripts": { + "cache:clear": "symfony-cmd", + "assets:install %PUBLIC_DIR%": "symfony-cmd", + "security-checker security:check": "script" } } } diff --git a/ecs.php b/ecs.php index b088160e..abcfbcf8 100644 --- a/ecs.php +++ b/ecs.php @@ -2,15 +2,12 @@ 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 { - $parameters = $containerConfigurator->parameters(); - $parameters->set(Option::PATHS, [ - __DIR__ . '/src', - __DIR__ . '/tests', - ]); + putenv('ALLOW_BITBAG_OS_HEADER=1'); + + $config->import('vendor/bitbag/coding-standard/ecs.php'); + $config->paths(['src', 'tests']); }; diff --git a/features/shop/site_wide_searching_products.feature b/features/shop/site_wide_searching_products.feature index 41dd6cc3..fe712590 100644 --- a/features/shop/site_wide_searching_products.feature +++ b/features/shop/site_wide_searching_products.feature @@ -11,34 +11,34 @@ Feature: Site-wide products search And the store has a select product attribute "Car Type" with values "Cabrio" and "SUV" And the store has a select product attribute "Motorbike Type" with values "Enduro" and "Naked" And there is a product named "BMW Z4" in the store - And this product's price is "$42670" + And this product's price is "$42,670.00" And this product has select attribute "Car Type" with value "Cabrio" And this product has a text attribute "Color" with value "Red" And this product has option "Supply" with values "Gasoline" and "Diesel" - And this product is available in "Gasoline" supply priced at "$42670" - And this product is available in "Diesel" supply priced at "$45670" + And this product is available in "Gasoline" supply priced at "$42,670.00" + And this product is available in "Diesel" supply priced at "$45,670.00" And this product belongs to "Cars" And there is a product named "Volvo XC90" in the store - And this product's price is "$64505.80" + And this product's price is "$64,505.80" And this product has select attribute "Car Type" with value "SUV" And this product has a text attribute "Color" with value "Black" And this product belongs to "Cars" And there is a product named "BMW 5 Series" in the store - And this product's price is "$52070" + And this product's price is "$52,070.00" And this product has select attribute "Car Type" with value "Cabrio" And this product has a text attribute "Color" with value "Red" And this product belongs to "Cars" And there is a product named "Lamborghini Aventador" in the store - And this product's price is "$450000" + And this product's price is "$450,000.00" And this product has a text attribute "Color" with value "Yellow" And this product belongs to "Cars" And there is a product named "BMW GS" in the store - And this product's price is "$18070" + And this product's price is "$18,070.00" And this product has select attribute "Motorbike Type" with value "Enduro" And this product has a text attribute "Color" with value "Grey" And this product belongs to "Motorbikes" And there is a product named "Ducati Monster" in the store - And this product's price is "$14995" + And this product's price is "$14,995.00" And this product has select attribute "Motorbike Type" with value "Naked" And this product has a text attribute "Color" with value "Black" And this product's short description is: @@ -49,7 +49,7 @@ Feature: Site-wide products search And there is a product named "Honda Africa Twin" in the store And this product has select attribute "Motorbike Type" with value "Enduro" And this product has a text attribute "Color" with value "Green & White" - And this product's price is "$13490" + And this product's price is "$13,490.00" And this product's description is: """ This is the Honda Africa Twin which is like the BMW GS but from Honda. diff --git a/spec/Controller/Action/Shop/ListProductsActionSpec.php b/spec/Controller/Action/Shop/ListProductsActionSpec.php index bdec5b97..30f9b070 100644 --- a/spec/Controller/Action/Shop/ListProductsActionSpec.php +++ b/spec/Controller/Action/Shop/ListProductsActionSpec.php @@ -70,6 +70,7 @@ function it_renders_product_list( ): void { $form->getData()->willReturn([]); $form->isValid()->willReturn(true); + $form->isSubmitted()->willReturn(true); $form->handleRequest($request)->willReturn($form); $form->createView()->willReturn($formView); diff --git a/src/Controller/RequestDataHandler/PaginationDataHandler.php b/src/Controller/RequestDataHandler/PaginationDataHandler.php index ed3ce9c8..0a6c186d 100644 --- a/src/Controller/RequestDataHandler/PaginationDataHandler.php +++ b/src/Controller/RequestDataHandler/PaginationDataHandler.php @@ -31,7 +31,7 @@ public function retrieveData(array $requestData): array return $data; } - private function resolvePage(array $requestData, array & $data): void + private function resolvePage(array $requestData, array &$data): void { $page = 1; @@ -42,7 +42,7 @@ private function resolvePage(array $requestData, array & $data): void $data[self::PAGE_INDEX] = $page; } - private function resolveLimit(array $requestData, array & $data): void + private function resolveLimit(array $requestData, array &$data): void { $limit = $this->defaultLimit; diff --git a/src/Controller/RequestDataHandler/ShopProductListDataHandler.php b/src/Controller/RequestDataHandler/ShopProductListDataHandler.php index 55a749f3..22a8b323 100644 --- a/src/Controller/RequestDataHandler/ShopProductListDataHandler.php +++ b/src/Controller/RequestDataHandler/ShopProductListDataHandler.php @@ -71,7 +71,7 @@ public function retrieveData(array $requestData): array private function handleOptionsPrefixedProperty( array $requestData, - array & $data + array &$data ): void { if (!isset($requestData['options'])) { return; @@ -88,7 +88,7 @@ private function handleOptionsPrefixedProperty( private function handleAttributesPrefixedProperty( array $requestData, - array & $data, + array &$data, ?array $attributesDefinitions = [] ): void { if (!isset($requestData['attributes'])) { diff --git a/src/Model/SearchFacets.php b/src/Model/SearchFacets.php index f138cf0a..f275cf95 100644 --- a/src/Model/SearchFacets.php +++ b/src/Model/SearchFacets.php @@ -34,7 +34,7 @@ public function __set(string $facetId, $selectedBuckets) public function __isset(string $facetId) { - return isset($this->selectedBuckets[$facetId]); + return true; } /** diff --git a/src/Resources/config/services/transformer.xml b/src/Resources/config/services/transformer.xml index 0f91bfc7..bf5a3338 100644 --- a/src/Resources/config/services/transformer.xml +++ b/src/Resources/config/services/transformer.xml @@ -5,7 +5,7 @@ - + diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/packages/security.yaml index 4ed342f8..c81f04ba 100644 --- a/tests/Application/config/packages/security.yaml +++ b/tests/Application/config/packages/security.yaml @@ -45,7 +45,7 @@ security: stateless: true entry_point: jwt json_login: - check_path: "%sylius.security.new_api_admin_route%/authentication-token" + check_path: "%sylius.security.new_api_admin_route%/administrators/token" username_path: email password_path: password success_handler: lexik_jwt_authentication.handler.authentication_success @@ -58,7 +58,7 @@ security: stateless: true entry_point: jwt json_login: - check_path: "%sylius.security.new_api_shop_route%/authentication-token" + check_path: "%sylius.security.new_api_shop_route%/customers/token" username_path: email password_path: password success_handler: lexik_jwt_authentication.handler.authentication_success @@ -116,9 +116,9 @@ security: - { 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_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%/authentication-token", role: PUBLIC_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%/authentication-token", role: PUBLIC_ACCESS } + - { 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.11/bundles.php b/tests/Application/config/sylius/1.11/bundles.php deleted file mode 100644 index b8da49fb..00000000 --- a/tests/Application/config/sylius/1.11/bundles.php +++ /dev/null @@ -1,7 +0,0 @@ - ['all' => 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 80d780cc..00000000 --- a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - url: '%env(MAILER_URL)' \ No newline at end of file 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 cf16fdfe..00000000 --- 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 cf16fdfe..00000000 --- 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/package.json.1.13.x-dev as 1.13.0.dist b/tests/Application/package.json similarity index 100% rename from tests/Application/package.json.1.13.x-dev as 1.13.0.dist rename to tests/Application/package.json 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 9ca35627..00000000 --- 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/Behat/Resources/services/contexts/setup.xml b/tests/Behat/Resources/services/contexts/setup.xml index 5bbd17ca..da958078 100644 --- a/tests/Behat/Resources/services/contexts/setup.xml +++ b/tests/Behat/Resources/services/contexts/setup.xml @@ -12,7 +12,7 @@ - +