diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 54858e2..9d1de15 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,7 +9,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.2, 8.1, 8.0] + php: [8.3, 8.2, 8.1] stability: [prefer-lowest, prefer-stable] name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/README.md b/README.md index e86533b..855de3e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ A HTTP client for Farzai Package. You can install the package via composer: ```bash -composer require farzai/transport:dev-main +composer require farzai/transport ``` ## Testing diff --git a/composer.json b/composer.json index 23c4e22..54f18cf 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^8.0", + "php": "^8.1", "farzai/support": "^1.1", "guzzlehttp/guzzle": "^7.7", "guzzlehttp/psr7": "^2.5", diff --git a/tests/ResponseTest.php b/tests/ResponseTest.php index 1d476b8..2911d1b 100644 --- a/tests/ResponseTest.php +++ b/tests/ResponseTest.php @@ -75,6 +75,21 @@ expect($response->json())->toBe(['foo' => 'bar']); }); +it('can get json body with dot notation', function () { + $stream = $this->createMock(StreamInterface::class); + $stream->method('getContents')->willReturn('{"foo":{"bar":"baz"}}'); + + $baseResponse = $this->createMock(ResponseInterface::class); + $baseResponse->method('getBody')->willReturn($stream); + + $response = new Response( + $this->createMock(RequestInterface::class), + $baseResponse, + ); + + expect($response->json('foo.bar'))->toBe('baz'); +}); + it('cannot get json when invalid json format', function () { $stream = $this->createMock(StreamInterface::class); $stream->method('getContents')->willReturn('{"foo":"bar"'); @@ -116,7 +131,6 @@ $response = new Response( $this->createMock(RequestInterface::class), $baseResponse, - ); $response->throw();