Skip to content

Bump api-clients/test-utilities from 5.1.0 to 5.2.0 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
599 changes: 449 additions & 150 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/JsonDecodeMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function post(
}

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

Expand Down
2 changes: 1 addition & 1 deletion src/JsonEncodeMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function pre(
}

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

return resolve($request->withBody($body)->withAddedHeader('Content-Type', 'application/json'));
Expand Down
8 changes: 4 additions & 4 deletions src/JsonStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class JsonStream implements StreamInterface, ParsedContentsInterface
public function __construct(array $json)
{
$this->json = $json;
$jsonString = json_encode($json);
$this->bufferStream = new BufferStream(strlen($jsonString));
$jsonString = \json_encode($json);
$this->bufferStream = new BufferStream(\strlen($jsonString));
$this->bufferStream->write($jsonString);
}

Expand All @@ -44,11 +44,11 @@ public function getContents()
return $this->bufferStream->getContents();
}

public function close()
public function close(): void
{
}

public function detach()
public function detach(): void
{
}

Expand Down
5 changes: 4 additions & 1 deletion tests/AcceptJsonMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
use RingCentral\Psr7\Request;
use function Clue\React\Block\await;

/**
* @internal
*/
class AcceptJsonMiddlewareTest extends TestCase
{
public function testPre()
public function testPre(): void
{
$middleware = new AcceptJsonMiddleware();
$request = new Request('GET', 'https://example.com', [], '');
Expand Down
15 changes: 9 additions & 6 deletions tests/JsonDecodeMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use RingCentral\Psr7\Response;
use function Clue\React\Block\await;

/**
* @internal
*/
class JsonDecodeMiddlewareTest extends TestCase
{
public function provideValidJsonContentTypes()
Expand All @@ -24,7 +27,7 @@ public function provideValidJsonContentTypes()
/**
* @dataProvider provideValidJsonContentTypes
*/
public function testPost(string $contentType)
public function testPost(string $contentType): void
{
$loop = Factory::create();
$service = new JsonDecodeService($loop);
Expand All @@ -44,7 +47,7 @@ public function testPost(string $contentType)
);
}

public function testPostNoContentType()
public function testPostNoContentType(): void
{
$loop = Factory::create();
$service = new JsonDecodeService($loop);
Expand All @@ -60,7 +63,7 @@ public function testPostNoContentType()
);
}

public function testPostNoContentTypeCheck()
public function testPostNoContentTypeCheck(): void
{
$loop = Factory::create();
$service = new JsonDecodeService($loop);
Expand Down Expand Up @@ -88,7 +91,7 @@ public function testPostNoContentTypeCheck()
);
}

public function testPostCustomTYpe()
public function testPostCustomTYpe(): void
{
$loop = Factory::create();
$service = new JsonDecodeService($loop);
Expand Down Expand Up @@ -116,7 +119,7 @@ public function testPostCustomTYpe()
);
}

public function testPostNoJson()
public function testPostNoJson(): void
{
$loop = Factory::create();
$service = new JsonDecodeService($loop);
Expand All @@ -132,7 +135,7 @@ public function testPostNoJson()
);
}

public function testPostEmpty()
public function testPostEmpty(): void
{
$loop = Factory::create();
$service = new JsonDecodeService($loop);
Expand Down
7 changes: 5 additions & 2 deletions tests/JsonEncodeMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
use RingCentral\Psr7\Request;
use function Clue\React\Block\await;

/**
* @internal
*/
class JsonEncodeMiddlewareTest extends TestCase
{
public function testPre()
public function testPre(): void
{
$loop = Factory::create();
$service = new JsonEncodeService($loop);
Expand All @@ -30,7 +33,7 @@ public function testPre()
self::assertSame('application/json', $modifiedRequest->getHeaderLine('Content-Type'));
}

public function testPreNoJson()
public function testPreNoJson(): void
{
$loop = Factory::create();
$service = new JsonEncodeService($loop);
Expand Down
5 changes: 4 additions & 1 deletion tests/JsonStreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
use ApiClients\Middleware\Json\JsonStream;
use ApiClients\Tools\TestUtilities\TestCase;

/**
* @internal
*/
class JsonStreamTest extends TestCase
{
public function testBasics()
public function testBasics(): void
{
$stream = new JsonStream([]);
self::assertSame([], $stream->getParsedContents());
Expand Down