Skip to content

Increase test coverage by 8.5% (63.88% → 72.41% lines)#19

Merged
voku merged 4 commits intomasterfrom
copilot/increase-test-coverage-5-percent
Apr 23, 2026
Merged

Increase test coverage by 8.5% (63.88% → 72.41% lines)#19
voku merged 4 commits intomasterfrom
copilot/increase-test-coverage-5-percent

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 23, 2026

Test coverage was at 63.88% line coverage with several core classes having 0% method coverage. Added 97 new tests across previously undertested areas, raising line coverage to 72.41% (+8.53%).

New test file: tests/Httpful/CoverageBoostTest.php

Classes covered

Class Lines before Lines after
UriResolver 43% 90%
ClientErrorException 0% 100%
Factory 29% 96%
FormMimeHandler 50% 100%
HtmlMimeHandler 57% 86%
XmlMimeHandler 16% 76%
CsvMimeHandler 35% 87%
Http 74% 98%
Mime 75% 100%
Request 67% 72%
Setup 84% 95%

Regressions caught

The new tests exercise edge cases that validate existing error-handling contracts:

  • Http::reason(999) → throws ResponseException for unknown status codes
  • Request::enableKeepAlive(0) / enableKeepAlive(-1) → throws InvalidArgumentException
  • XmlMimeHandler::parse('not valid xml') → throws XmlParseException (requires LIBXML_NOERROR|LIBXML_NOWARNING to prevent PHPUnit's convertWarningsToExceptions from intercepting the libxml warning before the handler can throw)
  • Factory::createStreamFromFile('/nonexistent', 'rb') → throws RuntimeException
  • Factory::createStreamFromFile('...', 'z') → throws InvalidArgumentException for invalid mode
  • Http::stream(new \stdClass()) → throws InvalidArgumentException for unsupported object type

This change is Reviewable

Copilot AI and others added 2 commits April 23, 2026 21:51
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 23, 2026

Coverage Status

coverage: 72.405% (+8.5%) from 63.878% — copilot/increase-test-coverage-5-percent into master

@voku voku marked this pull request as ready for review April 23, 2026 23:20
@voku voku merged commit ac16088 into master Apr 23, 2026
8 of 10 checks passed
Copilot AI added a commit that referenced this pull request Apr 24, 2026
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.

4 participants