Skip to content

🧪 [testing] Add unit tests for UrlUtilities::urlJoin#4

Open
ineersa wants to merge 1 commit intomainfrom
testing-url-utilities-10917079127134337576
Open

🧪 [testing] Add unit tests for UrlUtilities::urlJoin#4
ineersa wants to merge 1 commit intomainfrom
testing-url-utilities-10917079127134337576

Conversation

@ineersa
Copy link
Copy Markdown
Owner

@ineersa ineersa commented Mar 16, 2026

🎯 What: The testing gap addressed
This PR introduces dedicated unit tests for UrlUtilities::urlJoin and its helper UrlUtilities::normalizePath in src/Utilities/UrlUtilities.php, to improve test reliability and coverage, rather than relying exclusively on integration-style HTML-to-Markdown conversions.

📊 Coverage: What scenarios are now tested

  • Empty base and empty links.
  • Absolute paths, scheme preservation, protocol-relative links (//other.com).
  • Query (?q=1) and fragment (#section) injection and overrides.
  • Relative paths, including root-base transitions and ., .. path normalization.
  • Edge cases around invalid base URLs throwing \LogicException.

Result: The improvement in test coverage
The static utility method UrlUtilities::urlJoin is now comprehensively covered by 36 explicit, deterministic unit assertions across a variety of path resolutions, catching logic bugs early and providing a robust safety net for refactoring.


PR created automatically by Jules for task 10917079127134337576 started by @ineersa

Added a dedicated PHPUnit test class `tests/UrlUtilitiesTest.php` to provide
comprehensive test coverage for `UrlUtilities::urlJoin` and related utility functions
(`normalizePath`).

Covered scenarios include:
- Empty base and links
- Absolute/relative path resolution
- Query and fragment handling
- Protocol-relative links
- Validating and asserting LogicExceptions for invalid base URLs

Co-authored-by: ineersa <4228843+ineersa@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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