8000 minor #57689 [Contracts][HttpClient] Skip tests when zlib's `ob_gzhan… · symfony/symfony@b5dba85 · GitHub
[go: up one dir, main page]

Skip to content

Commit b5dba85

Browse files
minor #57689 [Contracts][HttpClient] Skip tests when zlib's ob_gzhandler() 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 ------- 97e713b [Contracts][HttpClient] Skip tests when zlib's `ob_gzhandler()` doesn't exist
2 parents 1577be3 + 97e713b commit b5dba85

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/Symfony/Component/HttpClient/Tests/HttplugClientTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public static function tearDownAfterClass(): void
3737
TestHttpServer::stop();
3838
}
3939

40+
/**
41+
* @requires function ob_gzhandler
42+
*/
4043
public function testSendRequest()
4144
{
4245
$client = new HttplugClient(new NativeHttpClient());
@@ -51,6 +54,9 @@ public function testSendRequest()
5154
$this->assertSame('HTTP/1.1', $body['SERVER_PROTOCOL']);
5255
}
5356

57+
/**
58+
* @requires function ob_gzhandler
59+
*/
5460
public function testSendAsyncRequest()
5561
{
5662
$client = new HttplugClient(new NativeHttpClient());

src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public static function tearDownAfterClass(): void
3333
TestHttpServer::stop();
3434
}
3535

36+
/**
37+
* @requires function ob_gzhandler
38+
*/
3639
public function testSendRequest()
3740
{
3841
$factory = new Psr17Factory();

src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ abstract class HttpClientTestCase extends TestCase
2525
{
2626
public static function setUpBeforeClass(): void
2727
{
28+
if (!function_exists('ob_gzhandler')) {
29+
static::markTestSkipped('The "ob_gzhandler" function is not available.');
30+
}
31+
2832
TestHttpServer::start();
2933
}
3034

0 commit comments

Comments
 (0)
0