Skip to content

Commit 623242c

Browse files
committed
rewrite tests from phpspec to phpunit
1 parent 0cfe985 commit 623242c

File tree

70 files changed

+2687
-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

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

spec/BatchClientSpec.php

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

0 commit comments

Comments
 (0)