Skip to content

[Behat] Update CLI, Domain, Hook and Hybrid context services config from xml to php#18856

Merged
TheMilek merged 4 commits intoSylius:2.3from
NoResponseMate:behat/update-services-definition-to-php-cli-domain-hook-hybrid-contexts
Feb 23, 2026
Merged

[Behat] Update CLI, Domain, Hook and Hybrid context services config from xml to php#18856
TheMilek merged 4 commits intoSylius:2.3from
NoResponseMate:behat/update-services-definition-to-php-cli-domain-hook-hybrid-contexts

Conversation

@NoResponseMate
Copy link
Copy Markdown
Contributor

@NoResponseMate NoResponseMate commented Feb 20, 2026

Q A
Branch? 2.3
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Related tickets partially #18822
License MIT

Summary by CodeRabbit

  • Chores
    • Refactored internal testing configuration for improved maintainability.

@NoResponseMate NoResponseMate requested review from a team as code owners February 20, 2026 15:06
@NoResponseMate NoResponseMate added Behat Issues and PRs aimed at improving Behat usage. Maintenance CI configurations, READMEs, releases, etc. labels Feb 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

This PR migrates Sylius Behat service configurations from XML format to PHP format. Four context configuration files are converted (CLI, Domain, Hook, and Hybrid), with their corresponding imports in the main contexts.xml file updated to reference the new PHP equivalents. Service definitions and dependencies remain functionally identical.

Changes

Cohort / File(s) Summary
Configuration Import Updates
src/Sylius/Behat/Resources/config/services/contexts.xml
Updated four import statements to reference PHP files instead of XML files for cli, domain, hook, and hybrid contexts.
CLI Context Migration
src/Sylius/Behat/Resources/config/services/contexts/cli.php, src/Sylius/Behat/Resources/config/services/contexts/cli.xml
Migrated CLI context service definitions (InstallerContext, CancelUnpaidOrdersContext, ChangeAdminPasswordContext) from XML to PHP configuration.
Domain Context Migration
src/Sylius/Behat/Resources/config/services/contexts/domain.php, src/Sylius/Behat/Resources/config/services/contexts/domain.xml
Migrated 11 domain context service definitions (NotificationContext, ManagingOrdersContext, ManagingPaymentsContext, etc.) from XML to PHP configuration.
Hook Context Migration
src/Sylius/Behat/Resources/config/services/contexts/hook.php, src/Sylius/Behat/Resources/config/services/contexts/hook.xml
Migrated eight hook context service definitions (CalendarContext, DoctrineORMContext, SessionContext, etc.) from XML to PHP configuration.
Hybrid Context Migration
src/Sylius/Behat/Resources/config/services/contexts/hybrid.php, src/Sylius/Behat/Resources/config/services/contexts/hybrid.xml, src/Sylius/Behat/Resources/config/services/contexts/hybrid/setup.xml
Migrated hybrid context service definitions (composite_cart and composite_customer) from XML files to a single PHP configuration file.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • TheMilek

Poem

🐰 XML hops away, PHP takes the stage,
Contexts dance in a cleaner page,
Services spring forth in syntax so bright,
Behat's migration feels just right!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: converting Behat context services configuration from XML to PHP for four specific context types (CLI, Domain, Hook, and Hybrid).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 20, 2026

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/Sylius/Behat/Resources/config/services/contexts/cli.php (1)

14-18: use imports are not sorted alphabetically.

InstallerContext is listed first; alphabetical order should be CancelUnpaidOrdersContextChangeAdminPasswordContextInstallerContext.

♻️ Sorted imports
-use Sylius\Behat\Context\Cli\InstallerContext;
-use Sylius\Behat\Context\Cli\CancelUnpaidOrdersContext;
-use Sylius\Behat\Context\Cli\ChangeAdminPasswordContext;
+use Sylius\Behat\Context\Cli\CancelUnpaidOrdersContext;
+use Sylius\Behat\Context\Cli\ChangeAdminPasswordContext;
+use Sylius\Behat\Context\Cli\InstallerContext;

As per coding guidelines: "Sort PHP use imports alphabetically and group by type (classes, functions, constants)".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Sylius/Behat/Resources/config/services/contexts/cli.php` around lines 14
- 18, Reorder the PHP use imports so they are alphabetized and grouped by type:
place the class imports in alphabetical order as CancelUnpaidOrdersContext,
ChangeAdminPasswordContext, InstallerContext (replace the current order where
InstallerContext is first), and keep the function import service
(Symfony\Component\DependencyInjection\Loader\Configurator\service) in the
separate functions group; update the use block referencing these symbols
(CancelUnpaidOrdersContext, ChangeAdminPasswordContext, InstallerContext,
service) accordingly.
src/Sylius/Behat/Resources/config/services/contexts/hook.php (1)

14-24: use imports are not sorted alphabetically.

Several classes are out of order: e.g. CalendarContext appears first, BadGatewayContext appears last, and TestThemeConfigurationManagerInterface is interleaved mid-list.

♻️ Sorted imports
-use Sylius\Behat\Context\Hook\CalendarContext;
-use Sylius\Behat\Context\Hook\DoctrineORMContext;
-use Sylius\Behat\Context\Hook\SessionContext;
-use Sylius\Behat\Context\Hook\TestThemeContext;
-use Sylius\Bundle\ThemeBundle\Configuration\Test\TestThemeConfigurationManagerInterface;
-use Sylius\Behat\Context\Hook\MailerContext;
-use Sylius\Behat\Context\Hook\CacheContext;
-use Sylius\Behat\Context\Hook\GuestCartContext;
-use Sylius\Behat\Context\Hook\BadGatewayContext;
-use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
-use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
+use Sylius\Behat\Context\Hook\BadGatewayContext;
+use Sylius\Behat\Context\Hook\CacheContext;
+use Sylius\Behat\Context\Hook\CalendarContext;
+use Sylius\Behat\Context\Hook\DoctrineORMContext;
+use Sylius\Behat\Context\Hook\GuestCartContext;
+use Sylius\Behat\Context\Hook\MailerContext;
+use Sylius\Behat\Context\Hook\SessionContext;
+use Sylius\Behat\Context\Hook\TestThemeContext;
+use Sylius\Bundle\ThemeBundle\Configuration\Test\TestThemeConfigurationManagerInterface;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

As per coding guidelines: "Sort PHP use imports alphabetically and group by type (classes, functions, constants)".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Sylius/Behat/Resources/config/services/contexts/hook.php` around lines 14
- 24, The use imports in this file are not alphabetized or grouped by type;
reorder the import block so class imports are sorted alphabetically (e.g.
CalendarContext, CacheContext, DoctrineORMContext, GuestCartContext,
MailerContext, SessionContext, TestThemeContext, BadGatewayContext) and place
the interface TestThemeConfigurationManagerInterface in the correct alphabetical
position among classes, then group and sort function imports (service) and
Symfony/component imports (ContainerConfigurator) separately; update the import
list accordingly to follow the "classes, functions, constants" grouping and
alphabetical ordering.
src/Sylius/Behat/Resources/config/services/contexts/domain.php (1)

14-26: use imports are not sorted alphabetically.

The coding guideline requires alphabetical ordering of PHP use imports, grouped by type (classes, then functions). Several classes are out of order: e.g. NotificationContext appears first, CartContext appears near the end, and ManagingPromotionsContext precedes ManagingPromotionCouponsContext.

♻️ Sorted imports
-use Sylius\Behat\Context\Domain\NotificationContext;
-use Sylius\Behat\Context\Domain\ManagingOrdersContext;
-use Sylius\Behat\Context\Domain\ManagingPaymentsContext;
-use Sylius\Behat\Context\Domain\ManagingPriceHistoryContext;
-use Sylius\Behat\Context\Domain\ManagingProductsContext;
-use Sylius\Behat\Context\Domain\ManagingPromotionsContext;
-use Sylius\Behat\Context\Domain\ManagingPromotionCouponsContext;
-use Sylius\Behat\Context\Domain\SecurityContext;
-use Sylius\Behat\Context\Domain\ManagingShipmentsContext;
-use Sylius\Behat\Context\Domain\CartContext;
-use Sylius\Behat\Context\Domain\ManagingShippingMethodsContext;
-use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
-use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
+use Sylius\Behat\Context\Domain\CartContext;
+use Sylius\Behat\Context\Domain\ManagingOrdersContext;
+use Sylius\Behat\Context\Domain\ManagingPaymentsContext;
+use Sylius\Behat\Context\Domain\ManagingPriceHistoryContext;
+use Sylius\Behat\Context\Domain\ManagingProductsContext;
+use Sylius\Behat\Context\Domain\ManagingPromotionCouponsContext;
+use Sylius\Behat\Context\Domain\ManagingPromotionsContext;
+use Sylius\Behat\Context\Domain\ManagingShipmentsContext;
+use Sylius\Behat\Context\Domain\ManagingShippingMethodsContext;
+use Sylius\Behat\Context\Domain\NotificationContext;
+use Sylius\Behat\Context\Domain\SecurityContext;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

As per coding guidelines: "Sort PHP use imports alphabetically and group by type (classes, functions, constants)".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Sylius/Behat/Resources/config/services/contexts/domain.php` around lines
14 - 26, The PHP imports are not alphabetized: reorder the class imports so they
are sorted alphabetically by fully qualified class name (e.g., CartContext,
ManagingOrdersContext, ManagingPaymentsContext, ManagingPriceHistoryContext,
ManagingProductsContext, ManagingPromotionsContext,
ManagingPromotionCouponsContext, ManagingShipmentsContext,
ManagingShippingMethodsContext, NotificationContext, SecurityContext) and then
place the function import(s) (service) after the class group; adjust the use
statements at the top (including
Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator
and the service() import) to follow the same grouping and alphabetical order.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Sylius/Behat/Resources/config/services/contexts/domain.php`:
- Around line 54-61: The service for ManagingPriceHistoryContext is registered
with its FQCN instead of the project's string ID convention; update the
->set(ManagingPriceHistoryContext::class) call to use the explicit service ID
following the existing pattern (e.g.
'sylius.behat.context.domain.managing_price_history') while leaving the
->args([...]) payload unchanged so the service continues to receive
sylius.repository.channel_pricing_log_entry, sylius.resolver.product_variant and
sylius.remover.channel_pricing_log_entries.

---

Nitpick comments:
In `@src/Sylius/Behat/Resources/config/services/contexts/cli.php`:
- Around line 14-18: Reorder the PHP use imports so they are alphabetized and
grouped by type: place the class imports in alphabetical order as
CancelUnpaidOrdersContext, ChangeAdminPasswordContext, InstallerContext (replace
the current order where InstallerContext is first), and keep the function import
service (Symfony\Component\DependencyInjection\Loader\Configurator\service) in
the separate functions group; update the use block referencing these symbols
(CancelUnpaidOrdersContext, ChangeAdminPasswordContext, InstallerContext,
service) accordingly.

In `@src/Sylius/Behat/Resources/config/services/contexts/domain.php`:
- Around line 14-26: The PHP imports are not alphabetized: reorder the class
imports so they are sorted alphabetically by fully qualified class name (e.g.,
CartContext, ManagingOrdersContext, ManagingPaymentsContext,
ManagingPriceHistoryContext, ManagingProductsContext, ManagingPromotionsContext,
ManagingPromotionCouponsContext, ManagingShipmentsContext,
ManagingShippingMethodsContext, NotificationContext, SecurityContext) and then
place the function import(s) (service) after the class group; adjust the use
statements at the top (including
Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator
and the service() import) to follow the same grouping and alphabetical order.

In `@src/Sylius/Behat/Resources/config/services/contexts/hook.php`:
- Around line 14-24: The use imports in this file are not alphabetized or
grouped by type; reorder the import block so class imports are sorted
alphabetically (e.g. CalendarContext, CacheContext, DoctrineORMContext,
GuestCartContext, MailerContext, SessionContext, TestThemeContext,
BadGatewayContext) and place the interface
TestThemeConfigurationManagerInterface in the correct alphabetical position
among classes, then group and sort function imports (service) and
Symfony/component imports (ContainerConfigurator) separately; update the import
list accordingly to follow the "classes, functions, constants" grouping and
alphabetical ordering.

@NoResponseMate NoResponseMate force-pushed the behat/update-services-definition-to-php-cli-domain-hook-hybrid-contexts branch from 244497a to 5d27266 Compare February 23, 2026 12:13
@TheMilek TheMilek merged commit c24f1da into Sylius:2.3 Feb 23, 2026
29 of 35 checks passed
@NoResponseMate NoResponseMate deleted the behat/update-services-definition-to-php-cli-domain-hook-hybrid-contexts branch February 23, 2026 13:40
@NoResponseMate NoResponseMate mentioned this pull request Feb 26, 2026
27 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Behat Issues and PRs aimed at improving Behat usage. Maintenance CI configurations, READMEs, releases, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants