Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 84a6690

Browse filesBrowse files
committed
Make HttpClientTestCase compatible with PHPUnit8
1 parent fda49e6 commit 84a6690
Copy full SHA for 84a6690

File tree

1 file changed

+28
-6
lines changed
Filter options

1 file changed

+28
-6
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php
+28-6Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@
2121
* A reference test suite for HttpClientInterface implementations.
2222
*
2323
* @experimental in 1.1
24+
*
25+
* @internal
2426
*/
25-
abstract class HttpClientTestCase extends TestCase
27+
trait HttpClientTestCaseTrait
2628
{
2729
private static $server;
2830

29-
public static function setUpBeforeClass()
30-
{
31-
TestHttpServer::start();
32-
}
33-
3431
abstract protected function getHttpClient(string $testCase): HttpClientInterface;
3532

3633
public function testGetRequest()
@@ -788,3 +785,28 @@ public function testGzipBroken()
788785
$response->getContent();
789786
}
790787
}
788+
789+
if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'setUpBeforeClass'))->hasReturnType()) {
790+
abstract class HttpClientTestCase extends TestCase
791+
{
792+
use HttpClientTestCaseTrait;
793+
794+
public static function setUpBeforeClass(): void
795+
{
796+
TestHttpServer::start();
797+
}
798+
}
799+
} else {
800+
abstract class HttpClientTestCase extends TestCase
801+
{
802+
use HttpClientTestCaseTrait;
803+
804+
/**
805+
* @return void
806+
*/
807+
public static function setUpBeforeClass()
808+
{
809+
TestHttpServer::start();
810+
}
811+
}
812+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.