Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Rafikooo
Copy link
Contributor

@Rafikooo Rafikooo commented Oct 14, 2025

Summary

  • Remove phpspec/prophecy-phpunit from main composer.json
  • Remove phpspec/prophecy-phpunit from AddressingBundle, AdminBundle, ApiBundle, AttributeBundle, and CoreBundle composer.json files

Rationale

This package is no longer needed as the project has migrated away from Prophecy mocking in favor of PHPUnit's native mocking capabilities.

Summary by CodeRabbit

  • Tests

    • Replaced Prophecy-based test tooling with native PHPUnit mocks and expectations across the test suite, modernizing tests and improving reliability.
  • Chores

    • Removed a legacy phpspec/prophecy-phpunit dev dependency to simplify development and CI maintenance; no runtime or public API changes.

@Rafikooo Rafikooo requested review from a team as code owners October 14, 2025 07:45
@probot-autolabeler probot-autolabeler bot added Admin AdminBundle related issues and PRs. API APIs related issues and PRs. labels Oct 14, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 14, 2025

Walkthrough

Removed phpspec/prophecy-phpunit from root and bundle composer.json files and migrated many tests from Prophecy (prophesize/reveal/ObjectProphecy) to PHPUnit native mocks (createMock/MockObject). No production runtime code changes.

Changes

Cohort / File(s) Summary of Changes
Root composer
composer.json
Removed phpspec/prophecy-phpunit from require-dev.
Bundle composer files
src/Sylius/Bundle/AddressingBundle/composer.json, src/Sylius/Bundle/AdminBundle/composer.json, src/Sylius/Bundle/ApiBundle/composer.json, src/Sylius/Bundle/AttributeBundle/composer.json, src/Sylius/Bundle/CoreBundle/composer.json
Removed phpspec/prophecy-phpunit from each bundle require-dev.
Tests — Prophecy → PHPUnit (many files)
src/.../AddressingBundle/tests/.../CountryChoiceTypeTest.php, src/.../AdminBundle/tests/.../HubNotificationProviderTest.php, src/.../ApiBundle/tests/.../ApiLoaderTest.php, src/.../AttributeBundle/tests/.../SelectAttributeTypeTest.php, src/.../CoreBundle/tests/.../MigrationSkipListenerTest.php, src/.../AddressingBundle/tests/.../ZoneChoiceTypeTest.php, src/.../AdminBundle/tests/.../NotificationsComponentTest.php, src/.../ApiBundle/tests/.../AddPaymentRequestHandlerTest.php, src/.../ApiBundle/tests/.../IriToIdentifierConverterTest.php, src/.../CoreBundle/tests/.../LazyOptionTest.php, src/.../CoreBundle/tests/.../CatalogPromotionActionTypeTest.php, src/.../CoreBundle/tests/.../ProductTaxonAutocompleteChoiceTypeTest.php, src/.../CoreBundle/tests/.../LocaleSetupTest.php, src/.../CoreBundle/tests/.../Mailer/*EmailManagerTest.php
Replaced Prophecy usage with PHPUnit MockObject: removed ProphecyTrait and ObjectProphecy types, changed mock properties to Interface&MockObject, replaced prophesize()->reveal() with $this->createMock(...), and converted expectations from Prophecy style to PHPUnit (->expects(...)->method(...)->willReturn(...)). A few tests adjusted constructor arguments (literal values) where applicable. No production API changes.

Sequence Diagram(s)

(Skipped — changes are testing and dependency migrations without new runtime control flow.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

Dependencies, DX, Maintenance

Suggested reviewers

  • GSadee
  • Prometee
  • mpysiak

Poem

I nibbled at composer under moonlight,
Swapped prophecies for mocks — tidy and bright.
Tests now hop steady on PHPUnit's track,
I twitch my whiskers and tidy my pack.
🐰✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly identifies the primary change of the pull request—removing the phpspec/prophecy-phpunit dependency—and directly reflects the modifications made across the composer.json files without extraneous detail or ambiguity. It is clear, concise, and specific enough for a reviewer to understand the main intent at a glance.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb55451 and 2651ff2.

📒 Files selected for processing (1)
  • src/Sylius/Bundle/ApiBundle/tests/Converter/IriToIdentifierConverterTest.php (10 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{php,yaml,yml,xml,twig}

📄 CodeRabbit inference engine (AGENTS.md)

Use 4 spaces for indentation in PHP, YAML, XML, and Twig files

Files:

  • src/Sylius/Bundle/ApiBundle/tests/Converter/IriToIdentifierConverterTest.php
**/*.php

📄 CodeRabbit inference engine (AGENTS.md)

**/*.php: Use modern PHP 8.2+ syntax and features
Declare strict_types=1 in all PHP files
Follow the Sylius Coding Standard
Do not use deprecated features from PHP, Symfony, or Sylius
Use final for all classes, except entities and repositories
Use readonly for immutable services and value objects
Add type declarations for all properties, arguments, and return values
Use camelCase for variables and method names
Use SCREAMING_SNAKE_CASE for constants
Use fast returns instead of unnecessary nesting
Use trailing commas in multi-line arrays and argument lists
Order array keys alphabetically where applicable
Use PHPDoc only when necessary (e.g., @var Collection)
Group class elements in order: constants, properties, constructor, public, protected, private methods
Group getter and setter methods for the same properties together
Suffix interfaces with Interface and traits with Trait
Use use statements for all non-global classes
Sort use imports alphabetically and group by type (classes, functions, constants)

Files:

  • src/Sylius/Bundle/ApiBundle/tests/Converter/IriToIdentifierConverterTest.php
🧬 Code graph analysis (1)
src/Sylius/Bundle/ApiBundle/tests/Converter/IriToIdentifierConverterTest.php (3)
src/Sylius/Bundle/AddressingBundle/tests/Form/Type/ZoneChoiceTypeTest.php (5)
  • setUp (37-57)
  • Test (74-84)
  • Test (86-96)
  • Test (98-107)
  • Test (109-118)
src/Sylius/Bundle/ApiBundle/tests/CommandHandler/AddPaymentRequestHandlerTest.php (4)
  • setUp (49-66)
  • Test (68-76)
  • Test (78-89)
  • Test (91-113)
src/Sylius/Bundle/CoreBundle/tests/Form/Type/Taxon/ProductTaxonAutocompleteChoiceTypeTest.php (5)
  • setUp (39-46)
  • Test (61-89)
  • Test (91-116)
  • Test (118-143)
  • Test (145-167)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Frontend / Get matrix
  • GitHub Check: Packages / Get matrix
  • GitHub Check: End-to-end tests (MySQL) / Get matrix
  • GitHub Check: End-to-end tests (PostgreSQL) / Get matrix
🔇 Additional comments (4)
src/Sylius/Bundle/ApiBundle/tests/Converter/IriToIdentifierConverterTest.php (4)

23-38: LGTM! Excellent type safety with intersection types.

The migration from Prophecy to PHPUnit native mocks is well-implemented. The use of intersection types (RouterInterface&MockObject) provides strong type safety and IDE support.


42-53: LGTM! Clean mock initialization.

The setUp method correctly initializes PHPUnit mocks using createMock() and properly injects them into the converter instance.


55-161: LGTM! Comprehensive test coverage maintained.

All test methods correctly migrate Prophecy expectations to PHPUnit's mock API. The explicit expectations (expects($this->once()), expects($this->never())) make the test intent clearer than the implicit Prophecy style.


163-293: LGTM! Complex mock interactions handled correctly.

The migration of complex test scenarios with multiple mock interactions is well-executed. The use of expects($this->any()) for potentially repeated calls and $this->anything() as a parameter matcher demonstrates proper understanding of PHPUnit's mocking API.


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

github-actions bot commented Oct 14, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment

@Rafikooo Rafikooo force-pushed the phpspec/prophecy-phpunit branch from 6c03846 to b37a8ab Compare October 14, 2025 07:48
Copy link

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b37a8ab and fb19454.

📒 Files selected for processing (5)
  • src/Sylius/Bundle/AddressingBundle/tests/Form/Type/CountryChoiceTypeTest.php (3 hunks)
  • src/Sylius/Bundle/AdminBundle/tests/Notification/HubNotificationProviderTest.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/tests/ApiPlatform/Routing/ApiLoaderTest.php (2 hunks)
  • src/Sylius/Bundle/AttributeBundle/tests/Form/Type/AttributeType/SelectAttributeTypeTest.php (3 hunks)
  • src/Sylius/Bundle/CoreBundle/tests/EventListener/MigrationSkipListenerTest.php (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{php,yaml,yml,xml,twig}

📄 CodeRabbit inference engine (AGENTS.md)

Use 4 spaces for indentation in PHP, YAML, XML, and Twig files

Files:

  • src/Sylius/Bundle/AddressingBundle/tests/Form/Type/CountryChoiceTypeTest.php
  • src/Sylius/Bundle/ApiBundle/tests/ApiPlatform/Routing/ApiLoaderTest.php
  • src/Sylius/Bundle/AdminBundle/tests/Notification/HubNotificationProviderTest.php
  • src/Sylius/Bundle/AttributeBundle/tests/Form/Type/AttributeType/SelectAttributeTypeTest.php
  • src/Sylius/Bundle/CoreBundle/tests/EventListener/MigrationSkipListenerTest.php
**/*.php

📄 CodeRabbit inference engine (AGENTS.md)

**/*.php: Use modern PHP 8.2+ syntax and features
Declare strict_types=1 in all PHP files
Follow the Sylius Coding Standard
Do not use deprecated features from PHP, Symfony, or Sylius
Use final for all classes, except entities and repositories
Use readonly for immutable services and value objects
Add type declarations for all properties, arguments, and return values
Use camelCase for variables and method names
Use SCREAMING_SNAKE_CASE for constants
Use fast returns instead of unnecessary nesting
Use trailing commas in multi-line arrays and argument lists
Order array keys alphabetically where applicable
Use PHPDoc only when necessary (e.g., @var Collection)
Group class elements in order: constants, properties, constructor, public, protected, private methods
Group getter and setter methods for the same properties together
Suffix interfaces with Interface and traits with Trait
Use use statements for all non-global classes
Sort use imports alphabetically and group by type (classes, functions, constants)

Files:

  • src/Sylius/Bundle/AddressingBundle/tests/Form/Type/CountryChoiceTypeTest.php
  • src/Sylius/Bundle/ApiBundle/tests/ApiPlatform/Routing/ApiLoaderTest.php
  • src/Sylius/Bundle/AdminBundle/tests/Notification/HubNotificationProviderTest.php
  • src/Sylius/Bundle/AttributeBundle/tests/Form/Type/AttributeType/SelectAttributeTypeTest.php
  • src/Sylius/Bundle/CoreBundle/tests/EventListener/MigrationSkipListenerTest.php
🧬 Code graph analysis (5)
src/Sylius/Bundle/AddressingBundle/tests/Form/Type/CountryChoiceTypeTest.php (3)
src/Sylius/Bundle/AdminBundle/tests/Notification/HubNotificationProviderTest.php (4)
  • setUp (51-74)
  • Test (76-126)
  • Test (128-190)
  • Test (192-261)
src/Sylius/Bundle/ApiBundle/tests/ApiPlatform/Routing/ApiLoaderTest.php (6)
  • setUp (30-41)
  • Test (43-47)
  • Test (49-69)
  • Test (71-81)
  • Test (83-94)
  • Test (96-107)
src/Sylius/Bundle/AttributeBundle/tests/Form/Type/AttributeType/SelectAttributeTypeTest.php (4)
  • setUp (42-48)
  • getExtensions (50-57)
  • assertChoicesLabels (59-69)
  • Test (29-40)
src/Sylius/Bundle/ApiBundle/tests/ApiPlatform/Routing/ApiLoaderTest.php (2)
src/Sylius/Bundle/AddressingBundle/tests/Form/Type/CountryChoiceTypeTest.php (6)
  • Test (65-78)
  • Test (80-93)
  • Test (95-108)
  • Test (110-123)
  • Test (125-138)
  • Test (140-153)
src/Sylius/Bundle/AdminBundle/tests/Notification/HubNotificationProviderTest.php (3)
  • Test (76-126)
  • Test (128-190)
  • Test (192-261)
src/Sylius/Bundle/AdminBundle/tests/Notification/HubNotificationProviderTest.php (1)
src/Sylius/Bundle/CoreBundle/SyliusCoreBundle.php (1)
  • SyliusCoreBundle (41-115)
src/Sylius/Bundle/AttributeBundle/tests/Form/Type/AttributeType/SelectAttributeTypeTest.php (1)
src/Sylius/Bundle/AddressingBundle/tests/Form/Type/CountryChoiceTypeTest.php (2)
  • setUp (36-54)
  • getExtensions (56-63)
src/Sylius/Bundle/CoreBundle/tests/EventListener/MigrationSkipListenerTest.php (1)
src/Sylius/Bundle/AddressingBundle/tests/Form/Type/CountryChoiceTypeTest.php (7)
  • setUp (36-54)
  • Test (65-78)
  • Test (80-93)
  • Test (95-108)
  • Test (110-123)
  • Test (125-138)
  • Test (140-153)
🪛 PHPMD (2.15.0)
src/Sylius/Bundle/AdminBundle/tests/Notification/HubNotificationProviderTest.php

86-86: Avoid unused parameters such as '$key'. (undefined)

(UnusedFormalParameter)


139-139: Avoid unused parameters such as '$key'. (undefined)

(UnusedFormalParameter)


203-203: Avoid unused parameters such as '$key'. (undefined)

(UnusedFormalParameter)

src/Sylius/Bundle/CoreBundle/tests/EventListener/MigrationSkipListenerTest.php

117-117: Avoid unused parameters such as '$schema'. (undefined)

(UnusedFormalParameter)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: Frontend / NodeJS 24.x
  • GitHub Check: End-to-end tests (MariaDB) / Non-JS, PHP 8.4, Symfony ^7.3, MariaDB 11.4.7, State Machine Adapter symfony_workflow, ApiPlatform ~4.1.7
  • GitHub Check: End-to-end tests (MariaDB) / Non-JS, PHP 8.3, Symfony ^6.4, MariaDB 10.11.13, State Machine Adapter winzou_state_machine
  • GitHub Check: End-to-end tests (MariaDB) / Non-JS, PHP 8.4, Symfony ^7.3, MariaDB 11.4.7, State Machine Adapter symfony_workflow
  • GitHub Check: End-to-end tests (PostgreSQL) / Non-JS, PHP 8.4, Symfony ^7.3, PostgreSQL 17.5
  • GitHub Check: End-to-end tests (PostgreSQL) / Non-JS, PHP 8.3, Symfony ^6.4, PostgreSQL 15.13
  • GitHub Check: End-to-end tests (MySQL) / JS with Panther, PHP 8.3, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / Non-JS, PHP 8.3, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Panther, PHP 8.4, Symfony ^7.3 (test_cached), MySQL 8.4, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Chromedriver, PHP 8.3, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Chromedriver, PHP 8.4, Symfony ^7.3 (test_cached), MySQL 8.4, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / Non-JS, PHP 8.4, Symfony ^7.3 (test_cached), MySQL 8.4, Twig ^3.3
🔇 Additional comments (16)
src/Sylius/Bundle/AttributeBundle/tests/Form/Type/AttributeType/SelectAttributeTypeTest.php (1)

18-18: LGTM! Clean migration from Prophecy to PHPUnit mocks.

The migration from Prophecy to PHPUnit's native mocking is correctly implemented:

  • Proper import of MockObject
  • Intersection type TranslationLocaleProviderInterface&MockObject provides full type information
  • Standard PHPUnit mock creation with createMock() and method()->willReturn()
  • Direct mock usage eliminates the need for reveal()

The pattern matches the reference implementation in CountryChoiceTypeTest.php and aligns with modern PHPUnit best practices.

Also applies to: 27-27, 44-45, 52-52

src/Sylius/Bundle/ApiBundle/tests/ApiPlatform/Routing/ApiLoaderTest.php (6)

17-17: LGTM! Good use of intersection types.

The addition of the MockObject import and the intersection type LoaderInterface&MockObject for the property provides better type safety and IDE support for the mock object.

Also applies to: 26-26


30-41: LGTM! Correct migration to PHPUnit mocks.

The setup correctly initializes the mock using createMock() and passes it directly to the ApiLoader constructor. The migration from Prophecy is clean and follows PHPUnit best practices.


50-69: LGTM! Clean migration to PHPUnit expectations.

The test correctly uses PHPUnit's mocking API with proper expectations (expects(), method(), with(), willReturn()). The assertion directly compares the mock object, which is the correct pattern for PHPUnit mocks.


72-81: LGTM! Proper PHPUnit mock expectations.

The test correctly configures mock expectations for the supports method and properly asserts the boolean return value.


84-94: LGTM! Correct object identity assertion.

The test properly creates the mock, sets up expectations, and verifies object identity with assertSame, which is the correct pattern for PHPUnit mocks.


97-107: LGTM! Proper parameter verification.

The test correctly verifies that setResolver is called once with the expected parameter using PHPUnit's with() method.

src/Sylius/Bundle/CoreBundle/tests/EventListener/MigrationSkipListenerTest.php (6)

28-30: LGTM!

The new imports are correctly added to support PHPUnit's native mocking (MockObject) and the test migration constructors (LoggerInterface). The imports are properly ordered alphabetically.


36-38: LGTM!

The property type declarations correctly use intersection types (Type&MockObject), which is the modern PHPUnit 11+ approach for typed mock properties. This provides better IDE support and type safety compared to the previous Prophecy approach.


44-51: LGTM!

The setUp method correctly migrates from Prophecy to PHPUnit's native mocking:

  • Uses createMock() instead of prophesize()
  • Uses ->method()->willReturn() for stubbing instead of Prophecy's API
  • Passes mocks directly without needing ->reveal()

The implementation is clean and follows PHPUnit best practices.


58-60: LGTM!

The test expectations correctly use PHPUnit's native mocking API:

  • ->expects($this->never()) replaces Prophecy's shouldNotBeCalled()
  • ->expects($this->once()) replaces Prophecy's shouldBeCalled()

The migration maintains the same test behavior while using PHPUnit's standard mocking capabilities.

Also applies to: 72-74


102-121: LGTM!

The use of anonymous classes to create test migrations is a clean and appropriate approach. The classes correctly:

  • Extend AbstractMigration with required constructor dependencies
  • Conditionally implement MigrationSkipInterface based on test requirements
  • Provide empty up() and down() method implementations suitable for tests

Note regarding static analysis: The PHPMD warning about unused $schema parameters (lines 105, 109, 115, 119) is a false positive. These parameters must be present to satisfy the AbstractMigration contract, even though they're not used in the test implementations.


123-135: LGTM!

The event construction correctly uses PHPUnit mocks:

  • Passes the concrete $migration object directly (no ->reveal() needed)
  • Uses createMock() for Connection and MigratorConfiguration dependencies
  • Properly constructs MigrationPlan and MigrationsVersionEventArgs with the required arguments

The migration is complete and consistent with PHPUnit's mocking approach.

src/Sylius/Bundle/AddressingBundle/tests/Form/Type/CountryChoiceTypeTest.php (3)

18-18: Excellent migration to PHPUnit native mocks with modern PHP features.

The use of intersection types (RepositoryInterface&MockObject) provides superior type safety and IDE support compared to the previous Prophecy approach. The migration is clean and consistent:

  • Mock creation with createMock() is properly set up in setUp()
  • Stubs configured with method()->willReturn() provide default behavior for country properties
  • Direct mock passing (no reveal() calls) simplifies the code

Also applies to: 28-34, 38-58


68-75: Test expectations migrated correctly.

All test methods now use PHPUnit's native expectation API (expects()->method()->with()->willReturn()) instead of Prophecy. The expectations correctly verify:

  • Method call counts ($this->once())
  • Method names (findBy, findAll)
  • Parameter matching (['enabled' => true])
  • Return values (country mock arrays)

This pattern is consistent with the migration in other bundles (AdminBundle, ApiBundle, AttributeBundle).

Also applies to: 83-90, 98-105, 113-120, 128-135, 143-150


1-162: No Prophecy references remain in CountryChoiceTypeTest. Search for prophecy, Prophecy, ObjectProphecy, prophesize, and reveal() returned no matches.

Comment on lines +82 to +87
$this->cache
->expects($this->once())
->method('get')
->with('latest_sylius_version', $this->isType('callable'))
->willReturnCallback(fn ($key, $callback) => $callback());

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Cache callback must receive an ItemInterface.

CacheInterface::get() will invoke the callback with a Symfony\Contracts\Cache\ItemInterface argument. Calling $callback() with no parameters raises a TypeError, so the test will fail. Create an ItemInterface mock (optionally asserting expiresAfter(60)) and pass it to the callback, e.g.:

+        $cacheItem = $this->createMock(ItemInterface::class);
+        $cacheItem
+            ->expects($this->once())
+            ->method('expiresAfter')
+            ->with(60);
+
         $this->cache
             ->expects($this->once())
             ->method('get')
             ->with('latest_sylius_version', $this->isType('callable'))
-            ->willReturnCallback(fn ($key, $callback) => $callback());
+            ->willReturnCallback(static fn (string $key, callable $callback) => $callback($cacheItem));

(The same fix is needed in the other tests that use this cache callback.)

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$this->cache
->expects($this->once())
->method('get')
->with('latest_sylius_version', $this->isType('callable'))
->willReturnCallback(fn ($key, $callback) => $callback());
$cacheItem = $this->createMock(ItemInterface::class);
$cacheItem
->expects($this->once())
->method('expiresAfter')
->with(60);
$this->cache
->expects($this->once())
->method('get')
->with('latest_sylius_version', $this->isType('callable'))
->willReturnCallback(static fn (string $key, callable $callback) => $callback($cacheItem));
🧰 Tools
🪛 PHPMD (2.15.0)

86-86: Avoid unused parameters such as '$key'. (undefined)

(UnusedFormalParameter)

🤖 Prompt for AI Agents
In
src/Sylius/Bundle/AdminBundle/tests/Notification/HubNotificationProviderTest.php
around lines 82 to 87, the cache callback is invoked without the ItemInterface
argument which causes a TypeError; fix by creating a mock of
Symfony\Contracts\Cache\ItemInterface (optionally set expectation that
expiresAfter(60) is called) and call the provided callback with that mock (e.g.
$callback($itemMock)) instead of $callback(), and apply the same change to the
other tests using this cache callback.

Copy link

@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: 0

🧹 Nitpick comments (5)
src/Sylius/Bundle/AdminBundle/tests/Twig/Component/Shared/Navbar/NotificationsComponentTest.php (1)

42-42: Optional: Consider multi-line formatting for better readability.

The nested array could be formatted across multiple lines to improve readability:

-        $this->notificationProvider->method('getNotifications')->willReturn(['version' => ['message' => 'sylius.ui.notifications.new_version_of_sylius_available']]);
+        $this->notificationProvider->method('getNotifications')->willReturn([
+            'version' => [
+                'message' => 'sylius.ui.notifications.new_version_of_sylius_available',
+            ],
+        ]);
src/Sylius/Bundle/CoreBundle/tests/Installation/Setup/LocaleSetupTest.php (1)

158-206: Consider replacing deprecated logicalOr() with modern PHPUnit patterns.

While the Prophecy → PHPUnit migration is correct, these tests use logicalOr() which was soft-deprecated in PHPUnit 9 and may be removed in PHPUnit 11/12. Additionally, logicalOr() doesn't enforce that each message is written exactly once or in a specific order—it only verifies each call matches one of the three messages.

Since the messages have a deterministic order in the production code, consider using a callback or consecutive expectations to verify both the content and order of the messages.

Example refactor using a callback:

-$output
-    ->expects($this->exactly(3))
-    ->method('writeln')
-    ->with($this->logicalOr(
-        'Adding <info>French</info> Language.',
-        'Adding <info>fr_FR</info> locale.',
-        '<info>You may also need to add this locale into config/parameters.yaml configuration.</info>',
-    ));
+$expectedMessages = [
+    'Adding <info>French</info> Language.',
+    'Adding <info>fr_FR</info> locale.',
+    '<info>You may also need to add this locale into config/parameters.yaml configuration.</info>',
+];
+$callCount = 0;
+$output
+    ->expects($this->exactly(3))
+    ->method('writeln')
+    ->willReturnCallback(function ($message) use ($expectedMessages, &$callCount) {
+        $this->assertSame($expectedMessages[$callCount++], $message);
+    });

Also applies to: 209-269

src/Sylius/Bundle/ApiBundle/tests/CommandHandler/AddPaymentRequestHandlerTest.php (3)

73-76: Assert invocation count and forbid side-effects in exception path

Use expects($this->once()) to assert the repository call occurs, and never() on unrelated collaborators to preserve Prophecy’s shouldBeCalled semantics.

-        $this->paymentRepository->method('findOneByOrderToken')->with(1, 'token')->willReturn(null);
+        $this->paymentRepository
+            ->expects($this->once())
+            ->method('findOneByOrderToken')
+            ->with(1, 'token')
+            ->willReturn(null);
+
+        $this->paymentMethodRepository->expects($this->never())->method('findOneBy');
+        $this->paymentRequestFactory->expects($this->never())->method('create');
+        $this->defaultActionProvider->expects($this->never())->method('getAction');
+        $this->defaultPayloadProvider->expects($this->never())->method('getPayload');

83-89: Likewise, tighten expectations for the “no payment method” path

Assert the two lookups happen exactly once and prevent creation/side-effects when the method is missing.

-        $payment = $this->createMock(PaymentInterface::class);
-
-        $this->paymentRepository->method('findOneByOrderToken')->with(1, 'token')->willReturn($payment);
-        $this->paymentMethodRepository->method('findOneBy')->with(['code' => 'bank_transfer'])->willReturn(null);
+        $payment = $this->createMock(PaymentInterface::class);
+
+        $this->paymentRepository
+            ->expects($this->once())
+            ->method('findOneByOrderToken')
+            ->with(1, 'token')
+            ->willReturn($payment);
+
+        $this->paymentMethodRepository
+            ->expects($this->once())
+            ->method('findOneBy')
+            ->with(['code' => 'bank_transfer'])
+            ->willReturn(null);
+
+        $this->paymentRequestFactory->expects($this->never())->method('create');
+        $this->defaultActionProvider->expects($this->never())->method('getAction');
+        $this->defaultPayloadProvider->expects($this->never())->method('getPayload');

98-106: Prefer expects($this->once()) to verify essential interactions in the happy path

This preserves the intent from Prophecy’s shouldBeCalled and fails if calls are skipped or duplicated.

-        $this->paymentRepository->method('findOneByOrderToken')->with(1, 'token')->willReturn($payment);
-        $this->paymentMethodRepository->method('findOneBy')->with(['code' => 'bank_transfer'])->willReturn($paymentMethod);
-        $this->defaultActionProvider->method('getAction')->with($paymentRequest)->willReturn('authorize');
-        $this->defaultPayloadProvider->method('getPayload')->with($paymentRequest)->willReturn(['foo' => 'bar']);
+        $this->paymentRepository
+            ->expects($this->once())
+            ->method('findOneByOrderToken')
+            ->with(1, 'token')
+            ->willReturn($payment);
+        $this->paymentMethodRepository
+            ->expects($this->once())
+            ->method('findOneBy')
+            ->with(['code' => 'bank_transfer'])
+            ->willReturn($paymentMethod);
+        $this->defaultActionProvider
+            ->expects($this->once())
+            ->method('getAction')
+            ->with($paymentRequest)
+            ->willReturn('authorize');
+        $this->defaultPayloadProvider
+            ->expects($this->once())
+            ->method('getPayload')
+            ->with($paymentRequest)
+            ->willReturn(['foo' => 'bar']);
-        $this->paymentRequestFactory->method('create')->with($payment, $paymentMethod)->willReturn($paymentRequest);
+        $this->paymentRequestFactory
+            ->expects($this->once())
+            ->method('create')
+            ->with($payment, $paymentMethod)
+            ->willReturn($paymentRequest);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb19454 and cb55451.

📒 Files selected for processing (12)
  • src/Sylius/Bundle/AddressingBundle/tests/Form/Type/ZoneChoiceTypeTest.php (7 hunks)
  • src/Sylius/Bundle/AdminBundle/tests/Twig/Component/Shared/Navbar/NotificationsComponentTest.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/tests/CommandHandler/AddPaymentRequestHandlerTest.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/tests/Converter/IriToIdentifierConverterTest.php (10 hunks)
  • src/Sylius/Bundle/CoreBundle/tests/Fixture/OptionsResolver/LazyOptionTest.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/tests/Form/Type/CatalogPromotion/CatalogPromotionActionTypeTest.php (12 hunks)
  • src/Sylius/Bundle/CoreBundle/tests/Form/Type/Taxon/ProductTaxonAutocompleteChoiceTypeTest.php (3 hunks)
  • src/Sylius/Bundle/CoreBundle/tests/Installation/Setup/LocaleSetupTest.php (6 hunks)
  • src/Sylius/Bundle/CoreBundle/tests/Mailer/AccountRegistrationEmailManagerTest.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/tests/Mailer/AccountVerificationEmailManagerTest.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/tests/Mailer/ContactEmailManagerTest.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/tests/Mailer/OrderEmailManagerTest.php (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{php,yaml,yml,xml,twig}

📄 CodeRabbit inference engine (AGENTS.md)

Use 4 spaces for indentation in PHP, YAML, XML, and Twig files

Files:

  • src/Sylius/Bundle/CoreBundle/tests/Mailer/ContactEmailManagerTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Mailer/AccountRegistrationEmailManagerTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Form/Type/CatalogPromotion/CatalogPromotionActionTypeTest.php
  • src/Sylius/Bundle/AddressingBundle/tests/Form/Type/ZoneChoiceTypeTest.php
  • src/Sylius/Bundle/ApiBundle/tests/CommandHandler/AddPaymentRequestHandlerTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Mailer/AccountVerificationEmailManagerTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Fixture/OptionsResolver/LazyOptionTest.php
  • src/Sylius/Bundle/AdminBundle/tests/Twig/Component/Shared/Navbar/NotificationsComponentTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Mailer/OrderEmailManagerTest.php
  • src/Sylius/Bundle/ApiBundle/tests/Converter/IriToIdentifierConverterTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Installation/Setup/LocaleSetupTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Form/Type/Taxon/ProductTaxonAutocompleteChoiceTypeTest.php
**/*.php

