diff --git a/composer.json b/composer.json index 046fba2..ab1d3fe 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "fig/http-message-util": "^1.1.2", "psr/container": "^1.0 || ^2.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", + "psr/http-message": "^1.0 || ^2.0", "psr/http-server-middleware": "^1.0", "spatie/array-to-xml": "^2.3 || ^3.0", "webmozart/assert": "^1.10", diff --git a/composer.lock b/composer.lock index 0a0ff73..062ad3e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6ad3f2b0f06f12ba0660b43124c4209e", + "content-hash": "88c3414a3e573dbb743ea4fb1f574b2b", "packages": [ { "name": "fig/http-message-util", @@ -172,16 +172,16 @@ }, { "name": "psr/http-message", - "version": "1.1", + "version": "2.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { @@ -190,7 +190,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -205,7 +205,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -219,9 +219,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/1.1" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2023-04-04T09:50:52+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { "name": "psr/http-server-handler", diff --git a/test/ProblemDetailsNotFoundHandlerTest.php b/test/ProblemDetailsNotFoundHandlerTest.php index ed1c69a..51d8b4e 100644 --- a/test/ProblemDetailsNotFoundHandlerTest.php +++ b/test/ProblemDetailsNotFoundHandlerTest.php @@ -4,13 +4,15 @@ namespace MezzioTest\ProblemDetails; +use Laminas\Diactoros\ServerRequest; +use Laminas\Diactoros\Stream; +use Laminas\Diactoros\Uri; use Mezzio\ProblemDetails\ProblemDetailsNotFoundHandler; use Mezzio\ProblemDetails\ProblemDetailsResponseFactory; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; class ProblemDetailsNotFoundHandlerTest extends TestCase @@ -37,10 +39,14 @@ public static function acceptHeaders(): array #[DataProvider('acceptHeaders')] public function testResponseFactoryPassedInConstructorGeneratesTheReturnedResponse(string $acceptHeader): void { - $request = $this->createMock(ServerRequestInterface::class); - $request->method('getMethod')->willReturn('POST'); - $request->method('getHeaderLine')->with('Accept')->willReturn($acceptHeader); - $request->method('getUri')->willReturn('https://example.com/foo'); + $request = new ServerRequest( + [], + [], + new Uri('https://example.com/foo'), + 'POST', + new Stream('php://memory'), + ['Accept' => $acceptHeader] + ); $response = $this->createMock(ResponseInterface::class); @@ -62,10 +68,14 @@ public function testResponseFactoryPassedInConstructorGeneratesTheReturnedRespon public function testHandlerIsCalledIfAcceptHeaderIsUnacceptable(): void { - $request = $this->createMock(ServerRequestInterface::class); - $request->method('getMethod')->willReturn('POST'); - $request->method('getHeaderLine')->with('Accept')->willReturn('text/html'); - $request->method('getUri')->willReturn('https://example.com/foo'); + $request = new ServerRequest( + [], + [], + new Uri('https://example.com/foo'), + 'POST', + new Stream('php://memory'), + ['Accept' => 'text/html'] + ); $response = $this->createMock(ResponseInterface::class);