Skip to content

Commit 45b1c92

Browse files
authored
Merge pull request #253 from php-http/remove-phpspec
rewrite tests from phpspec to phpunit
2 parents 0cfe985 + a11b946 commit 45b1c92

File tree

70 files changed

+2692
-3043
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2692
-3043
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
name: PHP ${{ matrix.php }} Latest
1212
runs-on: ubuntu-latest
1313
strategy:
14+
fail-fast: false
1415
matrix:
1516
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
1617

@@ -39,6 +40,7 @@ jobs:
3940
name: PHP ${{ matrix.php }} Lowest
4041
runs-on: ubuntu-latest
4142
strategy:
43+
fail-fast: false
4244
matrix:
4345
php: ['7.1', '7.4', '8.2', '8.3']
4446

@@ -113,7 +115,6 @@ jobs:
113115

114116
- name: Install dependencies
115117
run: |
116-
composer require "friends-of-phpspec/phpspec-code-coverage:^4.3.2" --no-interaction --no-update
117118
composer update --prefer-dist --no-interaction --no-progress
118119
119120
- name: Execute tests

composer.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
"doctrine/instantiator": "^1.1",
2525
"guzzlehttp/psr7": "^1.4",
2626
"nyholm/psr7": "^1.2",
27-
"phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
28-
"phpspec/prophecy": "^1.10.2",
2927
"phpunit/phpunit": "^7.5.20 || ^8.5.33 || ^9.6.7"
3028
},
3129
"suggest": {
@@ -42,17 +40,14 @@
4240
},
4341
"autoload-dev": {
4442
"psr-4": {
45-
"spec\\Http\\Client\\Common\\": "spec/",
4643
"Tests\\Http\\Client\\Common\\": "tests/"
4744
}
4845
},
4946
"scripts": {
5047
"test": [
51-
"vendor/bin/phpspec run",
5248
"vendor/bin/phpunit"
5349
],
5450
"test-ci": [
55-
"vendor/bin/phpspec run -c phpspec.ci.yml",
5651
"vendor/bin/phpunit"
5752
]
5853
},

phpstan.neon.dist

Lines changed: 282 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
parameters:
22
level: max
3-
checkMissingIterableValueType: false
43
treatPhpDocTypesAsCertain: false
54
paths:
65
- src
76
ignoreErrors:
7+
- "#.*no value type specified in iterable type array.*#"
88
# Exception still thrown in PHP 8, not sure why phpstan complains
99
-
1010
message: "#^Dead catch - UnexpectedValueException is never thrown in the try block\\.$#"
@@ -69,6 +69,11 @@ parameters:
6969
count: 1
7070
path: src/Plugin/RedirectPlugin.php
7171

72+
-
73+
message: "#^Method Psr\\\\Http\\\\Message\\\\StreamFactoryInterface@anonymous\/Plugin\/RedirectPlugin.php:221\\:\\:createStream\\(\\) should return Psr\\\\Http\\\\Message\\\\StreamInterface but returns mixed\\.$#"
74+
count: 1
75+
path: src/Plugin/RedirectPlugin.php
76+
7277
-
7378
message: "#^Method Http\\\\Client\\\\Common\\\\Plugin\\\\RetryPlugin\\:\\:retry\\(\\) should return Psr\\\\Http\\\\Message\\\\ResponseInterface but returns mixed\\.$#"
7479
count: 1
@@ -78,3 +83,279 @@ parameters:
7883
message: "#^Method Http\\\\Client\\\\Common\\\\PluginClient\\:\\:sendRequest\\(\\) should return Psr\\\\Http\\\\Message\\\\ResponseInterface but returns mixed\\.$#"
7984
count: 2
8085
path: src/PluginClient.php
86+
87+
-
88+
message: '#^Method Http\\Client\\Common\\BatchResult\:\:getExceptionFor\(\) has UnexpectedValueException in PHPDoc @throws tag but it''s not thrown\.$#'
89+
identifier: throws.unusedType
90+
count: 1
91+
path: src/BatchResult.php
92+
93+
-
94+
message: '#^Method Http\\Client\\Common\\BatchResult\:\:getResponseFor\(\) has UnexpectedValueException in PHPDoc @throws tag but it''s not thrown\.$#'
95+
identifier: throws.unusedType
96+
count: 1
97+
path: src/BatchResult.php
98+
99+
-
100+
message: '#^Parameter \#1 \$response of method Http\\Client\\Common\\Deferred\:\:resolve\(\) expects Psr\\Http\\Message\\ResponseInterface, mixed given\.$#'
101+
identifier: argument.type
102+
count: 2
103+
path: src/Deferred.php
104+
105+
-
106+
message: '#^Invalid type mixed to throw\.$#'
107+
identifier: throw.notThrowable
108+
count: 1
109+
path: src/HttpClientPool/HttpClientPoolItem.php
110+
111+
-
112+
message: '#^Method Http\\Client\\Common\\HttpMethodsClient\:\:createRequest\(\) should return Psr\\Http\\Message\\RequestInterface but returns mixed\.$#'
113+
identifier: return.type
114+
count: 1
115+
path: src/HttpMethodsClient.php
116+
117+
-
118+
message: '#^Parameter \#2 \$value of method Psr\\Http\\Message\\MessageInterface\:\:withHeader\(\) expects array\<string\>\|string, mixed given\.$#'
119+
identifier: argument.type
120+
count: 1
121+
path: src/HttpMethodsClient.php
122+
123+
-
124+
message: '#^Property Http\\Client\\Common\\Plugin\\AddHostPlugin\:\:\$replace \(bool\) does not accept mixed\.$#'
125+
identifier: assign.propertyType
126+
count: 1
127+
path: src/Plugin/AddHostPlugin.php
128+
129+
-
130+
message: '#^Parameter \#2 \$config of class Http\\Client\\Common\\Plugin\\AddHostPlugin constructor expects array\{replace\?\: bool\}, array given\.$#'
131+
identifier: argument.type
132+
count: 1
133+
path: src/Plugin/BaseUriPlugin.php
134+
135+
-
136+
message: '#^Property Http\\Client\\Common\\Plugin\\ContentTypePlugin\:\:\$sizeLimit \(int\) does not accept mixed\.$#'
137+
identifier: assign.propertyType
138+
count: 1
139+
path: src/Plugin/ContentTypePlugin.php
140+
141+
-
142+
message: '#^Property Http\\Client\\Common\\Plugin\\ContentTypePlugin\:\:\$skipDetection \(bool\) does not accept mixed\.$#'
143+
identifier: assign.propertyType
144+
count: 1
145+
path: src/Plugin/ContentTypePlugin.php
146+
147+
-
148+
message: '#^Property Http\\Client\\Common\\Plugin\\DecoderPlugin\:\:\$useContentEncoding \(bool\) does not accept mixed\.$#'
149+
identifier: assign.propertyType
150+
count: 1
151+
path: src/Plugin/DecoderPlugin.php
152+
153+
-
154+
message: '#^Property Http\\Client\\Common\\Plugin\\ErrorPlugin\:\:\$onlyServerException \(bool\) does not accept mixed\.$#'
155+
identifier: assign.propertyType
156+
count: 1
157+
path: src/Plugin/ErrorPlugin.php
158+
159+
-
160+
message: '#^Parameter \#2 \$value of method Psr\\Http\\Message\\MessageInterface\:\:withAddedHeader\(\) expects array\<string\>\|string, mixed given\.$#'
161+
identifier: argument.type
162+
count: 1
163+
path: src/Plugin/HeaderAppendPlugin.php
164+
165+
-
166+
message: '#^Parameter \#2 \$value of method Psr\\Http\\Message\\MessageInterface\:\:withHeader\(\) expects array\<string\>\|string, mixed given\.$#'
167+
identifier: argument.type
168+
count: 1
169+
path: src/Plugin/HeaderDefaultsPlugin.php
170+
171+
-
172+
message: '#^Parameter \#1 \$name of method Psr\\Http\\Message\\MessageInterface\:\:hasHeader\(\) expects string, mixed given\.$#'
173+
identifier: argument.type
174+
count: 1
175+
path: src/Plugin/HeaderRemovePlugin.php
176+
177+
-
178+
message: '#^Parameter \#1 \$name of method Psr\\Http\\Message\\MessageInterface\:\:withoutHeader\(\) expects string, mixed given\.$#'
179+
identifier: argument.type
180+
count: 1
181+
path: src/Plugin/HeaderRemovePlugin.php
182+
183+
-
184+
message: '#^Parameter \#2 \$value of method Psr\\Http\\Message\\MessageInterface\:\:withHeader\(\) expects array\<string\>\|string, mixed given\.$#'
185+
identifier: argument.type
186+
count: 1
187+
path: src/Plugin/HeaderSetPlugin.php
188+
189+
-
190+
message: '#^Cannot access offset ''multiple'' on mixed\.$#'
191+
identifier: offsetAccess.nonOffsetAccessible
192+
count: 1
193+
path: src/Plugin/RedirectPlugin.php
194+
195+
-
196+
message: '#^Cannot access offset ''permanent'' on mixed\.$#'
197+
identifier: offsetAccess.nonOffsetAccessible
198+
count: 1
199+
path: src/Plugin/RedirectPlugin.php
200+
201+
-
202+
message: '#^Cannot access offset ''status'' on mixed\.$#'
203+
identifier: offsetAccess.nonOffsetAccessible
204+
count: 1
205+
path: src/Plugin/RedirectPlugin.php
206+
207+
-
208+
message: '#^Cannot access offset ''switch'' on mixed\.$#'
209+
identifier: offsetAccess.nonOffsetAccessible
210+
count: 4
211+
path: src/Plugin/RedirectPlugin.php
212+
213+
-
214+
message: '#^Cannot access offset ''to'' on mixed\.$#'
215+
identifier: offsetAccess.nonOffsetAccessible
216+
count: 2
217+
path: src/Plugin/RedirectPlugin.php
218+
219+
-
220+
message: '#^Cannot access offset ''unless'' on mixed\.$#'
221+
identifier: offsetAccess.nonOffsetAccessible
222+
count: 1
223+
path: src/Plugin/RedirectPlugin.php
224+
225+
-
226+
message: '#^Cannot access offset ''uri'' on mixed\.$#'
227+
identifier: offsetAccess.nonOffsetAccessible
228+
count: 1
229+
path: src/Plugin/RedirectPlugin.php
230+
231+
-
232+
message: '#^Method Http\\Client\\Common\\Plugin\\RedirectPlugin\:\:guessStreamFactory\(\) should return Psr\\Http\\Message\\StreamFactoryInterface\|null but returns mixed\.$#'
233+
identifier: return.type
234+
count: 1
235+
path: src/Plugin/RedirectPlugin.php
236+
237+
-
238+
message: '#^Parameter \#1 \$method of method Psr\\Http\\Message\\RequestInterface\:\:withMethod\(\) expects string, mixed given\.$#'
239+
identifier: argument.type
240+
count: 1
241+
path: src/Plugin/RedirectPlugin.php
242+
243+
-
244+
message: '#^Parameter \#2 \$haystack of function in_array expects array, mixed given\.$#'
245+
identifier: argument.type
246+
count: 1
247+
path: src/Plugin/RedirectPlugin.php
248+
249+
-
250+
message: '#^Parameter \#2 \$targetUri of method Http\\Client\\Common\\Plugin\\RedirectPlugin\:\:buildRedirectRequest\(\) expects Psr\\Http\\Message\\UriInterface, mixed given\.$#'
251+
identifier: argument.type
252+
count: 1
253+
path: src/Plugin/RedirectPlugin.php
254+
255+
-
256+
message: '#^Parameter \#3 \$statusCode of method Http\\Client\\Common\\Plugin\\RedirectPlugin\:\:buildRedirectRequest\(\) expects int, mixed given\.$#'
257+
identifier: argument.type
258+
count: 1
259+
path: src/Plugin/RedirectPlugin.php
260+
261+
-
262+
message: '#^Property Http\\Client\\Common\\Plugin\\RedirectPlugin\:\:\$preserveHeader \(array\|bool\) does not accept mixed\.$#'
263+
identifier: assign.propertyType
264+
count: 1
265+
path: src/Plugin/RedirectPlugin.php
266+
267+
-
268+
message: '#^Property Http\\Client\\Common\\Plugin\\RedirectPlugin\:\:\$streamFactory \(Psr\\Http\\Message\\StreamFactoryInterface\|null\) does not accept mixed\.$#'
269+
identifier: assign.propertyType
270+
count: 1
271+
path: src/Plugin/RedirectPlugin.php
272+
273+
-
274+
message: '#^Property Http\\Client\\Common\\Plugin\\RedirectPlugin\:\:\$useDefaultForMultiple \(bool\) does not accept mixed\.$#'
275+
identifier: assign.propertyType
276+
count: 1
277+
path: src/Plugin/RedirectPlugin.php
278+
279+
-
280+
message: '#^Cannot use \+\+ on mixed\.$#'
281+
identifier: preInc.type
282+
count: 1
283+
path: src/Plugin/RetryPlugin.php
284+
285+
-
286+
message: '#^Property Http\\Client\\Common\\Plugin\\RetryPlugin\:\:\$errorResponseDecider \(callable\(\)\: mixed\) does not accept mixed\.$#'
287+
identifier: assign.propertyType
288+
count: 1
289+
path: src/Plugin/RetryPlugin.php
290+
291+
-
292+
message: '#^Property Http\\Client\\Common\\Plugin\\RetryPlugin\:\:\$errorResponseDelay \(callable\(\)\: mixed\) does not accept mixed\.$#'
293+
identifier: assign.propertyType
294+
count: 1
295+
path: src/Plugin/RetryPlugin.php
296+
297+
-
298+
message: '#^Property Http\\Client\\Common\\Plugin\\RetryPlugin\:\:\$exceptionDecider \(callable\(\)\: mixed\) does not accept mixed\.$#'
299+
identifier: assign.propertyType
300+
count: 1
301+
path: src/Plugin/RetryPlugin.php
302+
303+
-
304+
message: '#^Property Http\\Client\\Common\\Plugin\\RetryPlugin\:\:\$exceptionDelay \(callable\(\)\: mixed\) does not accept mixed\.$#'
305+
identifier: assign.propertyType
306+
count: 1
307+
path: src/Plugin/RetryPlugin.php
308+
309+
-
310+
message: '#^Property Http\\Client\\Common\\Plugin\\RetryPlugin\:\:\$retry \(int\) does not accept mixed\.$#'
311+
identifier: assign.propertyType
312+
count: 1
313+
path: src/Plugin/RetryPlugin.php
314+
315+
-
316+
message: '#^Property Http\\Client\\Common\\Plugin\\SeekableBodyPlugin\:\:\$memoryBufferSize \(int\) does not accept mixed\.$#'
317+
identifier: assign.propertyType
318+
count: 1
319+
path: src/Plugin/SeekableBodyPlugin.php
320+
321+
-
322+
message: '#^Property Http\\Client\\Common\\Plugin\\SeekableBodyPlugin\:\:\$useFileBuffer \(bool\) does not accept mixed\.$#'
323+
identifier: assign.propertyType
324+
count: 1
325+
path: src/Plugin/SeekableBodyPlugin.php
326+
327+
-
328+
message: '#^Trait Http\\Client\\Common\\Plugin\\VersionBridgePlugin is used zero times and is not analysed\.$#'
329+
identifier: trait.unused
330+
count: 1
331+
path: src/Plugin/VersionBridgePlugin.php
332+
333+
-
334+
message: '#^Method Http\\Client\\Common\\PluginChain\:\:__invoke\(\) should return Http\\Promise\\Promise but returns mixed\.$#'
335+
identifier: return.type
336+
count: 1
337+
path: src/PluginChain.php
338+
339+
-
340+
message: '#^Parameter \#1 \$response of class Http\\Client\\Promise\\HttpFulfilledPromise constructor expects Psr\\Http\\Message\\ResponseInterface, mixed given\.$#'
341+
identifier: argument.type
342+
count: 1
343+
path: src/PluginClient.php
344+
345+
-
346+
message: '#^Parameter \#3 \$options of class Http\\Client\\Common\\PluginChain constructor expects array\{max_restarts\?\: int\}, array given\.$#'
347+
identifier: argument.type
348+
count: 1
349+
path: src/PluginClient.php
350+
351+
-
352+
message: '#^Parameter \#3 \$options of class Http\\Client\\Common\\PluginClient constructor expects array\{max_restarts\?\: int\}, array given\.$#'
353+
identifier: argument.type
354+
count: 1
355+
path: src/PluginClientBuilder.php
356+
357+
-
358+
message: '#^Trait Http\\Client\\Common\\VersionBridgeClient is used zero times and is not analysed\.$#'
359+
identifier: trait.unused
360+
count: 1
361+
path: src/VersionBridgeClient.php

spec/BatchClientSpec.php

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)