Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cleptric committed Apr 8, 2024
1 parent 73829ee commit fa06a50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/Tracing/HttpClient/TraceableHttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class TraceableHttpClientTest extends TestCase

public static function setUpBeforeClass(): void
{
if (!self::isHttpClientPackageInstalled()) {
if (!interface_exists(HttpClientInterface::class)) {
self::markTestSkipped('This test requires the "symfony/http-client" Composer package to be installed.');
}
}
Expand Down Expand Up @@ -357,13 +357,10 @@ public function testWithOptions(): void
$this->assertSame('GET', $response->getInfo('http_method'));
$this->assertSame('https://www.example.org/test-page', $response->getInfo('url'));
}
}

private static function isHttpClientPackageInstalled(): bool
if (interface_exists(HttpClientInterface::class)) {
interface TestableHttpClientInterface extends HttpClientInterface, LoggerAwareInterface, ResetInterface
{
return interface_exists(HttpClientInterface::class);
}
}

interface TestableHttpClientInterface extends HttpClientInterface, LoggerAwareInterface, ResetInterface
{
}
7 changes: 7 additions & 0 deletions tests/Tracing/HttpClient/TraceableResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ final class TraceableResponseTest extends TestCase
*/
private $hub;

public static function setUpBeforeClass(): void
{
if (!interface_exists(HttpClientInterface::class)) {
self::markTestSkipped('This test requires the "symfony/http-client" Composer package to be installed.');
}
}

protected function setUp(): void
{
$this->client = $this->createMock(HttpClientInterface::class);
Expand Down

0 comments on commit fa06a50

Please sign in to comment.