📄 CodeRabbit inference engine (AGENTS.md)

**/*.php: Use modern PHP 8.2+ syntax and features
Declare strict_types=1 in all PHP files
Follow the Sylius Coding Standard
Do not use deprecated features from PHP, Symfony, or Sylius
Use final for all classes, except entities and repositories
Use readonly for immutable services and value objects
Add type declarations for all properties, arguments, and return values
Use camelCase for variables and method names
Use SCREAMING_SNAKE_CASE for constants
Use fast returns instead of unnecessary nesting
Use trailing commas in multi-line arrays and argument lists
Order array keys alphabetically where applicable
Use PHPDoc only when necessary (e.g., @var Collection)
Group class elements in order: constants, properties, constructor, public, protected, private methods
Group getter and setter methods for the same properties together
Suffix interfaces with Interface and traits with Trait
Use use statements for all non-global classes
Sort use imports alphabetically and group by type (classes, functions, constants)

Files:

  • src/Sylius/Bundle/CoreBundle/tests/Mailer/ContactEmailManagerTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Mailer/AccountRegistrationEmailManagerTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Form/Type/CatalogPromotion/CatalogPromotionActionTypeTest.php
  • src/Sylius/Bundle/AddressingBundle/tests/Form/Type/ZoneChoiceTypeTest.php
  • src/Sylius/Bundle/ApiBundle/tests/CommandHandler/AddPaymentRequestHandlerTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Mailer/AccountVerificationEmailManagerTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Fixture/OptionsResolver/LazyOptionTest.php
  • src/Sylius/Bundle/AdminBundle/tests/Twig/Component/Shared/Navbar/NotificationsComponentTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Mailer/OrderEmailManagerTest.php
  • src/Sylius/Bundle/ApiBundle/tests/Converter/IriToIdentifierConverterTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Installation/Setup/LocaleSetupTest.php
  • src/Sylius/Bundle/CoreBundle/tests/Form/Type/Taxon/ProductTaxonAutocompleteChoiceTypeTest.php
🧬 Code graph analysis (8)
src/Sylius/Bundle/CoreBundle/tests/Form/Type/CatalogPromotion/CatalogPromotionActionTypeTest.php (1)
src/Sylius/Bundle/CoreBundle/tests/Fixture/OptionsResolver/LazyOptionTest.php (4)
  • Test (27-40)
  • Test (42-59)
  • Test (61-82)
  • Test (84-99)
src/Sylius/Bundle/AddressingBundle/tests/Form/Type/ZoneChoiceTypeTest.php (2)
src/Sylius/Bundle/AdminBundle/tests/Twig/Component/Shared/Navbar/NotificationsComponentTest.php (1)
  • setUp (30-37)
src/Sylius/Bundle/ApiBundle/tests/CommandHandler/AddPaymentRequestHandlerTest.php (1)
  • setUp (49-66)
src/Sylius/Bundle/ApiBundle/tests/CommandHandler/AddPaymentRequestHandlerTest.php (3)
src/Sylius/Bundle/AddressingBundle/tests/Form/Type/ZoneChoiceTypeTest.php (5)
  • setUp (37-57)
  • Test (74-84)
  • Test (86-96)
  • Test (98-107)
  • Test (109-118)
src/Sylius/Bundle/ApiBundle/tests/Converter/IriToIdentifierConverterTest.php (11)
  • setUp (42-53)
  • Test (66-76)
  • Test (78-88)
  • Test (90-102)
  • Test (133-146)
  • Test (148-161)
  • Test (163-176)
  • Test (178-193)
  • Test (195-210)
  • Test (212-254)
  • Test (256-293)
src/Sylius/Bundle/CoreBundle/tests/Fixture/OptionsResolver/LazyOptionTest.php (1)
  • Test (27-40)
src/Sylius/Bundle/CoreBundle/tests/Fixture/OptionsResolver/LazyOptionTest.php (2)
src/Sylius/Bundle/CoreBundle/tests/Form/Type/Taxon/ProductTaxonAutocompleteChoiceTypeTest.php (4)
  • Test (61-89)
  • Test (91-116)
  • Test (118-143)
  • Test (145-167)
src/Sylius/Bundle/CoreBundle/tests/Installation/Setup/LocaleSetupTest.php (3)
  • Test (73-115)
  • Test (117-155)
  • Test (157-206)
src/Sylius/Bundle/AdminBundle/tests/Twig/Component/Shared/Navbar/NotificationsComponentTest.php (2)
src/Sylius/Bundle/AddressingBundle/tests/Form/Type/ZoneChoiceTypeTest.php (4)
  • Test (74-84)
  • Test (86-96)
  • Test (98-107)
  • Test (109-118)
src/Sylius/Bundle/ApiBundle/tests/CommandHandler/AddPaymentRequestHandlerTest.php (3)
  • Test (68-76)
  • Test (78-89)
  • Test (91-113)
src/Sylius/Bundle/ApiBundle/tests/Converter/IriToIdentifierConverterTest.php (2)
src/Sylius/Bundle/ApiBundle/tests/CommandHandler/AddPaymentRequestHandlerTest.php (4)
  • setUp (49-66)
  • Test (68-76)
  • Test (78-89)
  • Test (91-113)
src/Sylius/Bundle/CoreBundle/tests/Fixture/OptionsResolver/LazyOptionTest.php (4)
  • Test (27-40)
  • Test (42-59)
  • Test (61-82)
  • Test (84-99)
src/Sylius/Bundle/CoreBundle/tests/Installation/Setup/LocaleSetupTest.php (3)
src/Sylius/Bundle/CoreBundle/Installer/Setup/LocaleSetup.php (2)
  • LocaleSetup (28-118)
  • setup (44-63)
src/Sylius/Bundle/ApiBundle/tests/Application/src/Kernel.php (1)
  • getProjectDir (38-41)
src/Sylius/Bundle/CoreBundle/tests/Fixture/OptionsResolver/LazyOptionTest.php (4)
  • Test (27-40)
  • Test (42-59)
  • Test (61-82)
  • Test (84-99)
src/Sylius/Bundle/CoreBundle/tests/Form/Type/Taxon/ProductTaxonAutocompleteChoiceTypeTest.php (2)
src/Sylius/Bundle/AddressingBundle/tests/Form/Type/ZoneChoiceTypeTest.php (2)
  • setUp (37-57)
  • getExtensions (59-72)
src/Sylius/Bundle/CoreBundle/tests/Fixture/OptionsResolver/LazyOptionTest.php (4)
  • Test (27-40)
  • Test (42-59)
  • Test (61-82)
  • Test (84-99)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Static checks / PHP 8.3, Symfony ^6.4
🔇 Additional comments (31)
src/Sylius/Bundle/CoreBundle/tests/Fixture/OptionsResolver/LazyOptionTest.php (1)

17-99: LGTM! Clean migration from Prophecy to PHPUnit native mocks.

The migration is executed correctly and follows PHPUnit best practices:

  • Intersection types (RepositoryInterface&MockObject) provide proper type safety for PHP 8.2+
  • willReturnMap appropriately handles multiple test scenarios in a single mock
  • expects($this->never()) correctly replaces Prophecy's non-call expectations
  • Test coverage and logic preserved across all four test methods
  • All Prophecy dependencies successfully removed
src/Sylius/Bundle/AdminBundle/tests/Twig/Component/Shared/Navbar/NotificationsComponentTest.php (4)

17-17: LGTM! Correct import for PHPUnit mocks.

The MockObject import is necessary for the intersection type used in the property declaration.


24-24: LGTM! Modern type-safe mock declaration.

The intersection type NotificationProviderInterface&MockObject is the correct approach for typing PHPUnit mocks, providing both interface contract and mock capabilities for better IDE support and static analysis.


30-37: LGTM! Clean migration to PHPUnit native mocking.

The setUp method correctly:

  • Creates the mock using createMock() (line 34)
  • Passes the mock directly to the component constructor without calling reveal() (line 36)

This is the proper PHPUnit native mocking approach.


42-42: LGTM! Correct PHPUnit method stubbing.

The method stubbing syntax ->method('getNotifications')->willReturn([...]) is the correct PHPUnit native approach.

src/Sylius/Bundle/CoreBundle/tests/Installation/Setup/LocaleSetupTest.php (2)

17-17: LGTM! Clean migration to PHPUnit native mocks.

The migration from Prophecy to PHPUnit's native mocking is correct:

  • Proper use of intersection types (RepositoryInterface&MockObject, FactoryInterface&MockObject) for type safety
  • Typed property declarations follow PHP 8.2+ standards
  • Direct mock creation with createMock() in setUp is cleaner than the Prophecy approach
  • Mocks passed directly to the constructor without needing reveal()

Also applies to: 31-41, 52-63


73-115: LGTM! Test expectations properly migrated.

The test methods correctly use PHPUnit's native mocking expectations (expects()->method()->with()->willReturn()) instead of Prophecy's API. The test logic and assertions remain intact.

Also applies to: 117-155

src/Sylius/Bundle/CoreBundle/tests/Mailer/AccountVerificationEmailManagerTest.php (2)

17-17: LGTM! MockObject import added.

The import of PHPUnit\Framework\MockObject\MockObject is correctly added to support the migration from Prophecy to PHPUnit native mocking.


36-46: LGTM! Clean migration to PHPUnit MockObject.

The test correctly migrates from Prophecy to PHPUnit's native mocking:

  • Mocks are created with createMock() instead of prophesize()
  • Type hints use MockObject intersections (UserInterface&MockObject, ChannelInterface&MockObject)
  • Method stubs configured with ->method(...)->willReturn(...)
  • Mocks passed directly to the method without reveal()

The migration is consistent and follows PHPUnit best practices.

src/Sylius/Bundle/CoreBundle/tests/Mailer/AccountRegistrationEmailManagerTest.php (2)

17-17: LGTM! MockObject import added.

Correctly imports MockObject to support PHPUnit native mocking.


37-47: LGTM! Consistent migration to PHPUnit MockObject.

The test successfully migrates from Prophecy with the same clean approach as other tests in this PR:

  • Uses createMock() for mock creation
  • Configures method stubs with ->method(...)->willReturn(...)
  • Passes mocks directly without reveal()
  • Type hints use MockObject intersections

The migration maintains test readability and follows PHPUnit conventions.

src/Sylius/Bundle/CoreBundle/tests/Mailer/ContactEmailManagerTest.php (2)

17-17: LGTM! MockObject import added.

Correctly imports MockObject for PHPUnit native mocking support.


36-51: LGTM! Excellent mock setup with parameter constraints.

The migration includes proper use of the ->with() constraint on line 44 to verify that findOneByCode is called with the expected parameter. This is a best practice for ensuring method calls receive correct arguments.

The overall migration maintains consistency with other tests in this PR.

src/Sylius/Bundle/CoreBundle/tests/Mailer/OrderEmailManagerTest.php (2)

17-17: LGTM! MockObject import added.

Correctly imports MockObject to support the migration to PHPUnit native mocking.


43-57: LGTM! Proper handling of chained mock dependencies.

The test correctly sets up chained mocks where $order->getCustomer() returns $customer, and $customer->getEmail() returns the email address. This demonstrates proper mock configuration for objects with dependencies.

The migration maintains the original test behavior while adopting PHPUnit's native mocking framework.

src/Sylius/Bundle/CoreBundle/tests/Form/Type/CatalogPromotion/CatalogPromotionActionTypeTest.php (3)

17-17: LGTM! MockObject import added.

Correctly imports MockObject to support PHPUnit native mocking.


34-36: LGTM! Properties correctly typed with MockObject intersections.

The class properties use intersection types (ChannelInterface&MockObject, ChannelRepositoryInterface&MockObject) which correctly combine the interface with MockObject. This provides proper type safety while working with mocks.


273-310: LGTM! Clean setUp and extension configuration.

The setUp() method correctly creates all necessary mocks using createMock(), and the getExtensions() method passes these mocks directly to the type constructors. The migration from Prophecy is complete and consistent.

Note: The channelRepository mock is configured with findAll() behavior in each individual test method rather than in setUp(). While this could be refactored, the current approach provides clarity about what each test expects.

src/Sylius/Bundle/CoreBundle/tests/Form/Type/Taxon/ProductTaxonAutocompleteChoiceTypeTest.php (5)

18-18: LGTM! MockObject import added.

Correctly imports MockObject to support the migration to PHPUnit native mocking.


33-46: LGTM! Properties and setUp correctly migrated.

The class properties use MockObject intersections for proper type safety, and the setUp() method creates all mocks using createMock(). This is a clean migration from Prophecy.


48-59: LGTM! Extensions configured with direct mock references.

The getExtensions() method correctly passes mocks directly to type constructors without using reveal(). This completes the migration to PHPUnit's native mocking approach.


61-89: LGTM! Excellent use of willReturnMap for multiple scenarios.

The test correctly uses willReturnMap() on lines 71-74 to configure the taxon repository to return different values based on different input codes. This is the recommended PHPUnit approach for handling multiple return values based on method arguments.

The migration maintains the original test behavior while adopting PHPUnit MockObject.


91-167: LGTM! Remaining tests consistently migrated.

All test methods follow the same migration pattern:

  • Create mocks with createMock()
  • Configure behavior with ->method(...)->willReturn(...) or ->willReturnMap(...)
  • Pass mocks directly to form options
  • Assert expected results

The migration is complete, consistent, and maintains test coverage.

src/Sylius/Bundle/ApiBundle/tests/Converter/IriToIdentifierConverterTest.php (5)

23-23: Clean migration to PHPUnit MockObject types.

The import and intersection type declarations correctly replace Prophecy dependencies with PHPUnit native mocking capabilities.

Also applies to: 34-38


42-53: Correct setUp() migration.

Replacing prophesize()->reveal() with createMock() is the proper PHPUnit pattern and maintains type safety through the MockObject intersection types.


59-102: Proper PHPUnit expectation syntax.

The migration from Prophecy-style expectations to PHPUnit's expects($this->once())/expects($this->never()) with method(), with(), willReturn(), and willThrowException() is correct and explicit.


213-254: Multiple expectations on the same mock handled correctly.

Setting independent expectations on the same mock instance (lines 219-222, 224-230) is valid PHPUnit syntax. Each expects() call registers a separate expectation that will be verified independently.


257-293: Complete and consistent migration pattern.

The test demonstrates the full PHPUnit mocking workflow: creating mocks with createMock(), setting expectations with expects(), and asserting results. The functional behavior matches the original Prophecy-based implementation while improving type safety.

src/Sylius/Bundle/ApiBundle/tests/CommandHandler/AddPaymentRequestHandlerTest.php (3)

17-17: Good migration to PHPUnit mocks with intersection types

Importing MockObject and typing properties as Interface&MockObject is idiomatic for PHP 8.2+ and aligns with the repo’s PHPUnit-native approach. Looks good.

Also applies to: 35-46


51-56: setUp(): mock wiring LGTM

createMock(...) usage matches the intersection-typed properties. No issues.


58-65: Constructor wiring is correct

Passing mocks directly, with trailing comma; consistent with coding guidelines.

@Rafikooo Rafikooo changed the base branch from 2.1 to 2.2 October 15, 2025 08:23
@NoResponseMate NoResponseMate merged commit 3823ee0 into Sylius:2.2 Oct 16, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Admin AdminBundle related issues and PRs. API APIs related issues and PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants