Skip to content

Test the request headers of NativeCurlClient and Psr18Client - #592

Merged
Art4 merged 1 commit into
v3.xfrom
591-coverage-clients
Nov 25, 2026
Merged

Art4 merged 1 commit into
v3.xfrom
591-coverage-clients

Conversation

@Art4

@Art4 Art4 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

 tests/Unit/Client/
 ├── NativeCurlClient/RequestTest.php
+│   └── testRequestSendsCorrectHeaders      # API key, Basic auth, impersonation, content type from request / json / xml / upload path / none
 └── Psr18Client/RequestTest.php
+    └── testRequestGuessesContentTypeFromPath  # json / xml / upload / other path

Tests only, no change in src/. Part 1 of 3 of #591: NativeCurlClient and Psr18Client have no uncovered line left. No changelog entry.

Part of #591

Evidence

  • Before: uncovered lines NativeCurlClient.php 304, 308, 330, 332, 334 and Psr18Client.php 154.
    After: both files are fully covered. Remaining on v3.x: AbstractApi.php 192, 205, 216 and XmlSerializer.php 107, 108 (parts 2 and 3).
  • QA on PHP 8.2: PHPUnit OK (860 tests, 4350 assertions), PHPStan [OK] No errors, code style 0 files to fix, Rector dry run exit 0. Behat not run, no production code changed.

Merge Danger

Door: two-way

Blast Radius: none, tests only.

Summary by CodeRabbit

  • Tests
    • Expanded automated coverage for HTTP request headers across both client types, including authentication, user impersonation, and content-type selection.
    • Added checks for content types inferred from JSON, XML, and upload paths, as well as paths where no content type is inferred.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Adds data-driven tests for request headers in NativeCurlClient and path-based content-type selection in Psr18Client.

Changes: Client request-header tests

Layer / File(s) Summary
NativeCurlClient request headers
tests/Unit/Client/NativeCurlClient/RequestTest.php
Adds cases for API-key and basic authentication, impersonation, explicit and inferred content types, and paths without inferred content types.
Psr18Client content-type inference
tests/Unit/Client/Psr18Client/RequestTest.php
Adds cases for JSON, XML, upload, and unmatched paths when the request content type is empty.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related issues

  • kbsali/php-redmine-api issue 591: The PR adds tests for Basic authentication and path-based content-type inference in both clients, which matches part 1 of the issue. The remaining coverage described in the issue is outside this PR's scope.

Suggested reviewers: kbsali

Merge Risk: Minimal · up to e1714

This change only adds test coverage for request headers in two HTTP clients and does not alter runtime behavior. No concrete merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Test the request headers of NativeCurlClient and Psr18Client" matches the changeset. The PR adds request-header tests to RequestTest.php in both the NativeCurlClient and Psr18Client unit te…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Test the request headers of NativeCurlClient and Psr18Client" matches the changeset. The PR adds request-header tests to RequestTest.php in both the NativeCurlClient and Psr18Client unit test folders, and the objectives confirm that no production code changes are included. The title is specific, short, and names both clients.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 61421a96-e268-421c-a9b7-80e5761a7e0e
Commits

Reviewing files that changed from the base of the PR and between 8afaea3 and e171436.

Files selected for processing: 2

  • tests/Unit/Client/NativeCurlClient/RequestTest.php
  • tests/Unit/Client/Psr18Client/RequestTest.php

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.66%. Comparing base (8afaea3) to head (e171436).

Additional details and impacted files
@@             Coverage Diff              @@
##               v3.x     #592      +/-   ##
============================================
+ Coverage     99.26%   99.66%   +0.39%     
  Complexity      456      456              
============================================
  Files            31       31              
  Lines          1505     1505              
============================================
+ Hits           1494     1500       +6     
+ Misses           11        5       -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Art4 Art4 added this to the v3.1.0 milestone Nov 25, 2026
@Art4
Art4 merged commit a19b6dc into v3.x Nov 25, 2026
19 checks passed
@Art4
Art4 deleted the 591-coverage-clients branch November 25, 2026 05:42
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