Skip to content

Commit

Permalink
Upgrade for Sylius 1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Jul 29, 2024
1 parent a6e4e32 commit d69f7e1
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 37 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ "8.2" ]
php: [ "8.2", "8.3" ]
symfony: [ "^6.4" ]
sylius: [ "^1.12" ]
node: [ "16.x" ]
sylius: ["1.12.16", "^1.13"]
node: [ "18.x" ]
mysql: [ "8.0" ]

env:
Expand All @@ -46,7 +46,7 @@ jobs:

-
name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node }}"

Expand Down Expand Up @@ -77,14 +77,18 @@ jobs:
name: Run webserver
run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon)

-
name: Validate composer.json
run: composer validate --ansi --strict

-
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
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
Expand Down Expand Up @@ -121,7 +125,7 @@ jobs:

-
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') }}
Expand Down Expand Up @@ -152,10 +156,6 @@ jobs:
name: Load fixtures in test application
run: (cd tests/Application && bin/console sylius:fixtures:load -n)

-
name: Validate composer.json
run: composer validate --ansi --strict

-
name: Validate database schema
run: (cd tests/Application && bin/console doctrine:schema:validate)
Expand Down
39 changes: 20 additions & 19 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ default:

extensions:
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~
Robertfausk\Behat\PantherExtension: ~

FriendsOfBehat\MinkDebugExtension:
directory: etc/build
Expand All @@ -21,32 +22,30 @@ 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: chromedriver
sessions:
symfony:
symfony: ~
chrome_headless:
chromedriver:
chrome:
api_url: http://127.0.0.1:9222
validate_certificate: false
chrome:
selenium2:
browser: chrome
capabilities:
browserName: chrome
browser: chrome
version: ""
marionette: null # https://github.com/Behat/MinkExtension/pull/311
chrome:
switches:
- "start-fullscreen"
- "start-maximized"
- "no-sandbox"
extra_capabilities:
chrome_headless_second_session:
chrome:
api_url: http://127.0.0.1:9222
validate_certificate: false
panther:
panther:
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:
Expand All @@ -59,3 +58,5 @@ default:
FriendsOfBehat\SuiteSettingsExtension:
paths:
- "features"

SyliusLabs\SuiteTagsExtension: ~
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"license": "MIT",
"require": {
"php": "^8.2",
"sylius/mailer-bundle": "^2.0",
"sylius/sylius": "^1.12",
"symfony/webpack-encore-bundle": "^1.17"
},
"require-dev": {
"behat/behat": "^3.13",
"behat/mink-selenium2-driver": "^1.6",
"dbrekelmans/bdi": "^1.1",
"dmore/behat-chrome-extension": "^1.4",
"dmore/chrome-mink-driver": "^2.9.2",
"friends-of-behat/mink": "^1.10",
Expand All @@ -32,9 +32,11 @@
"phpstan/phpstan-doctrine": "1.3.16",
"phpstan/phpstan-strict-rules": "^1.5.2",
"phpstan/phpstan-webmozart-assert": "^1.2.4",
"phpunit/phpunit": "^9.6.15",
"phpunit/phpunit": "^9.6 || ^10.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0.7",
"robertfausk/behat-panther-extension": "^1.1",
"sylius-labs/coding-standard": "^4.3.1",
"sylius-labs/suite-tags-extension": "^0.2",
"symfony/browser-kit": "^6.4 || ^7.0",
"symfony/debug-bundle": "^6.4 || ^7.0",
"symfony/dotenv": "^6.4 || ^7.0.2",
Expand Down
7 changes: 5 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ includes:
parameters:
level: max
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
paths:
- src

excludes_analyse:
excludePaths:
# Makes PHPStan crash
- 'src/DependencyInjection/Configuration.php'

Expand All @@ -17,4 +16,8 @@ parameters:
- 'tests/Application/src/**.php'

ignoreErrors:
-
identifier: missingType.iterableValue
-
identifier: missingType.generics
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
3 changes: 2 additions & 1 deletion src/CommandHandler/Wishlist/AddProductToWishlistHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use BitBag\SyliusWishlistPlugin\Exception\ProductNotFoundException;
use BitBag\SyliusWishlistPlugin\Factory\WishlistProductFactoryInterface;
use Doctrine\Persistence\ObjectManager;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Repository\ProductRepositoryInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;

Expand Down Expand Up @@ -43,7 +44,7 @@ public function __invoke(AddProductToWishlist $addProductToWishlist): WishlistIn
$product = $this->productRepository->find($productId);
$wishlist = $addProductToWishlist->getWishlist();

if (null === $product) {
if (!$product instanceof ProductInterface) {
throw new ProductNotFoundException(
sprintf('The Product %s does not exist', $productId),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use BitBag\SyliusWishlistPlugin\Exception\ProductVariantNotFoundException;
use BitBag\SyliusWishlistPlugin\Factory\WishlistProductFactoryInterface;
use Doctrine\Persistence\ObjectManager;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Sylius\Component\Core\Repository\ProductVariantRepositoryInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;

Expand Down Expand Up @@ -43,7 +44,7 @@ public function __invoke(AddProductVariantToWishlist $addProductVariantToWishlis
$variant = $this->productVariantRepository->find($variantId);
$wishlist = $addProductVariantToWishlist->getWishlist();

if (null === $variant) {
if (!$variant instanceof ProductVariantInterface) {
throw new ProductVariantNotFoundException(
sprintf('The ProductVariant %s does not exist', $variantId),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use BitBag\SyliusWishlistPlugin\Exception\WishlistNotFoundException;
use BitBag\SyliusWishlistPlugin\Repository\WishlistRepositoryInterface;
use Doctrine\Persistence\ObjectManager;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Sylius\Component\Core\Repository\ProductVariantRepositoryInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
Expand Down Expand Up @@ -52,7 +53,7 @@ public function __invoke(RemoveProductVariantFromWishlist $removeProductVariantF

$wishlist = $this->wishlistRepository->findByToken($token);

if (null === $variant || null === $wishlistProduct) {
if (!$variant instanceof ProductVariantInterface || null === $wishlistProduct) {
throw new ProductVariantNotFoundException(
sprintf('The Product %s does not exist', $variantId),
);
Expand Down
7 changes: 6 additions & 1 deletion tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

return [
$bundles = [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Expand Down Expand Up @@ -59,3 +59,8 @@
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
];
if (class_exists(Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class)) {
$bundles[Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class] = ['all' => true];
}

return $bundles;

0 comments on commit d69f7e1

Please sign in to comment.