Skip to content

Conversation

@norkunas
Copy link
Member

@norkunas norkunas commented Dec 12, 2025

Summary by CodeRabbit

  • Chores
    • Replaced HTTP client testing dependencies with Symfony's HttpClient component.
    • Updated test infrastructure and HTTP mocking capabilities for improved compatibility and maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR migrates the test suite's HTTP mocking infrastructure from php-http components to Symfony HttpClient. Dependencies are removed and replaced, test kernel configuration is updated to support the new HTTP client, test configuration files are simplified, and HTTP mocking implementations across multiple test files are refactored to use Symfony's MockHttpClient with PSR-18 wrappers.

Changes

Cohort / File(s) Change Summary
Dependency updates
composer.json
Removed php-http/curl-client from require; removed php-http/message and php-http/mock-client from require-dev; added symfony/http-client to require-dev.
Test kernel infrastructure
tests/Functional/CustomTestKernel.php
Implements CompilerPassInterface and adds build() method; introduces process() to register compiler pass that makes http_client service public.
Test configuration—framework setup
tests/Functional/config/framework.yml
Enables HTTP client framework configuration by adding http_client: { enabled: true } block.
Test configuration—mock client removals
tests/Functional/config/listener.yml, tests/Functional/config/listener_php7.yml, tests/Functional/config/listener_php8.yml, tests/Functional/config/fakeip_with_cache_cn.yml, tests/Functional/config/fakeip_with_cache_fr.yml
Removes http_client option from provider configurations and removes Http\Mock\Client service definitions.
Test implementation—provider compilation
tests/DependencyInjection/Compiler/AddProvidersPassTest.php
Replaces Http\Mock\Client usage with Symfony\Component\HttpClient\MockHttpClient wrapped in Psr18Client for BingMaps provider test.
Test implementation—geocoder listener
tests/Functional/GeocoderListenerTest.php
Adds private static helpers createHttpClientForBerlinQuery() and createHttpClientForFrankfurtQuery(); refactors test methods to inject MockHttpClient into container instead of configuring inline mocks; centralizes HTTP response logic.
Test implementation—plugin interaction
tests/Functional/PluginInteractionTest.php
Replaces Http\Mock\Client and PSR-7 mocks with Symfony\Component\HttpClient\MockHttpClient and MockResponse; simplifies HTTP mocking via static callback.
Test implementation—address validator
tests/Validator/Constraint/AddressValidatorTest.php
Replaces Http\Client\Mock\Client with MockHttpClient wrapped in Psr18Client; inlines HTTP expectations via static callback in mock client construction.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

  • Multiple test files with heterogeneous mocking patterns: Each test file replaces HTTP mocks differently (some add helpers, others inline callbacks), requiring separate reasoning for each.
  • Configuration cascading changes: Five YAML config files require verification to ensure mock client removals don't break provider resolution.
  • Kernel-level infrastructure change: CustomTestKernel compiler pass implementation needs verification for correct service visibility.
  • Dependency resolution chain: Ensure Psr18Client wrapping of MockHttpClient is correctly applied across tests that instantiate geocoders.

Poem

🐰 HTTP mocks, now swift as the west wind
From php-http to Symfony, we've thinned,
MockClients wrapped in PSR-18's embrace,
Tests run faster, cleaner, without a trace,
Mock responses hop where old stubs once pinned.
🌟

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% 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 directly describes the main change: removing the php-http/curl-client dependency from composer.json, which is the primary modification evident in the changeset.

📜 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 14b6cc1 and cf587a3.

📒 Files selected for processing (12)
  • composer.json (1 hunks)
  • tests/DependencyInjection/Compiler/AddProvidersPassTest.php (2 hunks)
  • tests/Functional/CustomTestKernel.php (3 hunks)
  • tests/Functional/GeocoderListenerTest.php (8 hunks)
  • tests/Functional/PluginInteractionTest.php (4 hunks)
  • tests/Functional/config/fakeip_with_cache_cn.yml (0 hunks)
  • tests/Functional/config/fakeip_with_cache_fr.yml (0 hunks)
  • tests/Functional/config/framework.yml (1 hunks)
  • tests/Functional/config/listener.yml (0 hunks)
  • tests/Functional/config/listener_php7.yml (0 hunks)
  • tests/Functional/config/listener_php8.yml (0 hunks)
  • tests/Validator/Constraint/AddressValidatorTest.php (1 hunks)

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

