Skip to content

Commit

Permalink
Make HttpClientTestCase compatible with PHPUnit8
Browse files Browse the repository at this point in the history
  • Loading branch information
jderusse committed Aug 8, 2019
1 parent fda49e6 commit c8c717c
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php
Expand Up @@ -21,16 +21,12 @@
* A reference test suite for HttpClientInterface implementations.
*
* @experimental in 1.1
* @internal
*/
abstract class HttpClientTestCase extends TestCase
trait HttpClientTestCaseTrait
{
private static $server;

public static function setUpBeforeClass()
{
TestHttpServer::start();
}

abstract protected function getHttpClient(string $testCase): HttpClientInterface;

public function testGetRequest()
Expand Down Expand Up @@ -788,3 +784,28 @@ public function testGzipBroken()
$response->getContent();
}
}

if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'setUpBeforeClass'))->hasReturnType()) {
abstract class HttpClientTestCase extends TestCase
{
use HttpClientTestCaseTrait;

public static function setUpBeforeClass(): void
{
TestHttpServer::start();
}
}
} else {
abstract class HttpClientTestCase extends TestCase
{
use HttpClientTestCaseTrait;

/**
* @return void
*/
public static function setUpBeforeClass()
{
TestHttpServer::start();
}
}
}

0 comments on commit c8c717c

Please sign in to comment.