File: 0002-Modernize-PHPUnit-syntax.patch

package info (click to toggle)
php-http-psr7-integration-tests 1.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 464 kB
  • sloc: php: 1,591; makefile: 19
file content (206 lines) | stat: -rw-r--r-- 7,219 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Mon, 17 Feb 2025 20:26:48 +0100
Subject: Modernize PHPUnit syntax

---
 src/MessageTrait.php                 | 3 +++
 src/RequestIntegrationTest.php       | 2 ++
 src/ResponseIntegrationTest.php      | 2 ++
 src/ServerRequestIntegrationTest.php | 3 +++
 src/StreamIntegrationTest.php        | 5 +++++
 src/UriIntegrationTest.php           | 7 +++++++
 6 files changed, 22 insertions(+)

diff --git a/src/MessageTrait.php b/src/MessageTrait.php
index 09f90d5..84d9a48 100644
--- a/src/MessageTrait.php
+++ b/src/MessageTrait.php
@@ -4,6 +4,7 @@ namespace Http\Psr7Test;
 
 use InvalidArgumentException;
 use PHPUnit\Framework\AssertionFailedError;
+use PHPUnit\Framework\Attributes\DataProvider;
 use Psr\Http\Message\MessageInterface;
 use Throwable;
 use TypeError;
@@ -135,6 +136,7 @@ trait MessageTrait
     /**
      * @dataProvider getInvalidHeaderArguments
      */
+    #[DataProvider('getInvalidHeaderArguments')]
     public function testWithHeaderInvalidArguments($name, $value)
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
@@ -186,6 +188,7 @@ trait MessageTrait
     /**
      * @dataProvider getInvalidHeaderArguments
      */
+    #[DataProvider('getInvalidHeaderArguments')]
     public function testWithAddedHeaderInvalidArguments($name, $value)
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
diff --git a/src/RequestIntegrationTest.php b/src/RequestIntegrationTest.php
index f847093..921e768 100644
--- a/src/RequestIntegrationTest.php
+++ b/src/RequestIntegrationTest.php
@@ -4,6 +4,7 @@ namespace Http\Psr7Test;
 
 use InvalidArgumentException;
 use PHPUnit\Framework\AssertionFailedError;
+use PHPUnit\Framework\Attributes\DataProvider;
 use Psr\Http\Message\RequestInterface;
 use Psr\Http\Message\UriInterface;
 use Throwable;
@@ -94,6 +95,7 @@ abstract class RequestIntegrationTest extends BaseTest
     /**
      * @dataProvider getInvalidMethods
      */
+    #[DataProvider('getInvalidMethods')]
     public function testMethodWithInvalidArguments($method)
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
diff --git a/src/ResponseIntegrationTest.php b/src/ResponseIntegrationTest.php
index 415ccc4..bb9029c 100644
--- a/src/ResponseIntegrationTest.php
+++ b/src/ResponseIntegrationTest.php
@@ -4,6 +4,7 @@ namespace Http\Psr7Test;
 
 use InvalidArgumentException;
 use PHPUnit\Framework\AssertionFailedError;
+use PHPUnit\Framework\Attributes\DataProvider;
 use Psr\Http\Message\ResponseInterface;
 use Throwable;
 use TypeError;
@@ -56,6 +57,7 @@ abstract class ResponseIntegrationTest extends BaseTest
     /**
      * @dataProvider getInvalidStatusCodeArguments
      */
+    #[DataProvider('getInvalidStatusCodeArguments')]
     public function testStatusCodeInvalidArgument($statusCode)
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
diff --git a/src/ServerRequestIntegrationTest.php b/src/ServerRequestIntegrationTest.php
index d06a8f1..1d29081 100644
--- a/src/ServerRequestIntegrationTest.php
+++ b/src/ServerRequestIntegrationTest.php
@@ -2,6 +2,7 @@
 
 namespace Http\Psr7Test;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use Psr\Http\Message\ServerRequestInterface;
 
 /**
@@ -88,6 +89,7 @@ abstract class ServerRequestIntegrationTest extends RequestIntegrationTest
     /**
      * @dataProvider validParsedBodyParams
      */
+    #[DataProvider('validParsedBodyParams')]
     public function testGetParsedBody($value)
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
@@ -111,6 +113,7 @@ abstract class ServerRequestIntegrationTest extends RequestIntegrationTest
     /**
      * @dataProvider invalidParsedBodyParams
      */
+    #[DataProvider('invalidParsedBodyParams')]
     public function testGetParsedBodyInvalid($value)
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
diff --git a/src/StreamIntegrationTest.php b/src/StreamIntegrationTest.php
index a677142..982dd2b 100644
--- a/src/StreamIntegrationTest.php
+++ b/src/StreamIntegrationTest.php
@@ -2,6 +2,7 @@
 
 namespace Http\Psr7Test;
 
+use PHPUnit\Framework\Attributes\Group;
 use Psr\Http\Message\StreamInterface;
 
 /**
@@ -142,6 +143,7 @@ abstract class StreamIntegrationTest extends BaseTest
     /**
      * @group internet
      */
+    #[Group('internet')]
     public function testIsNotSeekable()
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
@@ -169,6 +171,7 @@ abstract class StreamIntegrationTest extends BaseTest
     /**
      * @group internet
      */
+    #[Group('internet')]
     public function testIsNotWritable()
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
@@ -196,6 +199,7 @@ abstract class StreamIntegrationTest extends BaseTest
     /**
      * @group internet
      */
+    #[Group('internet')]
     public function testIsNotReadable()
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
@@ -239,6 +243,7 @@ abstract class StreamIntegrationTest extends BaseTest
     /**
      * @group internet
      */
+    #[Group('internet')]
     public function testRewindNotSeekable()
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
diff --git a/src/UriIntegrationTest.php b/src/UriIntegrationTest.php
index 7c76378..0522f33 100644
--- a/src/UriIntegrationTest.php
+++ b/src/UriIntegrationTest.php
@@ -4,6 +4,8 @@ namespace Http\Psr7Test;
 
 use InvalidArgumentException;
 use PHPUnit\Framework\AssertionFailedError;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Depends;
 use Psr\Http\Message\UriInterface;
 use Throwable;
 use TypeError;
@@ -45,6 +47,7 @@ abstract class UriIntegrationTest extends BaseTest
     /**
      * @dataProvider getInvalidSchemaArguments
      */
+    #[DataProvider('getInvalidSchemaArguments')]
     public function testWithSchemeInvalidArguments($schema)
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
@@ -155,6 +158,7 @@ abstract class UriIntegrationTest extends BaseTest
     /**
      * @dataProvider getPaths
      */
+    #[DataProvider('getPaths')]
     public function testPath(UriInterface $uri, string $expected)
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
@@ -181,6 +185,7 @@ abstract class UriIntegrationTest extends BaseTest
     /**
      * @dataProvider getQueries
      */
+    #[DataProvider('getQueries')]
     public function testQuery(UriInterface $uri, string $expected)
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
@@ -206,6 +211,7 @@ abstract class UriIntegrationTest extends BaseTest
     /**
      * @dataProvider getFragments
      */
+    #[DataProvider('getFragments')]
     public function testFragment(UriInterface $uri, string $expected)
     {
         if (isset($this->skippedTests[__FUNCTION__])) {
@@ -304,6 +310,7 @@ abstract class UriIntegrationTest extends BaseTest
      *
      * @psalm-param array{expected: non-empty-string, uri: UriInterface} $test
      */
+    #[Depends('testGetPathNormalizesMultipleLeadingSlashesToSingleSlashToPreventXSS')]
     public function testStringRepresentationWithMultipleSlashes(array $test)
     {
         $this->assertSame($test['expected'], (string) $test['uri']);