Sylius 2 - #2
Open
LucaGallinari wants to merge 60 commits into
Open
Conversation
- sylius/sylius ^2.0 replaces the individual sylius/* 1.x packages - symfony/* bumped to ^6.4||^7.4, doctrine/orm ^2.18||^3.3, doctrine/collections ^2.2 - adds sylius/test-application, drops jms/serializer-bundle - phpunit/behat bootstrap updated to the new test-application kernel
Plugin-specific overrides (entity models, repositories, config, template overrides) now live under tests/TestApplication/, wired via the SYLIUS_TEST_APP_BUNDLES_REPLACE_PATH/CONFIGS_TO_IMPORT/ROUTES_TO_IMPORT env vars read by Sylius\TestApplication\Kernel. The plugin bundle must still be registered before SyliusGridBundle, so bundles.php is a full replacement list (not the additive BUNDLES_PATH mechanism) to preserve that order.
Sylius 2 defaults to the symfony_workflow state machine adapter; the winzou_state_machine config this plugin relied on is no longer loaded. Replaced the 3 winzou callback yaml files with 4 kernel.event_listener services on workflow.<graph>.completed.<transition> events, following Sylius core's own EventListener\Workflow pattern. Added send() to OrderGiftCardOperatorInterface since the listener needs it.
Per decision: this plugin does not need to migrate/expose its own ApiPlatform API in Sylius 2 (ApiPlatform 2.x -> 4 would have required a full rewrite of DataPersister/DataTransformer/api_resources XML). Removed src/Api/**, api_resources config, the api-specific DI services, dead serialization/validation config for the deleted commands, and the corresponding Unit/Behat API test suites. GiftCardContext (Behat setup step) now calls GiftCardApplicatorInterface directly instead of dispatching the removed AddGiftCardToOrder command, since the shop UI "apply gift card" flow never went through that command in the first place.
The sylius_ui "events" block system (SonataBlock-style) was removed in Sylius 2 in favor of sylius/twig-hooks. Ported the add-to-cart gift card fields and the cart summary applied-gift-cards block to twig hooks (hookable_metadata.context.* accessor pattern). The admin CRUD javascripts and shop account gift card index hooks still need porting - left as TODO in app/config.yaml since they used the removed block system too.
…the container - AddAdjustmentsToOrderAdjustmentClearerPass: the order adjustments clearer argument is now the %sylius.order_processing.adjustment_clearing_types% container parameter, not a mutable service-definition argument - renamed service ids: sylius.image_uploader -> sylius.uploader.image, sylius.money_formatter -> sylius.formatter.money, sylius.product_variant_resolver.default -> sylius.resolver.product_variant.default - GiftCardFactory: Sylius\Bundle\ShippingBundle\Provider\DateTimeProvider was removed; replaced with Symfony\Component\Clock\ClockInterface - GiftCardNormalizer/GiftCardConfigurationNormalizer: Symfony 7 removed ContextAwareNormalizerInterface, methods merged into NormalizerInterface (which now requires getSupportedTypes())
Symfony 7 / the plugin's Doctrine setup no longer registers the doctrine/annotations reader, so the old @Orm docblock annotations on ProductTrait/OrderTrait/OrderItemUnitTrait were silently ignored - verified via doctrine:schema:create, which produced sylius_product without the giftCard/giftCardAmountConfigurable columns and no setono_sylius_gift_card__order_gift_cards join table. Both are present after converting to attributes.
- psalm.xml: ignore tests/TestApplication instead of tests/Application, drop suppressions for the removed ApiPlatform interfaces, add scoped suppressions for Configuration.php's NodeBuilder generic invariance and the deprecated XmlFileLoader - psalm-baseline.xml: drop the single entry, it was for the now-deleted ApiPlatform upload action - CancelOrderGiftCardListener: assert against the plugin's own OrderInterface (needed by OrderGiftCardAmountModifierInterface), not Sylius core's - GiftCardFactory: assert clock->now()->modify() didn't return false - normalizers: NormalizerInterface requires the first param be named $data - StringFieldType/GiftCardVoter: add missing param types (mixed) - GiftCardConfigurationRepository: QueryBuilder::setParameters() now requires an ArrayCollection<int, Parameter>, not an associative array - switched to chained setParameter() calls
…moval - Renamed Tests\Application\Model\* references to Tests\TestApplication\Entity\* across the Unit suite, following the tests/TestApplication move - GiftCardFactoryTest: replaced Sylius\Bundle\ShippingBundle\Provider\Calendar/ DateTimeProvider (removed in Sylius 2) with Symfony\Component\Clock\MockClock 2 pre-existing failures in AddToCartTypeExtensionTest are left as-is: the test mocks getProduct()/getVariant() calls that don't match what AddToCartTypeExtension actually calls today (getVariant()?->getProduct()) - confirmed via `git diff 0.12.x` that neither the test nor the source under test changed in this migration, so this is a pre-existing staleness bug, not something introduced by the Sylius 2 upgrade.
…arget Replaces the old coding-standards/dependency-analysis/static-code-analysis/ unit-tests/integration-tests/code-coverage job matrix (PHP 8.1-8.2 x Symfony 5.4/6.4 x lowest/highest deps) with a single job/matrix-cell modeled on SyliusMailchimpPlugin's build.yml: pins Symfony via extra.symfony.require and Sylius via a direct composer require, runs ecs/psalm/phpspec/phpunit/behat in sequence, uses mirromutth/mysql-action instead of the runner's preinstalled MySQL, and boots the app via vendor/sylius/test-application's own yarn assets. Removed composer-require-checker.json/composer-unused.php - only used by the now-removed dependency-analysis job.
sylius_template_event was the Twig function backing the removed SonataBlock-style sylius_ui events system - it no longer exists in Sylius 2. Removed the 3 calls in the shop account gift card index views. Also removed the shipped templates/bundles/SyliusShopBundle/Cart/summary.html.twig reference override: it's the full Sylius 1.x cart summary template (superseded by the sylius_shop.cart.index.content.form.sections.general.summary twig hook added earlier) and its sylius_template_event() call made it fail lint:twig too.
compose.yml (php/mysql/nginx/chrome/chrome-proxy/mailhog), compose.override.dist.yml (dev overrides: xdebug, port 80 for nginx, node build), compose.test.yml (APP_ENV=test for behat.sh). Same images/ports as the Mailchimp plugin, just renamed the MySQL volume and DATABASE_URL to this plugin's db name.
…port 33062 - .gitignore now matches SyliusMailchimpPlugin's: /docker/, behat.sh and compose.test.yml are local dev conveniences, not meant to be committed - compose.override.dist.yml rewritten to match Mailchimp's actual (not the stale dist template) compose.override.yml: sylius-php:8.4-xdebug-alpine, working_dir /app, node service for asset building, nginx on 8081 - MySQL port default changed to 33062 - generated the real (gitignored) compose.override.yml from the dist file
Follows SyliusMailchimpPlugin's layout: config/, templates/, translations/,
public/ and fixtures/ now live as siblings of src/ at the repo root,
instead of nested under src/Resources/{config,views,translations,...}
(the Sylius 1.x convention). src/ is now pure PHP.
- SetonoSyliusGiftCardPlugin::getPath() now returns the repo root (was
the default: the directory containing the bundle class, i.e. src/)
- getConfigFilesPath() overridden to config/doctrine/model, since
Sylius\Bundle\ResourceBundle\AbstractResourceBundle hardcodes the
"Resources/config/doctrine" segment when computing where to look for
the plugin's own Doctrine ORM mapping - this plugin uses
AbstractResourceBundle (registerResources()) unlike Mailchimp's plain
Bundle, so this override is needed on top of the getPath() change
- every "@SetonoSyliusGiftCardPlugin/Resources/..." reference (imports in
config/*.yaml, tests/TestApplication/config/*) had the "Resources/"
segment stripped; SetonoSyliusGiftCardExtension's FileLocator path
updated from "../Resources/config" to "../../config"
- verified: container lints, doctrine:schema:create still produces the
gift-card tables/columns (getConfigFilesPath override works), ecs/psalm
clean, phpunit/phpspec results unchanged from before the move
Also fixed a real bug this move introduces: Symfony's assets:install
command defaults its target to a relative "public" dir checked against
the CURRENT WORKING DIRECTORY, not kernel.project_dir - since the plugin
repo root now itself contains a public/ dir, running the command from
the repo root (as CI does) would self-pollute it with a symlink loop
instead of installing into vendor/sylius/test-application/public. Fixed
by passing the target explicitly in build.yaml.
README.md paths updated to match; dropped the stale "Api platform
support" section and "Copy Api Resources" instructions (ApiPlatform was
already removed earlier in the migration). CLAUDE.md rewritten to
describe the current Sylius 2 architecture instead of the pre-migration
Sylius 1.x/ApiPlatform one.
…ugin vendor/bin/console is the only real console binary (this plugin has no root app), but plain `bin/console` is the conventional entry point people expect (e.g. dcrp bin/console). bin/create_console_symlink.php recreates the symlink on post-install-cmd/post-update-cmd.
Not used anywhere (no infection.json, not run in composer scripts or CI). It was the source of the "Safe\gmdate()/mktime(): Implicitly marking parameter as nullable is deprecated" warnings on PHP 8.4 - it pulls in thecodingmachine/safe, which was never updated for PHP 8.4's implicit- nullable-parameter deprecation.
Host apps use doctrine:migrations:migrate, not doctrine:schema:create - without this, installing the plugin left the mapped entities with no matching tables (as seen: "Table ...__order_gift_cards doesn't exist" even after running the app's own migrations). Generating migrations at install time (e.g. asking the host app to run doctrine:migrations:diff) would be the actual bad practice - it produces different SQL depending on the app's exact prior state, DBAL version, and platform. The correct pattern (same one SyliusMailchimpPlugin uses) is for the plugin to ship a pre-written migration and register it into the host app's migration chain automatically via Sylius\Bundle\CoreBundle\DependencyInjection\PrependDoctrineMigrationsTrait, ordered to run after Sylius\Bundle\CoreBundle\Migrations. Version20260729000001 creates the 5 gift-card tables and adds the two gift-card columns to sylius_product. The exact DDL (column types, index/ FK constraint names) was generated via doctrine:schema:create --dump-sql against real MySQL 8.4 rather than hand-written, then verified by running it against a real dev database and confirming doctrine:schema:validate shows no drift attributable to it (the one remaining diff is pre-existing messenger_messages index naming, unrelated to this plugin).
…resolution
- .editorconfig: adopt the standard Symfony/Sylius-plugin template
- .gitignore: add /drivers/, /phpunit.xml (matching Mailchimp)
- assets/{admin,shop}: Webpack Encore entrypoint scaffolding
- tests/TestApplication: import packages/*.yaml, add dev monolog config
composer.json: re-added the runtime/dev dependencies this plugin actually
needs that got dropped during the alignment (sylius/grid-bundle,
sylius/resource-bundle, sylius/mailer-bundle, doctrine/orm|dbal|
collections|persistence, doctrine/doctrine-bundle, lexik/jwt-
authentication-bundle, babdev/pagerfanta-bundle, the symfony/* components
this plugin's own src/ code directly imports) - Mailchimp doesn't need
these since it isn't a Sylius resource-bundle plugin and has a much
smaller direct Symfony surface.
Fixed two real dependency resolution failures surfaced while reconciling:
- psalm/plugin-phpunit ^0.20.2 (needed for vimeo/psalm ^6.13, Mailchimp's
version) requires psalm/psalm-plugin-api, which conflicts with psalm
<7.0 - no stable psalm 7 exists yet. Reverted to psalm/plugin-phpunit
^0.18.4 (pulls psalm ^5.x, still compatible with weirdan/doctrine-
psalm-plugin) and dropped the vimeo/psalm ^6.13 pin; also removed
psalm.xml's phpVersion="8.4" since psalm 5.x doesn't recognize that
version string.
- extra.symfony.require: "^7.4" made Composer's native symfony-version
restriction reject every friends-of-behat/mink-extension release that
doesn't explicitly declare a ^7.4-compatible symfony/config (i.e. every
release before v2.7.5), producing an unsatisfiable set even though our
own per-package ranges were broad enough. Removed it - the CI workflow
already sets it dynamically via `composer config extra.symfony.require`
before install, so nothing is lost there. Also added explicit requires
for friends-of-behat/mink-extension and its siblings (mirroring
Mailchimp) so the solver can't wander into pre-2.7 releases at all.
- dropped setono/sylius-behat-pack (unused, last released 2021, was
pinning an ancient friends-of-behat/mink fork via its own requirements)
Verified after reconciliation: composer install succeeds fresh, container
lints, ecs/psalm clean, phpunit/phpspec results unchanged (same 2+9
pre-existing unrelated failures as before this session).
symfony/type-info 7.4.0 added stricter validation in UnionType::__construct() that rejects unions combining the "object" builtin type with a concrete class (Cannot create union with both "object" and class type). ApiPlatform hits this while computing resource identifier metadata for Sylius's own API resources, crashing the app on every request (not just API calls, since Sylius's API routes are always imported as part of default routing) - see Sylius/Sylius#18878. The linked fix (PR Sylius/Sylius#18904) only cleaned up the 2 occurrences that specific reporter hit; verified those are indeed present in our installed sylius/sylius 2.2.7, but at least one more (unidentified) occurrence still triggers the crash for us. Since upstream hasn't done an exhaustive cleanup yet, pin symfony/type-info to the last version before the stricter check (>=7.2 <7.4), matching the issue's suggested temporary fix. symfony/property-info also pinned to ^7.3 since 7.4.15 forces type-info ^7.4.7 - resolves to symfony/property-info 7.4.6, which is still compatible with type-info 7.3. Verified: container lints, debug:router sylius_api loads cleanly, boots in the real docker app (500 -> 302). ecs/psalm/phpunit/phpspec unchanged.
…shop pages) Two separate issues surfaced on the shop homepage (/en_US/): 1. Webpack Encore assets were never built for vendor/sylius/test-application (no entrypoints.json). Built them via yarn install/build and re-ran assets:install with an explicit target (same footgun as the earlier assets:install fix - our own public/ dir shadows the default target resolution when run from the plugin's repo root). 2. symfony/framework-bundle and symfony/twig-bundle had resolved to v6.4.x while the rest of the stack (http-kernel, translation, messenger, etc.) was on v7.4.x, because our composer.json's "^6.4 || ^7.4" ranges let the solver pick either branch per-package independently, and removing extra.symfony.require earlier (to fix the mink-extension conflict) took away the mechanism that used to force them to agree. A 6.4 framework- bundle doesn't wire up symfony/type-info's LiveComponent integration, so any Twig Hook rendering a Live Component (e.g. the shop header) crashed with "Symfony TypeInfo is required to use LiveProps.". Fixed by explicitly requiring symfony/framework-bundle, symfony/twig- bundle and symfony/translation at ^7.4, and tightening every other "^6.4 || ^7.4" symfony/* requirement to plain ^7.4, removing the possibility of the solver drifting back onto the 6.4 branch for any of them. Also pinned sylius-labs/doctrine-migrations-extra-bundle to ^0.2.2 (the only release compatible with framework-bundle 7.4) since sylius/sylius's own "^0.2" range let the solver wander into ancient 0.2.0/0.2.1 otherwise. This in turn made psalm/plugin-phpunit unusable: it pins vimeo/psalm to 4.x/5.x, which needs nikic/php-parser ^4.x, but symfony/translation 7.4 conflicts with nikic/php-parser <5.0. Since psalm/plugin-phpunit only helps analyze tests/ (excluded from psalm.xml's scanned paths already), dropped it and moved to vimeo/psalm ^6.13 + psalm/plugin- symfony ^5.2 + weirdan/doctrine-psalm-plugin ^2.10 (all psalm-6- compatible), matching SyliusMailchimpPlugin's psalm major version. Verified: composer install resolves cleanly, framework-bundle/twig-bundle/ translation/type-info all consistent, container lints, real docker app now returns 200 on /en_US/ (was 500).
…pages The admin gift-cards index, its grid actions/fields, and the balance page still referenced Sylius 1.x template and macro paths (@SyliusAdmin/Crud, @SyliusUi/Macro/buttons.html.twig, @SyliusAdmin/Common/Macro/money.html.twig, PascalCase grid field paths) that no longer exist in Sylius 2's admin theme. Updated grid configs and templates to the current paths/idioms, and rewrote the balance page and grid action buttons using Sylius 2's Bootstrap/Tabler layout instead of the removed Semantic-UI helpers. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CustomerAutocompleteChoiceType was still built on Sylius 1.x's ResourceAutocompleteChoiceType/Choices.js widget, wiring view variables (remote_url, load_edit_url) that Sylius 2's admin form theme no longer reads. The field silently fell back to a plain text input instead of an autocomplete select. Rewritten to use Symfony UX Autocomplete (Tom Select) via BaseEntityAutocompleteType, matching how Sylius 2 core implements its own entity pickers (ProductAutocompleteType, TaxonAutocompleteType, etc.), searching on email/firstName/lastName. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
setono_sylius_gift_card_admin_ajax_customer_by_email(_phrase) backed the old Choices.js customer autocomplete. Now that the customer field uses Symfony UX Autocomplete's generic entity-autocomplete endpoint, these routes are unused. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The "enter a gift card code" form existed (controller, form type, route) but was never wired into Sylius 2's twig-hooks system after the Sylius 1 block-based UI was dropped, so nothing rendered it on the cart page. Registering it as a hookable inside sections.general#left (alongside the promotion coupon field) didn't work: Sylius 2's whole cart page content is now one big form (a Symfony UX Live Component), and nested <form> elements are invalid HTML, so the browser silently dropped ours and the button did nothing. Hooking it at the parent 'sylius_shop.cart.index.content' level instead keeps our own <form> a sibling of, not nested inside, the cart form. Also simplified AddGiftCardToOrderAction to redirect with a flashed error on invalid submission instead of returning a bare template fragment (which only made sense for the old AJAX-based submission flow), so the field now works with a plain form POST and needs no JavaScript. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ision
The grid extends sylius_admin_order, whose own repository.arguments is
{ criteria: $criteria }. Grid "extends" deep-merges config by key
(GridConfigurationExtender uses array_replace_recursive), so our
different key ("giftCard") didn't replace the parent's "criteria" entry,
it added a second one. The ORM driver then spreads arguments positionally
into the repository method call, so $criteria (null, since no ?criteria=
query param is ever sent) landed on the method's only parameter instead
of $id, and giftCard/$id was silently dropped.
Reusing the parent's key name makes our value replace it instead of
appending, since PHP calls the method with array_values() of the merged
map.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The order summary "gift cards" row existed only as an old Sylius 1.x bundle-template override (templates/bundles/SyliusAdminBundle/Order/Show/ Summary/_totals.html.twig), at a path that no longer matches anything Sylius 2 loads — order summary rendering moved entirely to twig-hooks, so the override was silently dead. Neither the admin order view nor the shop "my account" order view showed that a gift card had been applied, even though the adjustment itself was correctly persisted and already reflected in the order total. Added proper hookables for both: - admin: 'sylius_admin.order.show.content.sections.summary', alongside core's own items_total/tax_total/shipping_total/promotion_total rows. - shop: 'sylius_shop.shared.order.show.summary.table_summary', the component shared between the account order view and other order-show contexts, alongside core's subtotal/taxes/discount/shipping/total rows. Verified live: admin order Setono#21 now shows "Gift cards: $400.00" with the originating code and the correct order total ($38.07) already accounted for. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The page extended @SyliusShop/Account/layout.html.twig and rendered via @SyliusShop/Grid/_default.html.twig, neither of which exists in Sylius 2 — account pages moved to a hook-based layout and grids render through @SyliusShop/shared/grid.html.twig. Rebuilt the page on that pattern (mirroring core's account/order/index page) with its own hook group, and fixed the two grid field templates' money macro import path. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The "templates: form: ..." route var was a dead Sylius 1.x mechanism:
Sylius 2's generic "default" hookable for CRUD forms just does
form_widget(hookable_metadata.context.form), ignoring that var entirely.
Our custom _form.html.twig partials were never actually being rendered;
Sylius silently fell back to default field-by-field rendering instead.
Registered explicit hooks (sylius_admin.gift_card.update / gift_card_
configuration.{create,update}.content.form.sections.general) pointing
at our own templates, and switched them to read form/resource via
hookable_metadata.context (bare "form"/"resource" aren't defined in this
render context, unlike the old resource-CRUD template style).
Also modernized both templates to Bootstrap markup, replaced the missing
@SyliusAdmin/Form/imagesTheme.html.twig (removed in Sylius 2) with a
self-contained form theme, replaced the jQuery live-PDF-preview handler
with a small inline vanilla-JS listener, and removed the always-hidden
send-notification-email toggle in favor of a plain visible checkbox
(its jQuery show/hide script depended on Semantic UI dropdown internals
that no longer exist). Deleted the now-dead JS assets and the three
_javascripts.html.twig glue templates that loaded them via the removed
sylius_ui event-block system.
Verified live: both forms render correctly. The configuration form's PDF
preview embed further requires the wkhtmltopdf binary, which isn't
installed in this dev container — a separate, pre-existing environment
gap, not a template issue.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The custom create route had no resource-specific hook prefix so the "default" form hookable was never overridden, silently falling back to plain field rendering. Also drop the dead breadcrumb templates left over from the removed Sylius 1.x route vars.
Fixed broken @SyliusShop/layout.html.twig extends and PascalCase macro/form-theme paths (dead in Sylius 2), rewrote Semantic UI markup to Bootstrap 5.
Extended the removed @SyliusAdmin/Email/layout.html.twig (wrong case, and wrong bundle for a customer-facing email) and imported the money macro from its dead Sylius 1.x path.
config/routes/admin_api.yaml doesn't exist - the ApiPlatform layer was dropped during the Sylius 2 migration and is intentionally out of scope.
<i class="..."> icon classes rendered nothing under Bootstrap 5, since the Semantic UI icon font was removed in the Sylius 2 migration.
Pointed to a nonexistent CSS template and was never read anywhere in the codebase.
Matches the double-quoted style used elsewhere for strings containing backslash escapes in this project's YAML files.
Both templates/bundles/SyliusShopBundle/** and tests/TestApplication/templates/bundles/** used PascalCase paths and sylius_template_event() calls that no longer exist in Sylius 2 core - none of these paths are ever requested by current core templates, and the function isn't even defined anymore. The gift-card functionality they used to inject is already covered by twig-hooks in config/sylius_ui.yaml and templates/Admin|Shop/Order/Show/Summary/.
Deleting the dead templates/bundles subtree emptied and removed this directory entirely, but Symfony's Twig config hardcodes it as default_path and requires it to exist on disk, breaking every page.
KnpSnappyBundle checks is_executable() directly on the configured binary string rather than resolving it against PATH, so the bare "wkhtmltopdf" default always failed with "is not executable" even with the binary installed and on PATH.
ProductTypeExtension added the giftCard and giftCardAmountConfigurable fields to the form, but no twig-hook rendered them anywhere, so there was no way to mark a product as a gift card from the admin panel.
api.xml imported api/clients.xml, a directory that no longer exists since the ApiPlatform layer was dropped - this made Behat fail to boot at all, before running a single scenario.
Sylius 2 added a required AutocompleteHelperInterface argument to CreateSimpleProductPage::__construct(), but this service definition was never updated to pass it, crashing every scenario using it.
sylius.behat.context.hook.email_spool was renamed to sylius.behat.context.hook.mailer in Sylius 2, breaking the ui_buying_gift_card suite.
Symfony's error handler turns this deprecation into a thrown exception during tests, which crashed the shop product show page (GiftCardInformation) at runtime under PHP 8.4.
Sylius 2's price transform strictly requires 2 decimal digits
("$100.00", not "$100"), rejecting every gift-card monetary value in
these fixtures with an InvalidArgumentException.
Also tag the configurable-gift-card add-to-cart scenario with
@mink:chromedriver: the shop product page's add-to-cart form is a
Symfony UX LiveComponent with no fallback <form action>, so it only
works under a JS-capable session - submitting it via the plain HTTP
session POSTs back to the GET-only product page and 405s.
render(controller()) inside a twig-hooks hookable dispatches a real HttpKernel sub-request, and its kernel.request/response cycle opens and closes a Stopwatch section via TraceableEventDispatcher - under debug mode this leaves the outer hookable's own profiler event unstoppable, crashing every cart page load with "Event ... is not started." The form only ever needs to be built for display here (it always posts to its own dedicated route directly, never through this fragment), so build it in-process via a Twig runtime function instead of going through a full sub-request.
These 14 feature files were entirely @api-tagged with no @ui counterpart, and no @api step context has existed in this plugin since ApiPlatform was dropped during the Sylius 2 migration - they were dead weight that could never run (missing suites, since writing one for them would still select zero scenarios). Also dropped the lone @api scenario from the two mixed @ui/@api files, keeping their working @ui scenario.
These 3 scenarios' steps never matched any registered step regex
("I name it ... in ... locale", "I have product ... added to the
cart", "I proceed with selecting ... payment method"), so Behat
reported them as undefined instead of running them.
The gift-card checkbox's element id is #sylius_admin_product_giftCard in Sylius 2 (form name changed from sylius_product to sylius_admin_product), not the old #sylius_product_giftCard.
Not worth keeping: it only enforces a cosmetic composer.json key ordering and pulls in a third-party Composer plugin (arbitrary code execution during composer install/update) for no real benefit. ergebnis/composer-normalize stays in the dependency tree (required transitively by setono/code-quality-pack) but is now disabled via allow-plugins so it never runs.
phpspec/phpspec ^7.4 caps out at PHP 8.3, breaking composer install on CI's PHP 8.4 runner. phpspec 8.x runs the existing specs identically (same 28 passed / 9 pre-existing broken).
GiftCardApplicator dropped its ObjectManager dependency (the caller flushes) but the spec still injected one, and never stubbed isEnabled()/isExpired(), which apply() checks before proceeding - Prophecy's default null return violated their bool return type.
GiftCardEmailManager gained a PdfRendererInterface and cache dir argument (to attach the PDF to the email), but the spec's beConstructedWith() and the send() assertion were never updated to match.
OrderGiftCardAmountModifier no longer takes a constructor argument (it derives everything from the order passed to decrement()/ increment()), but the spec still tried to construct it with one.
populateCartItem() reads the product through $cartItem->getVariant()->getProduct(), not $cartItem->getProduct() directly, but the tests still stubbed the old direct call.
The hardcoded /usr/local/bin/wkhtmltopdf path only existed in the local Docker image (a custom layer added on top of the base PHP image) - the bare ubuntu-latest GitHub Actions runner has no wkhtmltopdf at all, so any Behat scenario rendering a gift card PDF failed with "the binary is not executable". Made the binary paths configurable via KNP_SNAPPY_PDF_BINARY/ KNP_SNAPPY_IMAGE_BINARY env vars, defaulting to the standard apt install location, and added a CI step to apt-get install wkhtmltopdf. Local Docker keeps overriding to its own /usr/local/bin path via compose.override.yml (gitignored).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.