Skip to content

Commit

Permalink
Merge pull request #2 from lmc-eu/feature/add-initiator-to-response-d…
Browse files Browse the repository at this point in the history
…ecoders

Add inititator to response decoders supports method
  • Loading branch information
MortalFlesh authored Aug 10, 2021
2 parents e4051fd + 19bd4ab commit cbdc42c
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<!-- There should always be "Unreleased" section at the beginning. -->

## Unreleased
- [**BC**] Add an `$initiator` to `ResponseDecoders` `supports` method
- Fix HttpProfilerFormatter test to work with cloned response

## 1.0.0 - 2021-05-13
- Initial implementation
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ext-json": "*",
"ext-mbstring": "*",
"fig/http-message-util": "^1.1",
"lmc/cqrs-types": "^1.0",
"lmc/cqrs-types": "^2.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
Expand Down
2 changes: 1 addition & 1 deletion src/Decoder/HttpMessageResponseDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class HttpMessageResponseDecoder implements ResponseDecoderInterface
{
public function supports($response): bool
public function supports($response, $initiator): bool
{
return $response instanceof MessageInterface;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Decoder/StreamResponseDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class StreamResponseDecoder implements ResponseDecoderInterface
{
public function supports($response): bool
public function supports($response, $initiator): bool
{
return $response instanceof StreamInterface;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Decoder/HttpMessageResponseDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function shouldDecodeNyholmMessage($message, bool $isSupported, $expected
{
$decoded = $this->decoder->decode($message);

$this->assertSame($isSupported, $this->decoder->supports($message));
$this->assertSame($isSupported, $this->decoder->supports($message, null));
$this->assertEquals($expected, $decoded);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Decoder/StreamResponseDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function shouldDecodeNyholmMessage($message, bool $isSupported, $expected
{
$decoded = $this->decoder->decode($message);

$this->assertSame($isSupported, $this->decoder->supports($message));
$this->assertSame($isSupported, $this->decoder->supports($message, null));
$this->assertEquals($expected, $decoded);
}

Expand Down
2 changes: 2 additions & 0 deletions tests/Formatter/HttpProfilerFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function provideNyholmItems(): iterable
'test',
'',
$request = (new \Nyholm\Psr7\Request('get', 'url'))
->withBody(\Nyholm\Psr7\Stream::create())
),
new ProfilerItem(
'id',
Expand Down Expand Up @@ -251,6 +252,7 @@ public function provideGuzzleItems(): iterable
'test',
'',
$request = (new \GuzzleHttp\Psr7\Request('post', 'url'))
->withBody(Utils::streamFor(null))
),
new ProfilerItem(
'id',
Expand Down

0 comments on commit cbdc42c

Please sign in to comment.