Skip to content

Commit a349bed

Browse files
authored
Merge pull request #17 from php-api-clients/dependabot/composer/api-clients/test-utilities-5.2.0
Bump api-clients/test-utilities from 5.1.0 to 5.2.0
2 parents c563826 + df3b13d commit a349bed

8 files changed

+477
-166
lines changed

composer.lock

Lines changed: 449 additions & 150 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/JsonDecodeMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function post(
4949
}
5050

5151
if (!isset($options[self::class]) &&
52-
strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) {
52+
\strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) {
5353
return resolve($response);
5454
}
5555

src/JsonEncodeMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function pre(
4949
}
5050

5151
return $this->jsonEncodeService->encode($body->getParsedContents())->then(function ($json) use ($request) {
52-
$body = new BufferStream(strlen($json));
52+
$body = new BufferStream(\strlen($json));
5353
$body->write($json);
5454

5555
return resolve($request->withBody($body)->withAddedHeader('Content-Type', 'application/json'));

src/JsonStream.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class JsonStream implements StreamInterface, ParsedContentsInterface
2121
public function __construct(array $json)
2222
{
2323
$this->json = $json;
24-
$jsonString = json_encode($json);
25-
$this->bufferStream = new BufferStream(strlen($jsonString));
24+
$jsonString = \json_encode($json);
25+
$this->bufferStream = new BufferStream(\strlen($jsonString));
2626
$this->bufferStream->write($jsonString);
2727
}
2828

@@ -44,11 +44,11 @@ public function getContents()
4444
return $this->bufferStream->getContents();
4545
}
4646

47-
public function close()
47+
public function close(): void
4848
{
4949
}
5050

51-
public function detach()
51+
public function detach(): void
5252
{
5353
}
5454

tests/AcceptJsonMiddlewareTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
use RingCentral\Psr7\Request;
99
use function Clue\React\Block\await;
1010

11+
/**
12+
* @internal
13+
*/
1114
class AcceptJsonMiddlewareTest extends TestCase
1215
{
13-
public function testPre()
16+
public function testPre(): void
1417
{
1518
$middleware = new AcceptJsonMiddleware();
1619
$request = new Request('GET', 'https://example.com', [], '');

tests/JsonDecodeMiddlewareTest.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
use RingCentral\Psr7\Response;
1414
use function Clue\React\Block\await;
1515

16+
/**
17+
* @internal
18+
*/
1619
class JsonDecodeMiddlewareTest extends TestCase
1720
{
1821
public function provideValidJsonContentTypes()
@@ -24,7 +27,7 @@ public function provideValidJsonContentTypes()
2427
/**
2528
* @dataProvider provideValidJsonContentTypes
2629
*/
27-
public function testPost(string $contentType)
30+
public function testPost(string $contentType): void
2831
{
2932
$loop = Factory::create();
3033
$service = new JsonDecodeService($loop);
@@ -44,7 +47,7 @@ public function testPost(string $contentType)
4447
);
4548
}
4649

47-
public function testPostNoContentType()
50+
public function testPostNoContentType(): void
4851
{
4952
$loop = Factory::create();
5053
$service = new JsonDecodeService($loop);
@@ -60,7 +63,7 @@ public function testPostNoContentType()
6063
);
6164
}
6265

63-
public function testPostNoContentTypeCheck()
66+
public function testPostNoContentTypeCheck(): void
6467
{
6568
$loop = Factory::create();
6669
$service = new JsonDecodeService($loop);
@@ -88,7 +91,7 @@ public function testPostNoContentTypeCheck()
8891
);
8992
}
9093

91-
public function testPostCustomTYpe()
94+
public function testPostCustomTYpe(): void
9295
{
9396
$loop = Factory::create();
9497
$service = new JsonDecodeService($loop);
@@ -116,7 +119,7 @@ public function testPostCustomTYpe()
116119
);
117120
}
118121

119-
public function testPostNoJson()
122+
public function testPostNoJson(): void
120123
{
121124
$loop = Factory::create();
122125
$service = new JsonDecodeService($loop);
@@ -132,7 +135,7 @@ public function testPostNoJson()
132135
);
133136
}
134137

135-
public function testPostEmpty()
138+
public function testPostEmpty(): void
136139
{
137140
$loop = Factory::create();
138141
$service = new JsonDecodeService($loop);

tests/JsonEncodeMiddlewareTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
use RingCentral\Psr7\Request;
1212
use function Clue\React\Block\await;
1313

14+
/**
15+
* @internal
16+
*/
1417
class JsonEncodeMiddlewareTest extends TestCase
1518
{
16-
public function testPre()
19+
public function testPre(): void
1720
{
1821
$loop = Factory::create();
1922
$service = new JsonEncodeService($loop);
@@ -30,7 +33,7 @@ public function testPre()
3033
self::assertSame('application/json', $modifiedRequest->getHeaderLine('Content-Type'));
3134
}
3235

33-
public function testPreNoJson()
36+
public function testPreNoJson(): void
3437
{
3538
$loop = Factory::create();
3639
$service = new JsonEncodeService($loop);

tests/JsonStreamTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
use ApiClients\Middleware\Json\JsonStream;
77
use ApiClients\Tools\TestUtilities\TestCase;
88

9+
/**
10+
* @internal
11+
*/
912
class JsonStreamTest extends TestCase
1013
{
11-
public function testBasics()
14+
public function testBasics(): void
1215
{
1316
$stream = new JsonStream([]);
1417
self::assertSame([], $stream->getParsedContents());

0 commit comments

Comments
 (0)