@norkunas norkunas force-pushed the drop-dep branch 2 times, most recently from 170bb10 to 14b6cc1 Compare December 12, 2025 21:23
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: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/Functional/GeocoderListenerTest.php (1)

46-48: Critical: Test uses TestKernel instead of CustomTestKernel.

The pipeline failures show "The 'http_client' service is private, you cannot replace it" at multiple injection points.

This test needs to use CustomTestKernel (which makes the http_client service public) instead of TestKernel.

     protected static function getKernelClass(): string
     {
-        return TestKernel::class;
+        return CustomTestKernel::class;
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5852b70 and 14b6cc1.

📒 Files selected for processing (13)
  • composer.json (1 hunks)
  • tests/DependencyInjection/Compiler/AddProvidersPassTest.php (2 hunks)
  • tests/Functional/CustomTestKernel.php (3 hunks)
  • tests/Functional/GeocoderListenerTest.php (7 hunks)
  • tests/Functional/PluginInteractionTest.php (3 hunks)
  • tests/Functional/config/fakeip_with_cache_cn.yml (0 hunks)
  • tests/Functional/config/fakeip_with_cache_fr.yml (0 hunks)
  • tests/Functional/config/framework.yml (1 hunks)
  • tests/Functional/config/listener.yml (0 hunks)
  • tests/Functional/config/listener_php7.yml (0 hunks)
  • tests/Functional/config/listener_php8.yml (0 hunks)
  • tests/Validator/Constraint/AddressValidatorTest.php (1 hunks)
  • tests/baseline-ignore (0 hunks)
💤 Files with no reviewable changes (6)
  • tests/Functional/config/listener_php7.yml
  • tests/baseline-ignore
  • tests/Functional/config/fakeip_with_cache_fr.yml
  • tests/Functional/config/listener.yml
  • tests/Functional/config/listener_php8.yml
  • tests/Functional/config/fakeip_with_cache_cn.yml
🧰 Additional context used
🧬 Code graph analysis (1)
tests/Functional/CustomTestKernel.php (2)
src/DependencyInjection/Compiler/FactoryValidatorPass.php (1)
  • process (34-41)
src/DependencyInjection/Compiler/ProfilerPass.php (1)
  • process (30-41)
🪛 GitHub Actions: CI
tests/Functional/PluginInteractionTest.php

[error] 78-78: The "http_client" service is private, you cannot replace it.

tests/Functional/GeocoderListenerTest.php

[error] 105-105: The "http_client" service is private, you cannot replace it.


[error] 145-145: The "http_client" service is private, you cannot replace it.


[error] 187-187: The "http_client" service is private, you cannot replace it.


[error] 220-220: The "http_client" service is private, you cannot replace it.


[error] 253-253: The "http_client" service is private, you cannot replace it.

tests/Validator/Constraint/AddressValidatorTest.php

[error] 32-32: Class "Symfony\Component\HttpClient\Response\JsonMockResponse" not found


[error] 103-103: Class "Symfony\Component\HttpClient\Response\JsonMockResponse" not found

🪛 PHPMD (2.15.0)
tests/Functional/PluginInteractionTest.php

99-99: Avoid unused parameters such as '$options'. (undefined)

(UnusedFormalParameter)

🔇 Additional comments (3)
composer.json (1)

69-69: LGTM - Dependency migration is correct.

The migration from php-http/* packages to symfony/http-client is properly configured.

tests/Functional/config/framework.yml (1)

11-12: LGTM!

Enabling the http_client service in the framework configuration is correct.

tests/DependencyInjection/Compiler/AddProvidersPassTest.php (1)

21-22: LGTM!

The migration to Symfony HttpClient mocks is correctly implemented. Using Psr18Client to wrap MockHttpClient provides PSR-18 compatibility for the BingMaps provider.

Also applies to: 38-38

@norkunas norkunas force-pushed the drop-dep branch 5 times, most recently from ea8b9de to c062abb Compare December 12, 2025 21:35
@norkunas norkunas merged commit 5bb8341 into geocoder-php:master Dec 12, 2025
18 of 19 checks passed
@norkunas norkunas deleted the drop-dep branch December 12, 2025 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant