[Behat] Update CLI, Domain, Hook and Hybrid context services config from xml to php#18856
Conversation
📝 WalkthroughWalkthroughThis 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
❌ Preview Environment deleted from BunnyshellAvailable commands:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/Sylius/Behat/Resources/config/services/contexts/cli.php (1)
14-18:useimports are not sorted alphabetically.
InstallerContextis listed first; alphabetical order should beCancelUnpaidOrdersContext→ChangeAdminPasswordContext→InstallerContext.♻️ 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
useimports 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:useimports are not sorted alphabetically.Several classes are out of order: e.g.
CalendarContextappears first,BadGatewayContextappears last, andTestThemeConfigurationManagerInterfaceis 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
useimports 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:useimports are not sorted alphabetically.The coding guideline requires alphabetical ordering of PHP
useimports, grouped by type (classes, then functions). Several classes are out of order: e.g.NotificationContextappears first,CartContextappears near the end, andManagingPromotionsContextprecedesManagingPromotionCouponsContext.♻️ 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
useimports 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.
244497a to
5d27266
Compare
Summary by CodeRabbit