Skip to content
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"laminas/laminas-validator": "^2.30.1",
"phpunit/phpunit": "^9.6.10",
"psalm/plugin-phpunit": "^0.18.4",
"psr/http-message": "^1.1",
"psr/http-message": "^2.0",
"vimeo/psalm": "^5.13.1"
},
"conflict": {
Expand Down
18 changes: 9 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 4 additions & 12 deletions test/Reader/Http/Psr7ResponseDecoratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use Laminas\Feed\Reader\Http\HeaderAwareResponseInterface;
use Laminas\Feed\Reader\Http\Psr7ResponseDecorator;
use Laminas\Feed\Reader\Http\ResponseInterface;
use LaminasTest\Feed\Reader\TestAsset\Psr7Stream;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface as Psr7ResponseInterface;
use Psr\Http\Message\StreamInterface;

/**
* @covers \Laminas\Feed\Reader\Http\Psr7ResponseDecorator
Expand Down Expand Up @@ -56,21 +56,13 @@ public function testProxiesToDecoratedResponseToRetrieveStatusCode(): void

public function testProxiesToDecoratedResponseToRetrieveBody(): void
{
$originalResponse = $this->createMock(Psr7ResponseInterface::class);
$originalResponse
->method('getBody')
$body = $this->createMock(StreamInterface::class);
$body->method('__toString')
->willReturn('BODY');
$decorator = new Psr7ResponseDecorator($originalResponse);
$this->assertSame('BODY', $decorator->getBody());
}

public function testCastsStreamToStringWhenReturningPsr7Body(): void
{
$stream = new Psr7Stream('BODY');
$originalResponse = $this->createMock(Psr7ResponseInterface::class);
$originalResponse
->method('getBody')
->willReturn($stream);
->willReturn($body);
$decorator = new Psr7ResponseDecorator($originalResponse);
$this->assertSame('BODY', $decorator->getBody());
}
Expand Down
12 changes: 3 additions & 9 deletions test/Reader/TestAsset/Psr7Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,12 @@
*/
class Psr7Stream
{
/** @var mixed */
private $streamValue;

/** @param mixed $streamValue */
public function __construct($streamValue)
public function __construct(private string $streamValue)
{
$this->streamValue = $streamValue;
}

/** @return string */
public function __toString()
public function __toString(): string
{
return (string) $this->streamValue;
return $this->streamValue;
}
}