Skip to content

[Behat][Shop] Update pages config from xml to php#18859

Merged
TheMilek merged 1 commit intoSylius:2.3from
NoResponseMate:behat/update-services-definition-to-php-shop-pages
Feb 23, 2026
Merged

[Behat][Shop] Update pages config from xml to php#18859
TheMilek merged 1 commit intoSylius:2.3from
NoResponseMate:behat/update-services-definition-to-php-shop-pages

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

  • Refactor
    • Restructured internal testing configuration from XML to PHP format. This is a technical improvement with no impact on application functionality or user experience.

@NoResponseMate NoResponseMate requested review from a team as code owners February 20, 2026 16:25
@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 Symfony Dependency Injection service configurations for Behat test pages from XML to PHP format. All XML definition files for shop page objects (account, checkout, contact, order, payment request, product) and test plugin pages are replaced with equivalent PHP configuration files.

Changes

Cohort / File(s) Summary
Main Configuration
src/Sylius/Behat/Resources/config/services/pages.xml
Updated import directives to reference PHP configuration files instead of XML files for shop and test_plugin page modules.
Shop Page Configurations
src/Sylius/Behat/Resources/config/services/pages/shop.php, src/Sylius/Behat/Resources/config/services/pages/shop.xml
Migrated shop page service definitions from XML to PHP, including base page, cart summary, and home page services.
Account Page Services
src/Sylius/Behat/Resources/config/services/pages/shop/account.php, src/Sylius/Behat/Resources/config/services/pages/shop/account.xml
Converted 15 account-related page service definitions and their parameters from XML to PHP format with constructor dependency injection where applicable.
Checkout Page Services
src/Sylius/Behat/Resources/config/services/pages/shop/checkout.php, src/Sylius/Behat/Resources/config/services/pages/shop/checkout.xml
Migrated four checkout flow page services (address, select_payment, select_shipping, complete) with their parameters and dependencies to PHP configuration.
Contact, Order, Payment Request, Product Page Services
src/Sylius/Behat/Resources/config/services/pages/shop/contact.php, src/Sylius/Behat/Resources/config/services/pages/shop/contact.xml, src/Sylius/Behat/Resources/config/services/pages/shop/order.php, src/Sylius/Behat/Resources/config/services/pages/shop/order.xml, src/Sylius/Behat/Resources/config/services/pages/shop/payment_request.php, src/Sylius/Behat/Resources/config/services/pages/shop/payment_request.xml, src/Sylius/Behat/Resources/config/services/pages/shop/product.php, src/Sylius/Behat/Resources/config/services/pages/shop/product.xml
Converted individual page service definitions and parameters for contact, order, payment request, and product pages from XML to PHP equivalents.
Test Plugin Page Services
src/Sylius/Behat/Resources/config/services/pages/test_plugin.php, src/Sylius/Behat/Resources/config/services/pages/test_plugin.xml
Migrated single test plugin main page service definition from XML to PHP format.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

Shop

Suggested reviewers

  • TheMilek
  • mpysiak
  • GSadee

Poem

🐰 Hops with glee through config files,
XML gone, now PHP smiles,
Services dancing in new PHP ways,
Cleaner DI configs brighten our days!
A rabbit's migration done 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 describes the main change: converting Behat shop pages configuration from XML to PHP format across multiple files.
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.

🧹 Nitpick comments (5)
src/Sylius/Behat/Resources/config/services/pages/shop/contact.php (1)

23-29: defaults()->public() is a no-op here and consistently appears across the entire pages configuration directory.

$services->defaults()->public() sets the default visibility to public, but every service in this file (and in all 7 similar page configuration files) immediately overrides it with ->private(), making the defaults() call have no practical effect. This pattern is consistent across the entire pages configuration directory, suggesting it may be intentional for consistency or future extensibility — but it could be removed to avoid misleading readers.

♻️ Proposed simplification
-    $services->defaults()->public();
-
     $services
         ->set('sylius.behat.page.shop.contact', '%sylius.behat.page.shop.contact.class%')
-        ->private()
         ->parent('sylius.behat.page.shop.page')
     ;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Sylius/Behat/Resources/config/services/pages/shop/contact.php` around
lines 23 - 29, The call to $services->defaults()->public() is redundant because
every service defined here (e.g., 'sylius.behat.page.shop.contact' which
immediately calls ->private() and sets parent 'sylius.behat.page.shop.page')
overrides that default; remove the $services->defaults()->public() line from
this file (and the same line from the other pages config files) so the
configuration is not misleading, keeping the service definitions
(set(...)->private()->parent(...)) intact.
src/Sylius/Behat/Resources/config/services/pages/shop/product.php (1)

14-15: use imports within Sylius\Behat\Page\Shop\Product\* are not sorted alphabetically.

IndexPage (I) should precede ShowPage (S). As per coding guidelines, PHP use imports must be sorted alphabetically.

♻️ Proposed fix
-use Sylius\Behat\Page\Shop\Product\ShowPage;
-use Sylius\Behat\Page\Shop\Product\IndexPage;
+use Sylius\Behat\Page\Shop\Product\IndexPage;
+use Sylius\Behat\Page\Shop\Product\ShowPage;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Sylius/Behat/Resources/config/services/pages/shop/product.php` around
lines 14 - 15, The two PHP use imports for Sylius\Behat\Page\Shop\Product are
out of alphabetical order; update the use statements so IndexPage appears before
ShowPage (swap the order of the use lines referencing IndexPage and ShowPage in
the file) to comply with the project's import sorting guideline.
src/Sylius/Behat/Resources/config/services/pages/shop/order.php (1)

14-15: use imports are not sorted alphabetically.

ShowPage (S) should precede ThankYouPage (T). As per coding guidelines, PHP use imports must be sorted alphabetically.

♻️ Proposed fix
-use Sylius\Behat\Page\Shop\Order\ThankYouPage;
-use Sylius\Behat\Page\Shop\Order\ShowPage;
+use Sylius\Behat\Page\Shop\Order\ShowPage;
+use Sylius\Behat\Page\Shop\Order\ThankYouPage;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Sylius/Behat/Resources/config/services/pages/shop/order.php` around lines
14 - 15, The two PHP use imports are not alphabetized: swap the order so
ShowPage comes before ThankYouPage (i.e., ensure the use statements reference
ShowPage then ThankYouPage) to comply with the project's alphabetical import
convention; update the use block containing ShowPage and ThankYouPage
accordingly (or run your project's PSR-12/CS fixer) so imports are sorted.
src/Sylius/Behat/Resources/config/services/pages/shop/checkout.php (1)

14-18: use imports are not sorted alphabetically.

CompletePage (C) should precede SelectPaymentPage / SelectShippingPage (S). As per coding guidelines, PHP use imports must be sorted alphabetically.

♻️ Proposed fix
 use Sylius\Behat\Page\Shop\Checkout\AddressPage;
-use Sylius\Behat\Page\Shop\Checkout\SelectPaymentPage;
-use Sylius\Behat\Page\Shop\Checkout\SelectShippingPage;
 use Sylius\Behat\Page\Shop\Checkout\CompletePage;
+use Sylius\Behat\Page\Shop\Checkout\SelectPaymentPage;
+use Sylius\Behat\Page\Shop\Checkout\SelectShippingPage;
 use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Sylius/Behat/Resources/config/services/pages/shop/checkout.php` around
lines 14 - 18, Reorder the PHP use imports so they are alphabetically sorted:
move Sylius\Behat\Page\Shop\Checkout\CompletePage to come before
Sylius\Behat\Page\Shop\Checkout\SelectPaymentPage and
Sylius\Behat\Page\Shop\Checkout\SelectShippingPage; ensure the block containing
AddressPage, CompletePage, SelectPaymentPage, SelectShippingPage and
Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator
is sorted lexicographically by full FQCN to satisfy the coding guideline.
src/Sylius/Behat/Resources/config/services/pages/shop.php (1)

30-34: Add ->abstract() to maintain consistency with peer parent services.

Sylius\Behat\Page\Shop\Page is declared abstract, and its peer parent services in pages.xml (sylius.behat.page, sylius.behat.symfony_page) are both marked abstract="true". The DI service should include ->abstract() to preserve this semantic intent and align with the XML configuration pattern.

♻️ Proposed fix
 $services
     ->set('sylius.behat.page.shop.page', Page::class)
     ->private()
+    ->abstract()
     ->parent('sylius.behat.symfony_page')
 ;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Sylius/Behat/Resources/config/services/pages/shop.php` around lines 30 -
34, The service definition for sylius.behat.page.shop.page currently sets
Page::class, marks it private, and sets parent('sylius.behat.symfony_page') but
omits ->abstract(); update the service definition for
sylius.behat.page.shop.page (the one using Page::class and
parent('sylius.behat.symfony_page')) to call ->abstract() so the DI definition
matches the abstract PHP class and the peer parent services.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/Sylius/Behat/Resources/config/services/pages/shop.php`:
- Around line 30-34: The service definition for sylius.behat.page.shop.page
currently sets Page::class, marks it private, and sets
parent('sylius.behat.symfony_page') but omits ->abstract(); update the service
definition for sylius.behat.page.shop.page (the one using Page::class and
parent('sylius.behat.symfony_page')) to call ->abstract() so the DI definition
matches the abstract PHP class and the peer parent services.

In `@src/Sylius/Behat/Resources/config/services/pages/shop/checkout.php`:
- Around line 14-18: Reorder the PHP use imports so they are alphabetically
sorted: move Sylius\Behat\Page\Shop\Checkout\CompletePage to come before
Sylius\Behat\Page\Shop\Checkout\SelectPaymentPage and
Sylius\Behat\Page\Shop\Checkout\SelectShippingPage; ensure the block containing
AddressPage, CompletePage, SelectPaymentPage, SelectShippingPage and
Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator
is sorted lexicographically by full FQCN to satisfy the coding guideline.

In `@src/Sylius/Behat/Resources/config/services/pages/shop/contact.php`:
- Around line 23-29: The call to $services->defaults()->public() is redundant
because every service defined here (e.g., 'sylius.behat.page.shop.contact' which
immediately calls ->private() and sets parent 'sylius.behat.page.shop.page')
overrides that default; remove the $services->defaults()->public() line from
this file (and the same line from the other pages config files) so the
configuration is not misleading, keeping the service definitions
(set(...)->private()->parent(...)) intact.

In `@src/Sylius/Behat/Resources/config/services/pages/shop/order.php`:
- Around line 14-15: The two PHP use imports are not alphabetized: swap the
order so ShowPage comes before ThankYouPage (i.e., ensure the use statements
reference ShowPage then ThankYouPage) to comply with the project's alphabetical
import convention; update the use block containing ShowPage and ThankYouPage
accordingly (or run your project's PSR-12/CS fixer) so imports are sorted.

In `@src/Sylius/Behat/Resources/config/services/pages/shop/product.php`:
- Around line 14-15: The two PHP use imports for Sylius\Behat\Page\Shop\Product
are out of alphabetical order; update the use statements so IndexPage appears
before ShowPage (swap the order of the use lines referencing IndexPage and
ShowPage in the file) to comply with the project's import sorting guideline.

@TheMilek TheMilek merged commit 28406af into Sylius:2.3 Feb 23, 2026
36 checks passed
@NoResponseMate NoResponseMate deleted the behat/update-services-definition-to-php-shop-pages branch February 23, 2026 12:29
@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