Skip to content

Commit fff16e0

Browse files
committed
adjust to integration tests 4 and modernize phpunit usage
1 parent cc3b486 commit fff16e0

13 files changed

+39
-67
lines changed

.github/workflows/Build-Test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
operating-system: [ubuntu-latest]
18-
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
18+
php-versions: ['8.1', '8.2', '8.3', '8.4', '8.5']
1919
include:
20-
- php-versions: '7.4'
20+
- php-versions: '8.1'
2121
COMPOSER_FLAGS: '--prefer-stable --prefer-lowest'
2222
PHPUNIT_FLAGS: '--coverage-clover build/coverage.xml'
2323

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## 2.3.4 - 2025-12-08
8+
## 2.4.0 - unreleased
99

1010
- Added support for Symfony 8
1111
- Added support for PHP 8.5
12+
- Remove support for PHP < 8.1
1213

1314
## 2.3.3 - 2024-10-31
1415

composer.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
"name": "Михаил Красильников",
1313
"email": "[email protected]"
1414
}],
15-
"prefer-stable": true,
16-
"minimum-stability": "dev",
1715
"require": {
18-
"php": "^7.4 || ^8.0",
16+
"php": "^8.1",
1917
"ext-curl": "*",
2018
"php-http/discovery": "^1.6",
2119
"php-http/httplug": "^2.0",
@@ -26,8 +24,8 @@
2624
},
2725
"require-dev": {
2826
"guzzlehttp/psr7": "^2.0",
29-
"php-http/client-integration-tests": "^3.0",
30-
"phpunit/phpunit": "^7.5 || ^9.4",
27+
"php-http/client-integration-tests": "^4.0",
28+
"phpunit/phpunit": "^9.6.17 || ^10.0 || ^11.0 || ^12.0",
3129
"laminas/laminas-diactoros": "^2.0 || ^3.0",
3230
"php-http/message-factory": "^1.1"
3331
},

phpunit.xml.dist

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
43
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/7.0/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
65
bootstrap="tests/bootstrap.php"
76
colors="true"
7+
displayDetailsOnTestsThatTriggerErrors="true"
8+
displayDetailsOnTestsThatTriggerNotices="true"
9+
displayDetailsOnTestsThatTriggerWarnings="true"
10+
displayDetailsOnPhpunitDeprecations="true"
811
>
912
<php>
1013
<server name="TEST_SERVER" value="http://127.0.0.1:10000/server.php"/>
1114
</php>
1215

1316
<testsuites>
1417

15-
<testsuite name="All">
16-
<directory>tests</directory>
17-
</testsuite>
18-
1918
<testsuite name="Unit">
2019
<directory>tests/Unit</directory>
2120
</testsuite>
@@ -26,10 +25,10 @@
2625

2726
</testsuites>
2827

29-
<filter>
30-
<whitelist>
28+
<source>
29+
<include>
3130
<directory>src</directory>
32-
</whitelist>
33-
</filter>
31+
</include>
32+
</source>
3433

3534
</phpunit>

tests/Functional/HttpAsyncClientDiactorosTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
*/
1515
class HttpAsyncClientDiactorosTest extends HttpAsyncClientTestCase
1616
{
17-
/**
18-
* {@inheritdoc}
19-
*/
2017
protected function createHttpAsyncClient(): HttpAsyncClient
2118
{
2219
return new Client(new ResponseFactory(), new StreamFactory());

tests/Functional/HttpAsyncClientGuzzleTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
*/
1414
class HttpAsyncClientGuzzleTest extends HttpAsyncClientTestCase
1515
{
16-
/**
17-
* {@inheritdoc}
18-
*/
1916
protected function createHttpAsyncClient(): HttpAsyncClient
2017
{
2118
return new Client(new HttpFactory(), new HttpFactory());

tests/Functional/HttpAsyncClientTestCase.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
namespace Http\Client\Curl\Tests\Functional;
66

77
use Http\Client\Tests\HttpAsyncClientTest;
8+
use PHPUnit\Framework\Attributes\DataProvider;
89

910
/**
1011
* Base class for asynchronous functional client tests.
1112
*/
1213
abstract class HttpAsyncClientTestCase extends HttpAsyncClientTest
1314
{
1415
/**
15-
* {@inheritdoc}
16-
*
1716
* @dataProvider requestProvider
1817
*/
19-
public function testAsyncSendRequest($httpMethod, $uri, array $httpHeaders, $requestBody): void
18+
#[DataProvider('requestProvider')]
19+
public function testAsyncSendRequest(string $httpMethod, string $uri, array $httpHeaders, ?string $requestBody): void
2020
{
2121
if ($requestBody !== null && in_array($httpMethod, ['GET', 'HEAD', 'TRACE'], true)) {
2222
self::markTestSkipped('cURL can not send body using '.$httpMethod);
@@ -30,15 +30,14 @@ public function testAsyncSendRequest($httpMethod, $uri, array $httpHeaders, $req
3030
}
3131

3232
/**
33-
* {@inheritdoc}
34-
*
3533
* @dataProvider requestWithOutcomeProvider
3634
*/
35+
#[DataProvider('requestWithOutcomeProvider')]
3736
public function testSendAsyncRequestWithOutcome(
38-
$uriAndOutcome,
39-
$httpVersion,
37+
array $uriAndOutcome,
38+
string $httpVersion,
4039
array $httpHeaders,
41-
$requestBody
40+
?string $requestBody
4241
): void {
4342
if ( $requestBody !== null) {
4443
self::markTestSkipped('cURL can not send body using GET');

tests/Functional/HttpClientDiactorosTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Http\Client\Curl\Client;
99
use Psr\Http\Client\ClientInterface;
10-
use Http\Client\HttpClient;
1110
use Psr\Http\Message\StreamInterface;
1211
use Laminas\Diactoros\ResponseFactory;
1312
use Laminas\Diactoros\Stream;

tests/Functional/HttpClientGuzzleTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,11 @@
1515
*/
1616
class HttpClientGuzzleTest extends HttpClientTestCase
1717
{
18-
/**
19-
* {@inheritdoc}
20-
*/
2118
protected function createHttpAdapter(): ClientInterface
2219
{
2320
return new Client(new HttpFactory(), new HttpFactory());
2421
}
2522

26-
/**
27-
* {@inheritdoc}
28-
*/
2923
protected function createFileStream(string $filename): StreamInterface
3024
{
3125
return new Stream(fopen($filename, 'r'));

tests/Functional/HttpClientTestCase.php

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Http\Client\Tests\HttpClientTest;
88
use Http\Client\Tests\PHPUnitUtility;
9+
use PHPUnit\Framework\Attributes\DataProvider;
910
use Psr\Http\Message\StreamInterface;
1011

1112
/**
@@ -18,7 +19,7 @@ abstract class HttpClientTestCase extends HttpClientTest
1819
*
1920
* @var string[]
2021
*/
21-
protected $tmpFiles = [];
22+
protected array $tmpFiles = [];
2223

2324
public function testSendLargeFile(): void
2425
{
@@ -31,12 +32,9 @@ public function testSendLargeFile(): void
3132
fclose($fd);
3233
$body = $this->createFileStream($filename);
3334

34-
$request = self::$messageFactory->createRequest(
35-
'POST',
36-
PHPUnitUtility::getUri(),
37-
['content-length' => 1024 * 2048],
38-
$body
39-
);
35+
$request = self::$requestFactory->createRequest('POST', PHPUnitUtility::getUri());
36+
$request = $request->withHeader('content-length', 1024 * 2048);
37+
$request = $request->withBody($body);
4038

4139
$response = $this->httpAdapter->sendRequest($request);
4240
$this->assertResponse(
@@ -52,11 +50,10 @@ public function testSendLargeFile(): void
5250
}
5351

5452
/**
55-
* {@inheritdoc}
56-
*
5753
* @dataProvider requestProvider
5854
*/
59-
public function testSendRequest($httpMethod, $uri, array $httpHeaders, $requestBody): void
55+
#[DataProvider('requestProvider')]
56+
public function testSendRequest(string $httpMethod, string $uri, array $httpHeaders, ?string $requestBody): void
6057
{
6158
if ($requestBody !== null && in_array($httpMethod, ['GET', 'HEAD', 'TRACE'], true)) {
6259
self::markTestSkipped('cURL can not send body using '.$httpMethod);
@@ -70,15 +67,14 @@ public function testSendRequest($httpMethod, $uri, array $httpHeaders, $requestB
7067
}
7168

7269
/**
73-
* {@inheritdoc}
74-
*
7570
* @dataProvider requestWithOutcomeProvider
7671
*/
72+
#[DataProvider('requestWithOutcomeProvider')]
7773
public function testSendRequestWithOutcome(
78-
$uriAndOutcome,
79-
$httpVersion,
74+
array $uriAndOutcome,
75+
string $httpVersion,
8076
array $httpHeaders,
81-
$requestBody
77+
?string $requestBody
8278
): void {
8379
if ($requestBody !== null) {
8480
self::markTestSkipped('cURL can not send body using GET');
@@ -95,8 +91,6 @@ abstract protected function createFileStream(string $filename): StreamInterface;
9591

9692
/**
9793
* Create temporary file.
98-
*
99-
* @return string Filename
10094
*/
10195
protected function createTempFile(): string
10296
{

0 commit comments

Comments
 (0)