Skip to content

Commit

Permalink
minor #57689 [Contracts][HttpClient] Skip tests when zlib's `ob_gzhan…
Browse files Browse the repository at this point in the history
…dler()` doesn't exist (alexandre-daubois)

This PR was merged into the 5.4 branch.

Discussion
----------

[Contracts][HttpClient] Skip tests when zlib's `ob_gzhandler()` doesn't exist

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

When using a minimal PHP binary without enabling special ext, `ob_gzhandler` may not be available making a lot of HttpClient's tests fail. The function is used here: https://github.com/symfony/symfony/blob/7.2/src/Symfony/Contracts/HttpClient/Test/Fixtures/web/index.php#L46

Commits
-------

97e713b7f9 [Contracts][HttpClient] Skip tests when zlib's `ob_gzhandler()` doesn't exist
  • Loading branch information
nicolas-grekas committed Jul 10, 2024
2 parents 88cdf42 + 1663725 commit ed17728
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Tests/HttplugClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public static function tearDownAfterClass(): void
TestHttpServer::stop();
}

/**
* @requires function ob_gzhandler
*/
public function testSendRequest()
{
$client = new HttplugClient(new NativeHttpClient());
Expand All @@ -51,6 +54,9 @@ public function testSendRequest()
$this->assertSame('HTTP/1.1', $body['SERVER_PROTOCOL']);
}

/**
* @requires function ob_gzhandler
*/
public function testSendAsyncRequest()
{
$client = new HttplugClient(new NativeHttpClient());
Expand Down
3 changes: 3 additions & 0 deletions Tests/Psr18ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public static function tearDownAfterClass(): void
TestHttpServer::stop();
}

/**
* @requires function ob_gzhandler
*/
public function testSendRequest()
{
$factory = new Psr17Factory();
Expand Down

0 comments on commit ed17728

Please sign in to comment.