Skip to content

Commit a8a8746

Browse files
committed
Add support for PHPUnit 11 and 12
Signed-off-by: Aleksei Khudiakov <[email protected]>
1 parent 76689df commit a8a8746

File tree

6 files changed

+18
-1
lines changed

6 files changed

+18
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616
"require": {
1717
"php": "^7.3 || ^8.0",
18-
"phpunit/phpunit": "^9.3 || ^10.0",
18+
"phpunit/phpunit": "^9.3 || ^10.0 || ^11.5 || ^12.4",
1919
"psr/http-message": "^1.0 || ^2.0"
2020
},
2121
"require-dev": {

src/MessageTrait.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use InvalidArgumentException;
66
use PHPUnit\Framework\AssertionFailedError;
7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use Psr\Http\Message\MessageInterface;
89
use Throwable;
910
use TypeError;
@@ -135,6 +136,7 @@ public function testWithHeader()
135136
/**
136137
* @dataProvider getInvalidHeaderArguments
137138
*/
139+
#[DataProvider('getInvalidHeaderArguments')]
138140
public function testWithHeaderInvalidArguments($name, $value)
139141
{
140142
if (isset($this->skippedTests[__FUNCTION__])) {
@@ -188,6 +190,7 @@ public function testWithAddedHeader()
188190
/**
189191
* @dataProvider getInvalidHeaderArguments
190192
*/
193+
#[DataProvider('getInvalidHeaderArguments')]
191194
public function testWithAddedHeaderInvalidArguments($name, $value)
192195
{
193196
if (isset($this->skippedTests[__FUNCTION__])) {

src/RequestIntegrationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use InvalidArgumentException;
66
use PHPUnit\Framework\AssertionFailedError;
7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use Psr\Http\Message\RequestInterface;
89
use Psr\Http\Message\UriInterface;
910
use Throwable;
@@ -94,6 +95,7 @@ public function testMethodIsExtendable()
9495
/**
9596
* @dataProvider getInvalidMethods
9697
*/
98+
#[DataProvider('getInvalidMethods')]
9799
public function testMethodWithInvalidArguments($method)
98100
{
99101
if (isset($this->skippedTests[__FUNCTION__])) {

src/ResponseIntegrationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use InvalidArgumentException;
66
use PHPUnit\Framework\AssertionFailedError;
7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use Psr\Http\Message\ResponseInterface;
89
use Throwable;
910
use TypeError;
@@ -56,6 +57,7 @@ public function testStatusCode()
5657
/**
5758
* @dataProvider getInvalidStatusCodeArguments
5859
*/
60+
#[DataProvider('getInvalidStatusCodeArguments')]
5961
public function testStatusCodeInvalidArgument($statusCode)
6062
{
6163
if (isset($this->skippedTests[__FUNCTION__])) {

src/ServerRequestIntegrationTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Http\Psr7Test;
44

5+
use PHPUnit\Framework\Attributes\DataProvider;
56
use Psr\Http\Message\ServerRequestInterface;
67

78
/**
@@ -88,6 +89,7 @@ public function testGetUploadedFiles()
8889
/**
8990
* @dataProvider validParsedBodyParams
9091
*/
92+
#[DataProvider('validParsedBodyParams')]
9193
public function testGetParsedBody($value)
9294
{
9395
if (isset($this->skippedTests[__FUNCTION__])) {
@@ -111,6 +113,7 @@ public static function validParsedBodyParams()
111113
/**
112114
* @dataProvider invalidParsedBodyParams
113115
*/
116+
#[DataProvider('invalidParsedBodyParams')]
114117
public function testGetParsedBodyInvalid($value)
115118
{
116119
if (isset($this->skippedTests[__FUNCTION__])) {

src/UriIntegrationTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use InvalidArgumentException;
66
use PHPUnit\Framework\AssertionFailedError;
7+
use PHPUnit\Framework\Attributes\DataProvider;
8+
use PHPUnit\Framework\Attributes\Depends;
79
use Psr\Http\Message\UriInterface;
810
use Throwable;
911
use TypeError;
@@ -45,6 +47,7 @@ public function testScheme()
4547
/**
4648
* @dataProvider getInvalidSchemaArguments
4749
*/
50+
#[DataProvider('getInvalidSchemaArguments')]
4851
public function testWithSchemeInvalidArguments($schema)
4952
{
5053
if (isset($this->skippedTests[__FUNCTION__])) {
@@ -155,6 +158,7 @@ public function testPort()
155158
/**
156159
* @dataProvider getPaths
157160
*/
161+
#[DataProvider('getPaths')]
158162
public function testPath(UriInterface $uri, string $expected)
159163
{
160164
if (isset($this->skippedTests[__FUNCTION__])) {
@@ -181,6 +185,7 @@ public static function getPaths()
181185
/**
182186
* @dataProvider getQueries
183187
*/
188+
#[DataProvider('getQueries')]
184189
public function testQuery(UriInterface $uri, string $expected)
185190
{
186191
if (isset($this->skippedTests[__FUNCTION__])) {
@@ -206,6 +211,7 @@ public static function getQueries()
206211
/**
207212
* @dataProvider getFragments
208213
*/
214+
#[DataProvider('getFragments')]
209215
public function testFragment(UriInterface $uri, string $expected)
210216
{
211217
if (isset($this->skippedTests[__FUNCTION__])) {
@@ -304,6 +310,7 @@ public function testGetPathNormalizesMultipleLeadingSlashesToSingleSlashToPreven
304310
*
305311
* @psalm-param array{expected: non-empty-string, uri: UriInterface} $test
306312
*/
313+
#[Depends('testGetPathNormalizesMultipleLeadingSlashesToSingleSlashToPreventXSS')]
307314
public function testStringRepresentationWithMultipleSlashes(array $test)
308315
{
309316
$this->assertSame($test['expected'], (string) $test['uri']);

0 commit comments

Comments
 (0)